Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
ced7037f
Commit
ced7037f
authored
Jul 22, 2018
by
Menethil
Browse files
系统通用配置支持,新增数据表litemall_system
parent
ab91a8e2
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
litemall-db/mybatis-generator/generatorConfig.xml
View file @
ced7037f
...
...
@@ -157,5 +157,8 @@
<columnOverride
javaType=
"java.time.LocalDateTime"
column=
"last_login_time"
/>
<columnOverride
javaType=
"java.time.LocalDateTime"
column=
"add_time"
/>
</table>
<table
tableName=
"litemall_system"
>
<generatedKey
column=
"id"
sqlStatement=
"MySql"
identity=
"true"
/>
</table>
</context>
</generatorConfiguration>
\ No newline at end of file
litemall-db/src/main/java/org/linlinjava/litemall/db/dao/LitemallSystemMapper.java
0 → 100644
View file @
ced7037f
package
org.linlinjava.litemall.db.dao
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
org.linlinjava.litemall.db.domain.LitemallSystem
;
import
org.linlinjava.litemall.db.domain.LitemallSystemExample
;
public
interface
LitemallSystemMapper
{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
long
countByExample
(
LitemallSystemExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
deleteByExample
(
LitemallSystemExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
deleteByPrimaryKey
(
Integer
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
insert
(
LitemallSystem
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
insertSelective
(
LitemallSystem
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallSystem
selectOneByExample
(
LitemallSystemExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallSystem
selectOneByExampleSelective
(
@Param
(
"example"
)
LitemallSystemExample
example
,
@Param
(
"selective"
)
LitemallSystem
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
LitemallSystem
>
selectByExampleSelective
(
@Param
(
"example"
)
LitemallSystemExample
example
,
@Param
(
"selective"
)
LitemallSystem
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
List
<
LitemallSystem
>
selectByExample
(
LitemallSystemExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
LitemallSystem
selectByPrimaryKeySelective
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"selective"
)
LitemallSystem
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
LitemallSystem
selectByPrimaryKey
(
Integer
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
updateByExampleSelective
(
@Param
(
"record"
)
LitemallSystem
record
,
@Param
(
"example"
)
LitemallSystemExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
updateByExample
(
@Param
(
"record"
)
LitemallSystem
record
,
@Param
(
"example"
)
LitemallSystemExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
updateByPrimaryKeySelective
(
LitemallSystem
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
int
updateByPrimaryKey
(
LitemallSystem
record
);
}
\ No newline at end of file
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallSystem.java
0 → 100644
View file @
ced7037f
package
org.linlinjava.litemall.db.domain
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
public
class
LitemallSystem
{
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.id
*
* @mbg.generated
*/
private
Integer
id
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.key
*
* @mbg.generated
*/
private
String
key
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.name
*
* @mbg.generated
*/
private
String
name
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.base_value
*
* @mbg.generated
*/
private
String
baseValue
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.group
*
* @mbg.generated
*/
private
String
group
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.extra_value_1
*
* @mbg.generated
*/
private
String
extraValue1
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.extra_value_2
*
* @mbg.generated
*/
private
String
extraValue2
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.extra_value_3
*
* @mbg.generated
*/
private
String
extraValue3
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.extra_value_4
*
* @mbg.generated
*/
private
String
extraValue4
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.extra_value_5
*
* @mbg.generated
*/
private
String
extraValue5
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.extra_value_6
*
* @mbg.generated
*/
private
String
extraValue6
;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.id
*
* @return the value of litemall_system.id
*
* @mbg.generated
*/
public
Integer
getId
()
{
return
id
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.id
*
* @param id the value for litemall_system.id
*
* @mbg.generated
*/
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.key
*
* @return the value of litemall_system.key
*
* @mbg.generated
*/
public
String
getKey
()
{
return
key
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.key
*
* @param key the value for litemall_system.key
*
* @mbg.generated
*/
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.name
*
* @return the value of litemall_system.name
*
* @mbg.generated
*/
public
String
getName
()
{
return
name
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.name
*
* @param name the value for litemall_system.name
*
* @mbg.generated
*/
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.base_value
*
* @return the value of litemall_system.base_value
*
* @mbg.generated
*/
public
String
getBaseValue
()
{
return
baseValue
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.base_value
*
* @param baseValue the value for litemall_system.base_value
*
* @mbg.generated
*/
public
void
setBaseValue
(
String
baseValue
)
{
this
.
baseValue
=
baseValue
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.group
*
* @return the value of litemall_system.group
*
* @mbg.generated
*/
public
String
getGroup
()
{
return
group
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.group
*
* @param group the value for litemall_system.group
*
* @mbg.generated
*/
public
void
setGroup
(
String
group
)
{
this
.
group
=
group
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.extra_value_1
*
* @return the value of litemall_system.extra_value_1
*
* @mbg.generated
*/
public
String
getExtraValue1
()
{
return
extraValue1
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.extra_value_1
*
* @param extraValue1 the value for litemall_system.extra_value_1
*
* @mbg.generated
*/
public
void
setExtraValue1
(
String
extraValue1
)
{
this
.
extraValue1
=
extraValue1
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.extra_value_2
*
* @return the value of litemall_system.extra_value_2
*
* @mbg.generated
*/
public
String
getExtraValue2
()
{
return
extraValue2
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.extra_value_2
*
* @param extraValue2 the value for litemall_system.extra_value_2
*
* @mbg.generated
*/
public
void
setExtraValue2
(
String
extraValue2
)
{
this
.
extraValue2
=
extraValue2
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.extra_value_3
*
* @return the value of litemall_system.extra_value_3
*
* @mbg.generated
*/
public
String
getExtraValue3
()
{
return
extraValue3
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.extra_value_3
*
* @param extraValue3 the value for litemall_system.extra_value_3
*
* @mbg.generated
*/
public
void
setExtraValue3
(
String
extraValue3
)
{
this
.
extraValue3
=
extraValue3
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.extra_value_4
*
* @return the value of litemall_system.extra_value_4
*
* @mbg.generated
*/
public
String
getExtraValue4
()
{
return
extraValue4
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.extra_value_4
*
* @param extraValue4 the value for litemall_system.extra_value_4
*
* @mbg.generated
*/
public
void
setExtraValue4
(
String
extraValue4
)
{
this
.
extraValue4
=
extraValue4
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.extra_value_5
*
* @return the value of litemall_system.extra_value_5
*
* @mbg.generated
*/
public
String
getExtraValue5
()
{
return
extraValue5
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.extra_value_5
*
* @param extraValue5 the value for litemall_system.extra_value_5
*
* @mbg.generated
*/
public
void
setExtraValue5
(
String
extraValue5
)
{
this
.
extraValue5
=
extraValue5
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.extra_value_6
*
* @return the value of litemall_system.extra_value_6
*
* @mbg.generated
*/
public
String
getExtraValue6
()
{
return
extraValue6
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.extra_value_6
*
* @param extraValue6 the value for litemall_system.extra_value_6
*
* @mbg.generated
*/
public
void
setExtraValue6
(
String
extraValue6
)
{
this
.
extraValue6
=
extraValue6
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", key="
).
append
(
key
);
sb
.
append
(
", name="
).
append
(
name
);
sb
.
append
(
", baseValue="
).
append
(
baseValue
);
sb
.
append
(
", group="
).
append
(
group
);
sb
.
append
(
", extraValue1="
).
append
(
extraValue1
);
sb
.
append
(
", extraValue2="
).
append
(
extraValue2
);
sb
.
append
(
", extraValue3="
).
append
(
extraValue3
);
sb
.
append
(
", extraValue4="
).
append
(
extraValue4
);
sb
.
append
(
", extraValue5="
).
append
(
extraValue5
);
sb
.
append
(
", extraValue6="
).
append
(
extraValue6
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
@Override
public
boolean
equals
(
Object
that
)
{
if
(
this
==
that
)
{
return
true
;
}
if
(
that
==
null
)
{
return
false
;
}
if
(
getClass
()
!=
that
.
getClass
())
{
return
false
;
}
LitemallSystem
other
=
(
LitemallSystem
)
that
;
return
(
this
.
getId
()
==
null
?
other
.
getId
()
==
null
:
this
.
getId
().
equals
(
other
.
getId
()))
&&
(
this
.
getKey
()
==
null
?
other
.
getKey
()
==
null
:
this
.
getKey
().
equals
(
other
.
getKey
()))
&&
(
this
.
getName
()
==
null
?
other
.
getName
()
==
null
:
this
.
getName
().
equals
(
other
.
getName
()))
&&
(
this
.
getBaseValue
()
==
null
?
other
.
getBaseValue
()
==
null
:
this
.
getBaseValue
().
equals
(
other
.
getBaseValue
()))
&&
(
this
.
getGroup
()
==
null
?
other
.
getGroup
()
==
null
:
this
.
getGroup
().
equals
(
other
.
getGroup
()))
&&
(
this
.
getExtraValue1
()
==
null
?
other
.
getExtraValue1
()
==
null
:
this
.
getExtraValue1
().
equals
(
other
.
getExtraValue1
()))
&&
(
this
.
getExtraValue2
()
==
null
?
other
.
getExtraValue2
()
==
null
:
this
.
getExtraValue2
().
equals
(
other
.
getExtraValue2
()))
&&
(
this
.
getExtraValue3
()
==
null
?
other
.
getExtraValue3
()
==
null
:
this
.
getExtraValue3
().
equals
(
other
.
getExtraValue3
()))
&&
(
this
.
getExtraValue4
()
==
null
?
other
.
getExtraValue4
()
==
null
:
this
.
getExtraValue4
().
equals
(
other
.
getExtraValue4
()))
&&
(
this
.
getExtraValue5
()
==
null
?
other
.
getExtraValue5
()
==
null
:
this
.
getExtraValue5
().
equals
(
other
.
getExtraValue5
()))
&&
(
this
.
getExtraValue6
()
==
null
?
other
.
getExtraValue6
()
==
null
:
this
.
getExtraValue6
().
equals
(
other
.
getExtraValue6
()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
*/
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getKey
()
==
null
)
?
0
:
getKey
().
hashCode
());
result
=
prime
*
result
+
((
getName
()
==
null
)
?
0
:
getName
().
hashCode
());
result
=
prime
*
result
+
((
getBaseValue
()
==
null
)
?
0
:
getBaseValue
().
hashCode
());
result
=
prime
*
result
+
((
getGroup
()
==
null
)
?
0
:
getGroup
().
hashCode
());
result
=
prime
*
result
+
((
getExtraValue1
()
==
null
)
?
0
:
getExtraValue1
().
hashCode
());
result
=
prime
*
result
+
((
getExtraValue2
()
==
null
)
?
0
:
getExtraValue2
().
hashCode
());
result
=
prime
*
result
+
((
getExtraValue3
()
==
null
)
?
0
:
getExtraValue3
().
hashCode
());
result
=
prime
*
result
+
((
getExtraValue4
()
==
null
)
?
0
:
getExtraValue4
().
hashCode
());
result
=
prime
*
result
+
((
getExtraValue5
()
==
null
)
?
0
:
getExtraValue5
().
hashCode
());
result
=
prime
*
result
+
((
getExtraValue6
()
==
null
)
?
0
:
getExtraValue6
().
hashCode
());
return
result
;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
enum
Column
{
id
(
"id"
,
"id"
,
"INTEGER"
),
key
(
"key"
,
"key"
,
"VARCHAR"
),
name
(
"name"
,
"name"
,
"VARCHAR"
),
baseValue
(
"base_value"
,
"baseValue"
,
"VARCHAR"
),
group
(
"group"
,
"group"
,
"VARCHAR"
),
extraValue1
(
"extra_value_1"
,
"extraValue1"
,
"VARCHAR"
),
extraValue2
(
"extra_value_2"
,
"extraValue2"
,
"VARCHAR"
),
extraValue3
(
"extra_value_3"
,
"extraValue3"
,
"VARCHAR"
),
extraValue4
(
"extra_value_4"
,
"extraValue4"
,
"VARCHAR"
),
extraValue5
(
"extra_value_5"
,
"extraValue5"
,
"VARCHAR"
),
extraValue6
(
"extra_value_6"
,
"extraValue6"
,
"VARCHAR"
);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
column
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
javaProperty
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
jdbcType
;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
value
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getValue
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJavaProperty
()
{
return
this
.
javaProperty
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJdbcType
()
{
return
this
.
jdbcType
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column
(
String
column
,
String
javaProperty
,
String
jdbcType
)
{
this
.
column
=
column
;
this
.
javaProperty
=
javaProperty
;
this
.
jdbcType
=
jdbcType
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
desc
()
{
return
this
.
column
+
" DESC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
asc
()
{
return
this
.
column
+
" ASC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
static
Column
[]
excludes
(
Column
...
excludes
)
{
ArrayList
<
Column
>
columns
=
new
ArrayList
<>(
Arrays
.
asList
(
Column
.
values
()));
if
(
excludes
!=
null
&&
excludes
.
length
>
0
)
{
columns
.
removeAll
(
new
ArrayList
<>(
Arrays
.
asList
(
excludes
)));
}
return
columns
.
toArray
(
new
Column
[]{});
}
}
}
\ No newline at end of file
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallSystemExample.java
0 → 100644
View file @
ced7037f
This diff is collapsed.
Click to expand it.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallSystemCfgService.java
0 → 100644
View file @
ced7037f
package
org.linlinjava.litemall.db.service
;
import
org.linlinjava.litemall.db.dao.LitemallSystemMapper
;
import
org.linlinjava.litemall.db.domain.LitemallSystem
;
import
org.linlinjava.litemall.db.domain.LitemallSystemExample
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Service
public
class
LitemallSystemCfgService
{
@Resource
private
LitemallSystemMapper
systemMapper
;
public
void
add
(
LitemallSystem
litemallSystem
)
{
systemMapper
.
insert
(
litemallSystem
);
}
public
List
<
LitemallSystem
>
queryAll
()
{
LitemallSystemExample
example
=
new
LitemallSystemExample
();
example
.
or
();
return
systemMapper
.
selectByExample
(
example
);
}
public
LitemallSystem
queryByKeyName
(
String
keyName
,
String
groupName
)
{
LitemallSystemExample
example
=
new
LitemallSystemExample
();
example
.
or
().
andGroupEqualTo
(
groupName
).
andKeyEqualTo
(
keyName
);
return
systemMapper
.
selectOneByExample
(
example
);
}
public
List
<
LitemallSystem
>
queryByGroup
(
String
groupName
)
{
LitemallSystemExample
example
=
new
LitemallSystemExample
();
example
.
or
().
andGroupEqualTo
(
groupName
);
return
systemMapper
.
selectByExample
(
example
);
}
public
void
deleteById
(
Integer
id
)
{
systemMapper
.
deleteByPrimaryKey
(
id
);
}
}
litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallSystemMapper.xml
0 → 100644
View file @
ced7037f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"org.linlinjava.litemall.db.dao.LitemallSystemMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"org.linlinjava.litemall.db.domain.LitemallSystem"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"key"
jdbcType=
"VARCHAR"
property=
"key"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"base_value"
jdbcType=
"VARCHAR"
property=
"baseValue"
/>
<result
column=
"group"
jdbcType=
"VARCHAR"
property=
"group"
/>
<result
column=
"extra_value_1"
jdbcType=
"VARCHAR"
property=
"extraValue1"
/>
<result
column=
"extra_value_2"
jdbcType=
"VARCHAR"
property=
"extraValue2"
/>
<result
column=
"extra_value_3"
jdbcType=
"VARCHAR"
property=
"extraValue3"
/>
<result
column=
"extra_value_4"
jdbcType=
"VARCHAR"
property=
"extraValue4"
/>
<result
column=
"extra_value_5"
jdbcType=
"VARCHAR"
property=
"extraValue5"
/>
<result
column=
"extra_value_6"
jdbcType=
"VARCHAR"
property=
"extraValue6"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, `key`, `name`, base_value, `group`, extra_value_1, extra_value_2, extra_value_3,
extra_value_4, extra_value_5, extra_value_6
</sql>
<select
id=
"selectByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystemExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from litemall_system
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByExampleSelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<if
test=
"example.distinct"
>
distinct
</if>
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.value}
</foreach>
</when>
<otherwise>
id, `key`, `name`, base_value, `group`, extra_value_1, extra_value_2, extra_value_3,
extra_value_4, extra_value_5, extra_value_6
</otherwise>
</choose>
from litemall_system
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
<if
test=
"example.orderByClause != null"
>
order by ${example.orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include
refid=
"Base_Column_List"
/>
from litemall_system
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"selectByPrimaryKeySelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.value}
</foreach>
</when>
<otherwise>
id, `key`, `name`, base_value, `group`, extra_value_1, extra_value_2, extra_value_3,
extra_value_4, extra_value_5, extra_value_6
</otherwise>
</choose>
from litemall_system
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_system
where id = #{id,jdbcType=INTEGER}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystemExample"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from litemall_system
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystem"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_system (`key`, `name`, base_value,
`group`, extra_value_1, extra_value_2,
extra_value_3, extra_value_4, extra_value_5,
extra_value_6)
values (#{key,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{baseValue,jdbcType=VARCHAR},
#{group,jdbcType=VARCHAR}, #{extraValue1,jdbcType=VARCHAR}, #{extraValue2,jdbcType=VARCHAR},
#{extraValue3,jdbcType=VARCHAR}, #{extraValue4,jdbcType=VARCHAR}, #{extraValue5,jdbcType=VARCHAR},
#{extraValue6,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystem"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_system
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"key != null"
>
`key`,
</if>
<if
test=
"name != null"
>
`name`,
</if>
<if
test=
"baseValue != null"
>
base_value,
</if>
<if
test=
"group != null"
>
`group`,
</if>
<if
test=
"extraValue1 != null"
>
extra_value_1,
</if>
<if
test=
"extraValue2 != null"
>
extra_value_2,
</if>
<if
test=
"extraValue3 != null"
>
extra_value_3,
</if>
<if
test=
"extraValue4 != null"
>
extra_value_4,
</if>
<if
test=
"extraValue5 != null"
>
extra_value_5,
</if>
<if
test=
"extraValue6 != null"
>
extra_value_6,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"key != null"
>
#{key,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"baseValue != null"
>
#{baseValue,jdbcType=VARCHAR},
</if>
<if
test=
"group != null"
>
#{group,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue1 != null"
>
#{extraValue1,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue2 != null"
>
#{extraValue2,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue3 != null"
>
#{extraValue3,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue4 != null"
>
#{extraValue4,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue5 != null"
>
#{extraValue5,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue6 != null"
>
#{extraValue6,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystemExample"
resultType=
"java.lang.Long"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from litemall_system
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_system
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=INTEGER},
</if>
<if
test=
"record.key != null"
>
`key` = #{record.key,jdbcType=VARCHAR},
</if>
<if
test=
"record.name != null"
>
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.baseValue != null"
>
base_value = #{record.baseValue,jdbcType=VARCHAR},
</if>
<if
test=
"record.group != null"
>
`group` = #{record.group,jdbcType=VARCHAR},
</if>
<if
test=
"record.extraValue1 != null"
>
extra_value_1 = #{record.extraValue1,jdbcType=VARCHAR},
</if>
<if
test=
"record.extraValue2 != null"
>
extra_value_2 = #{record.extraValue2,jdbcType=VARCHAR},
</if>
<if
test=
"record.extraValue3 != null"
>
extra_value_3 = #{record.extraValue3,jdbcType=VARCHAR},
</if>
<if
test=
"record.extraValue4 != null"
>
extra_value_4 = #{record.extraValue4,jdbcType=VARCHAR},
</if>
<if
test=
"record.extraValue5 != null"
>
extra_value_5 = #{record.extraValue5,jdbcType=VARCHAR},
</if>
<if
test=
"record.extraValue6 != null"
>
extra_value_6 = #{record.extraValue6,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_system
set id = #{record.id,jdbcType=INTEGER},
`key` = #{record.key,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
base_value = #{record.baseValue,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
extra_value_1 = #{record.extraValue1,jdbcType=VARCHAR},
extra_value_2 = #{record.extraValue2,jdbcType=VARCHAR},
extra_value_3 = #{record.extraValue3,jdbcType=VARCHAR},
extra_value_4 = #{record.extraValue4,jdbcType=VARCHAR},
extra_value_5 = #{record.extraValue5,jdbcType=VARCHAR},
extra_value_6 = #{record.extraValue6,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystem"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_system
<set>
<if
test=
"key != null"
>
`key` = #{key,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
`name` = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"baseValue != null"
>
base_value = #{baseValue,jdbcType=VARCHAR},
</if>
<if
test=
"group != null"
>
`group` = #{group,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue1 != null"
>
extra_value_1 = #{extraValue1,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue2 != null"
>
extra_value_2 = #{extraValue2,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue3 != null"
>
extra_value_3 = #{extraValue3,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue4 != null"
>
extra_value_4 = #{extraValue4,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue5 != null"
>
extra_value_5 = #{extraValue5,jdbcType=VARCHAR},
</if>
<if
test=
"extraValue6 != null"
>
extra_value_6 = #{extraValue6,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystem"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update litemall_system
set `key` = #{key,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
base_value = #{baseValue,jdbcType=VARCHAR},
`group` = #{group,jdbcType=VARCHAR},
extra_value_1 = #{extraValue1,jdbcType=VARCHAR},
extra_value_2 = #{extraValue2,jdbcType=VARCHAR},
extra_value_3 = #{extraValue3,jdbcType=VARCHAR},
extra_value_4 = #{extraValue4,jdbcType=VARCHAR},
extra_value_5 = #{extraValue5,jdbcType=VARCHAR},
extra_value_6 = #{extraValue6,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"selectOneByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystemExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include
refid=
"Base_Column_List"
/>
from litemall_system
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
limit 1
</select>
<select
id=
"selectOneByExampleSelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.value}
</foreach>
</when>
<otherwise>
id, `key`, `name`, base_value, `group`, extra_value_1, extra_value_2, extra_value_3,
extra_value_4, extra_value_5, extra_value_6
</otherwise>
</choose>
from litemall_system
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
<if
test=
"example.orderByClause != null"
>
order by ${example.orderByClause}
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/SystemConfig.java
0 → 100644
View file @
ced7037f
package
org.linlinjava.litemall.wx.service
;
import
org.linlinjava.litemall.db.domain.LitemallSystem
;
import
org.linlinjava.litemall.db.service.LitemallSystemCfgService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
/**
* 系统通用设置服务类,注意用 getSystemConfig() 方法直接获取初始化的静态实例,重新读取配置调用 inist() 方法
*/
@Component
public
class
SystemConfig
{
public
final
static
int
LIMIT_NEW
=
10001
;
public
final
static
int
LIMIT_HOT
=
10002
;
public
final
static
int
LIMIT_BRAND
=
10003
;
public
final
static
int
LIMIT_TOPIC
=
10004
;
public
final
static
int
LIMIT_CALLIST
=
10005
;
public
final
static
int
LIMIT_CALGOOD
=
10006
;
public
final
static
int
BANNER_NEW
=
11001
;
public
final
static
int
BANNER_HOT
=
11002
;
public
final
static
int
BANNER_TITLE
=
11101
;
public
final
static
int
BANNER_IMAGE
=
11102
;
@Autowired
private
LitemallSystemCfgService
systemCfgService
;
private
List
<
LitemallSystem
>
systemConfigs
;
private
LitemallSystem
indexLimitCfg
;
private
LitemallSystem
newBannerCfg
;
private
LitemallSystem
hotBannerCfg
;
private
static
SystemConfig
systemConfig
;
public
static
SystemConfig
getSystemConfig
()
{
return
systemConfig
;
}
@PostConstruct
public
void
inist
()
{
systemConfig
=
this
;
systemConfig
.
systemConfigs
=
systemCfgService
.
queryAll
();
systemConfig
.
inistConfigs
();
}
public
String
getBannerInfo
(
final
int
banner
,
final
int
field
)
{
LitemallSystem
cfg
=
null
;
switch
(
banner
)
{
case
BANNER_NEW:
cfg
=
newBannerCfg
;
break
;
case
BANNER_HOT:
cfg
=
hotBannerCfg
;
break
;
}
if
(
cfg
!=
null
)
{
switch
(
field
)
{
case
BANNER_TITLE:
return
cfg
.
getBaseValue
();
case
BANNER_IMAGE:
return
cfg
.
getExtraValue1
();
}
}
return
null
;
}
public
Integer
getIndexLimit
(
final
int
arg
)
{
switch
(
arg
)
{
case
LIMIT_NEW:
return
Integer
.
parseInt
(
indexLimitCfg
.
getExtraValue1
());
case
LIMIT_HOT:
return
Integer
.
parseInt
(
indexLimitCfg
.
getExtraValue2
());
case
LIMIT_BRAND:
return
Integer
.
parseInt
(
indexLimitCfg
.
getExtraValue3
());
case
LIMIT_TOPIC:
return
Integer
.
parseInt
(
indexLimitCfg
.
getExtraValue4
());
case
LIMIT_CALLIST:
return
Integer
.
parseInt
(
indexLimitCfg
.
getExtraValue5
());
case
LIMIT_CALGOOD:
return
Integer
.
parseInt
(
indexLimitCfg
.
getExtraValue6
());
}
return
-
1
;
}
private
void
inistConfigs
()
{
for
(
LitemallSystem
cfg
:
systemConfigs
)
{
if
(
"index_banner"
.
equals
(
cfg
.
getGroup
())
&&
"new"
.
equals
(
cfg
.
getKey
()))
newBannerCfg
=
cfg
;
if
(
"index_banner"
.
equals
(
cfg
.
getGroup
())
&&
"hot"
.
equals
(
cfg
.
getKey
()))
hotBannerCfg
=
cfg
;
if
(
"index_limit"
.
equals
(
cfg
.
getGroup
()))
indexLimitCfg
=
cfg
;
}
}
}
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxGoodsController.java
View file @
ced7037f
...
...
@@ -7,6 +7,7 @@ import org.linlinjava.litemall.db.domain.*;
import
org.linlinjava.litemall.db.service.*
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.wx.annotation.LoginUser
;
import
org.linlinjava.litemall.wx.service.SystemConfig
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -47,40 +48,39 @@ public class WxGoodsController {
@Autowired
private
LitemallSearchHistoryService
searchHistoryService
;
@Autowired
private
LitemallCartService
cartService
;
@Autowired
private
LitemallGoodsSpecificationService
goodsSpecificationService
;
/**
* 商品详情
*
*
<p>
* 用户可以不登录。
* 如果用户登录,则记录用户足迹以及返回用户收藏信息。
*
* @param userId 用户ID
* @param id 商品ID
* @param id
商品ID
* @return 商品详情
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
info: xxx,
*
userHasCollect: xxx,
*
issue: xxx,
*
comment: xxx,
*
specificationList: xxx,
*
productList: xxx,
*
attribute: xxx,
*
brand: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* info: xxx,
* userHasCollect: xxx,
* issue: xxx,
* comment: xxx,
* specificationList: xxx,
* productList: xxx,
* attribute: xxx,
* brand: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"detail"
)
public
Object
detail
(
@LoginUser
Integer
userId
,
Integer
id
)
{
if
(
id
==
null
){
if
(
id
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
...
...
@@ -107,7 +107,7 @@ public class WxGoodsController {
List
<
LitemallComment
>
comments
=
commentService
.
queryGoodsByGid
(
id
,
0
,
2
);
List
<
Map
<
String
,
Object
>>
commentsVo
=
new
ArrayList
<>(
comments
.
size
());
int
commentCount
=
commentService
.
countGoodsByGid
(
id
,
0
,
2
);
for
(
LitemallComment
comment
:
comments
){
for
(
LitemallComment
comment
:
comments
)
{
Map
<
String
,
Object
>
c
=
new
HashMap
<>();
c
.
put
(
"id"
,
comment
.
getId
());
c
.
put
(
"addTime"
,
comment
.
getAddTime
());
...
...
@@ -124,12 +124,12 @@ public class WxGoodsController {
// 用户收藏
int
userHasCollect
=
0
;
if
(
userId
!=
null
)
{
if
(
userId
!=
null
)
{
userHasCollect
=
collectService
.
count
(
userId
,
id
);
}
// 记录用户的足迹
if
(
userId
!=
null
)
{
if
(
userId
!=
null
)
{
LitemallFootprint
footprint
=
new
LitemallFootprint
();
footprint
.
setAddTime
(
LocalDateTime
.
now
());
footprint
.
setUserId
(
userId
);
...
...
@@ -152,39 +152,38 @@ public class WxGoodsController {
/**
* 商品分类类目
*
*
<p>
* TODO 可能应该合并到WxCatalogController中
*
* @param id 分类类目ID
* @return 商品分类类目
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
currentCategory: xxx,
*
parentCategory: xxx,
*
brotherCategory: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* currentCategory: xxx,
* parentCategory: xxx,
* brotherCategory: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"category"
)
public
Object
category
(
Integer
id
)
{
if
(
id
==
null
){
if
(
id
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
LitemallCategory
cur
=
categoryService
.
findById
(
id
);
LitemallCategory
parent
=
null
;
List
<
LitemallCategory
>
children
=
null
;
if
(
cur
.
getPid
()
==
0
){
if
(
cur
.
getPid
()
==
0
)
{
parent
=
cur
;
children
=
categoryService
.
queryByPid
(
cur
.
getId
());
cur
=
children
.
get
(
0
);
}
else
{
}
else
{
parent
=
categoryService
.
findById
(
cur
.
getPid
());
children
=
categoryService
.
queryByPid
(
cur
.
getPid
());
}
...
...
@@ -197,33 +196,33 @@ public class WxGoodsController {
/**
* 根据条件搜素商品
*
*
<p>
* 1. 这里的前五个参数都是可选的,甚至都是空
* 2. 用户是可选登录,如果登录,则记录用户的搜索关键字
*
* @param categoryId 分类类目ID
* @param brandId 品牌商ID
* @param keyword 关键字
* @param isNew 是否新品
* @param isHot 是否热买
* @param userId 用户ID
* @param page 分页页数
* @param size 分页大小
* @param sort 排序方式
* @param order 排序类型,顺序或者降序
* @param brandId
品牌商ID
* @param keyword
关键字
* @param isNew
是否新品
* @param isHot
是否热买
* @param userId
用户ID
* @param page
分页页数
* @param size
分页大小
* @param sort
排序方式
* @param order
排序类型,顺序或者降序
* @return 根据条件搜素的商品详情
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
goodsList: xxx,
*
filterCategoryList: xxx,
*
count: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* goodsList: xxx,
* filterCategoryList: xxx,
* count: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"list"
)
public
Object
list
(
Integer
categoryId
,
Integer
brandId
,
String
keyword
,
Boolean
isNew
,
Boolean
isHot
,
...
...
@@ -249,7 +248,7 @@ public class WxGoodsController {
// 查询商品所属类目列表。
List
<
Integer
>
goodsCatIds
=
goodsService
.
getCatIds
(
brandId
,
keyword
,
isHot
,
isNew
);
List
<
LitemallCategory
>
categoryList
=
null
;
if
(
goodsCatIds
.
size
()
!=
0
)
{
if
(
goodsCatIds
.
size
()
!=
0
)
{
categoryList
=
categoryService
.
queryL2ByIds
(
goodsCatIds
);
}
...
...
@@ -262,27 +261,27 @@ public class WxGoodsController {
/**
* 新品首发页面的横幅数据
*
*
<p>
* TODO 其实可以删除
*
* @return 新品首发页面的栏目数据
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
bannerInfo: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* bannerInfo: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"new"
)
public
Object
newGoods
()
{
Map
<
String
,
String
>
bannerInfo
=
new
HashMap
<>();
bannerInfo
.
put
(
"url"
,
""
);
bannerInfo
.
put
(
"name"
,
"坚持初心,为你寻觅世间好物"
);
bannerInfo
.
put
(
"imgUrl"
,
"http://yanxuan.nosdn.127.net/8976116db321744084774643a933c5ce.png"
);
bannerInfo
.
put
(
"name"
,
SystemConfig
.
getSystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_NEW
,
SystemConfig
.
BANNER_TITLE
)
);
bannerInfo
.
put
(
"imgUrl"
,
SystemConfig
.
getSystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_NEW
,
SystemConfig
.
BANNER_IMAGE
)
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"bannerInfo"
,
bannerInfo
);
...
...
@@ -291,27 +290,27 @@ public class WxGoodsController {
/**
* 人气推荐页面的横幅数据
*
*
<p>
* TODO 其实可以删除
*
* @return 人气推荐页面的栏目数据
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
bannerInfo: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* bannerInfo: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"hot"
)
public
Object
hotGoods
()
{
Map
<
String
,
String
>
bannerInfo
=
new
HashMap
<>();
bannerInfo
.
put
(
"url"
,
""
);
bannerInfo
.
put
(
"name"
,
"大家都在买的严选好物"
);
bannerInfo
.
put
(
"imgUrl"
,
"http://yanxuan.nosdn.127.net/8976116db321744084774643a933c5ce.png"
);
bannerInfo
.
put
(
"name"
,
SystemConfig
.
getSystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_HOT
,
SystemConfig
.
BANNER_TITLE
)
);
bannerInfo
.
put
(
"imgUrl"
,
SystemConfig
.
getSystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_HOT
,
SystemConfig
.
BANNER_IMAGE
)
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"bannerInfo"
,
bannerInfo
);
return
ResponseUtil
.
ok
(
data
);
...
...
@@ -321,25 +320,25 @@ public class WxGoodsController {
* 商品页面推荐商品
*
* @return 商品页面推荐商品
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
goodsList: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* goodsList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"related"
)
public
Object
related
(
Integer
id
)
{
if
(
id
==
null
){
if
(
id
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
LitemallGoods
goods
=
goodsService
.
findById
(
id
);
if
(
goods
==
null
){
if
(
goods
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
...
...
@@ -358,16 +357,16 @@ public class WxGoodsController {
* 在售的商品总数
*
* @return 在售的商品总数
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
goodsCount: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* goodsCount: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"count"
)
public
Object
count
()
{
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxHomeController.java
View file @
ced7037f
...
...
@@ -5,6 +5,7 @@ import org.apache.commons.logging.LogFactory;
import
org.linlinjava.litemall.db.domain.*
;
import
org.linlinjava.litemall.db.service.*
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.wx.service.SystemConfig
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -30,28 +31,26 @@ public class WxHomeController {
private
LitemallTopicService
topicService
;
@Autowired
private
LitemallCategoryService
categoryService
;
@Autowired
private
LitemallCartService
cartService
;
/**
* app首页
*
* @return app首页相关信息
*
成功则
*
{
*
errno: 0,
*
errmsg: '成功',
*
data:
*
{
*
banner: xxx,
*
channel: xxx,
*
newGoodsList: xxx,
*
hotGoodsList: xxx,
*
topicList: xxx,
*
floorGoodsList: xxx
*
}
*
}
*
失败则 { errno: XXX, errmsg: XXX }
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* banner: xxx,
* channel: xxx,
* newGoodsList: xxx,
* hotGoodsList: xxx,
* topicList: xxx,
* floorGoodsList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping
(
"/index"
)
public
Object
index
()
{
...
...
@@ -63,20 +62,20 @@ public class WxHomeController {
List
<
LitemallCategory
>
channel
=
categoryService
.
queryChannel
();
data
.
put
(
"channel"
,
channel
);
List
<
LitemallGoods
>
newGoods
=
goodsService
.
queryByNew
(
0
,
4
);
List
<
LitemallGoods
>
newGoods
=
goodsService
.
queryByNew
(
0
,
SystemConfig
.
getSystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_NEW
)
);
data
.
put
(
"newGoodsList"
,
newGoods
);
List
<
LitemallGoods
>
hotGoods
=
goodsService
.
queryByHot
(
0
,
3
);
List
<
LitemallGoods
>
hotGoods
=
goodsService
.
queryByHot
(
0
,
SystemConfig
.
getSystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_HOT
)
);
data
.
put
(
"hotGoodsList"
,
hotGoods
);
List
<
LitemallBrand
>
brandList
=
brandService
.
query
(
0
,
4
);
List
<
LitemallBrand
>
brandList
=
brandService
.
query
(
0
,
SystemConfig
.
getSystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_BRAND
)
);
data
.
put
(
"brandList"
,
brandList
);
List
<
LitemallTopic
>
topicList
=
topicService
.
queryList
(
0
,
3
);
List
<
LitemallTopic
>
topicList
=
topicService
.
queryList
(
0
,
SystemConfig
.
getSystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_TOPIC
)
);
data
.
put
(
"topicList"
,
topicList
);
List
<
Map
>
categoryList
=
new
ArrayList
<>();
List
<
LitemallCategory
>
catL1List
=
categoryService
.
queryL1WithoutRecommend
(
0
,
6
);
List
<
LitemallCategory
>
catL1List
=
categoryService
.
queryL1WithoutRecommend
(
0
,
SystemConfig
.
getSystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_CALLIST
)
);
for
(
LitemallCategory
catL1
:
catL1List
)
{
List
<
LitemallCategory
>
catL2List
=
categoryService
.
queryByPid
(
catL1
.
getId
());
List
<
Integer
>
l2List
=
new
ArrayList
<>();
...
...
@@ -85,11 +84,10 @@ public class WxHomeController {
}
List
<
LitemallGoods
>
categoryGoods
=
null
;
if
(
l2List
.
size
()
==
0
){
if
(
l2List
.
size
()
==
0
)
{
categoryGoods
=
new
ArrayList
<>();
}
else
{
categoryGoods
=
goodsService
.
queryByCategory
(
l2List
,
0
,
5
);
}
else
{
categoryGoods
=
goodsService
.
queryByCategory
(
l2List
,
0
,
SystemConfig
.
getSystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_CALGOOD
));
}
Map
catGoods
=
new
HashMap
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment