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
83f86785
Commit
83f86785
authored
Jul 22, 2018
by
Menethil
Browse files
更改系统配置方式
parent
ced7037f
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallSystem.java
View file @
83f86785
...
...
@@ -16,92 +16,20 @@ public class LitemallSystem {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.key
* This field corresponds to the database column litemall_system.key
_name
*
* @mbg.generated
*/
private
String
key
;
private
String
key
Name
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_system.
nam
e
* This field corresponds to the database column litemall_system.
key_valu
e
*
* @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
;
private
String
keyValue
;
/**
* This method was generated by MyBatis Generator.
...
...
@@ -129,242 +57,50 @@ public class LitemallSystem {
/**
* 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
* This method returns the value of the database column litemall_system.key_name
*
* @return the value of litemall_system.
extra_value_5
* @return the value of litemall_system.
key_name
*
* @mbg.generated
*/
public
String
get
ExtraValue5
()
{
return
extraValue5
;
public
String
get
KeyName
()
{
return
keyName
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.
extra_value_5
* This method sets the value of the database column litemall_system.
key_name
*
* @param
extraValue5
the value for litemall_system.
extra_value_5
* @param
keyName
the value for litemall_system.
key_name
*
* @mbg.generated
*/
public
void
set
ExtraValue5
(
String
extraValue5
)
{
this
.
extraValue5
=
extraValue5
;
public
void
set
KeyName
(
String
keyName
)
{
this
.
keyName
=
keyName
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_system.
extra
_value
_6
* This method returns the value of the database column litemall_system.
key
_value
*
* @return the value of litemall_system.
extra
_value
_6
* @return the value of litemall_system.
key
_value
*
* @mbg.generated
*/
public
String
get
Extra
Value
6
()
{
return
extra
Value
6
;
public
String
get
Key
Value
()
{
return
key
Value
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_system.
extra
_value
_6
* This method sets the value of the database column litemall_system.
key
_value
*
* @param
extra
Value
6
the value for litemall_system.
extra
_value
_6
* @param
key
Value the value for litemall_system.
key
_value
*
* @mbg.generated
*/
public
void
set
Extra
Value
6
(
String
extra
Value
6
)
{
this
.
extra
Value
6
=
extra
Value
6
;
public
void
set
Key
Value
(
String
key
Value
)
{
this
.
key
Value
=
key
Value
;
}
/**
...
...
@@ -380,16 +116,8 @@ public class LitemallSystem {
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
(
", keyName="
).
append
(
keyName
);
sb
.
append
(
", keyValue="
).
append
(
keyValue
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
...
...
@@ -413,16 +141,8 @@ public class LitemallSystem {
}
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
.
getKeyName
()
==
null
?
other
.
getKeyName
()
==
null
:
this
.
getKeyName
().
equals
(
other
.
getKeyName
()))
&&
(
this
.
getKeyValue
()
==
null
?
other
.
getKeyValue
()
==
null
:
this
.
getKeyValue
().
equals
(
other
.
getKeyValue
()));
}
/**
...
...
@@ -436,16 +156,8 @@ public class LitemallSystem {
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
());
result
=
prime
*
result
+
((
getKeyName
()
==
null
)
?
0
:
getKeyName
().
hashCode
());
result
=
prime
*
result
+
((
getKeyValue
()
==
null
)
?
0
:
getKeyValue
().
hashCode
());
return
result
;
}
...
...
@@ -458,16 +170,8 @@ public class LitemallSystem {
*/
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"
);
keyName
(
"key_name"
,
"keyName"
,
"VARCHAR"
),
keyValue
(
"key_value"
,
"keyValue"
,
"VARCHAR"
);
/**
* This field was generated by MyBatis Generator.
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallSystemExample.java
View file @
83f86785
This diff is collapsed.
Click to expand it.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallSystemC
f
gService.java
→
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallSystemC
onfi
gService.java
View file @
83f86785
...
...
@@ -9,7 +9,7 @@ import javax.annotation.Resource;
import
java.util.List
;
@Service
public
class
LitemallSystemC
f
gService
{
public
class
LitemallSystemC
onfi
gService
{
@Resource
private
LitemallSystemMapper
systemMapper
;
...
...
@@ -25,16 +25,10 @@ public class LitemallSystemCfgService {
public
LitemallSystem
queryByKeyName
(
String
keyName
,
String
groupName
)
{
LitemallSystemExample
example
=
new
LitemallSystemExample
();
example
.
or
().
and
GroupEqualTo
(
groupName
).
andKey
EqualTo
(
keyName
);
example
.
or
().
and
KeyName
EqualTo
(
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
View file @
83f86785
...
...
@@ -7,16 +7,8 @@
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"
/>
<result
column=
"key_name"
jdbcType=
"VARCHAR"
property=
"keyName"
/>
<result
column=
"key_value"
jdbcType=
"VARCHAR"
property=
"keyValue"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<!--
...
...
@@ -89,8 +81,7 @@
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
id, key_name, key_value
</sql>
<select
id=
"selectByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystemExample"
resultMap=
"BaseResultMap"
>
<!--
...
...
@@ -121,14 +112,13 @@
distinct
</if>
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<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
id, key_name, key_value
</otherwise>
</choose>
from litemall_system
...
...
@@ -157,14 +147,13 @@
-->
select
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<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
id, key_name, key_value
</otherwise>
</choose>
from litemall_system
...
...
@@ -196,14 +185,8 @@
<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 into litemall_system (key_name, key_value)
values (#{keyName,jdbcType=VARCHAR}, #{keyValue,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystem"
>
<!--
...
...
@@ -215,67 +198,19 @@
</selectKey>
insert into litemall_system
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"key != null"
>
`
key
`
,
<if
test=
"key
Name
!= null"
>
key
_name
,
</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
test=
"keyValue != null"
>
key_value,
</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
test=
"keyName != null"
>
#{keyName,jdbcType=VARCHAR},
</if>
<if
test=
"
extra
Value
6
!= null"
>
#{
extra
Value
6
,jdbcType=VARCHAR},
<if
test=
"
key
Value != null"
>
#{
key
Value,jdbcType=VARCHAR},
</if>
</trim>
</insert>
...
...
@@ -299,35 +234,11 @@
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=INTEGER},
</if>
<if
test=
"record.key != null"
>
`
key
`
= #{record.key,jdbcType=VARCHAR},
<if
test=
"record.key
Name
!= null"
>
key
_name
= #{record.key
Name
,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
test=
"record.keyValue != null"
>
key_value = #{record.keyValue,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
...
...
@@ -341,16 +252,8 @@
-->
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}
key_name = #{record.keyName,jdbcType=VARCHAR},
key_value = #{record.keyValue,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -362,35 +265,11 @@
-->
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
test=
"keyName != null"
>
key_name = #{keyName,jdbcType=VARCHAR},
</if>
<if
test=
"
extra
Value
6
!= null"
>
extra
_value
_6
= #{
extra
Value
6
,jdbcType=VARCHAR},
<if
test=
"
key
Value != null"
>
key
_value = #{
key
Value,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
...
...
@@ -401,16 +280,8 @@
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}
set key_name = #{keyName,jdbcType=VARCHAR},
key_value = #{keyValue,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"selectOneByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallSystemExample"
resultMap=
"BaseResultMap"
>
...
...
@@ -438,14 +309,13 @@
-->
select
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<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
id, key_name, key_value
</otherwise>
</choose>
from litemall_system
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/ConfigService.java
0 → 100644
View file @
83f86785
package
org.linlinjava.litemall.wx.service
;
import
org.linlinjava.litemall.db.domain.LitemallSystem
;
import
org.linlinjava.litemall.db.service.LitemallSystemConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
ConfigService
{
private
static
ConfigService
systemConfigService
;
//系统配置组
private
Map
<
String
,
String
>
systemConfig
;
@Autowired
private
LitemallSystemConfigService
litemallSystemConfigService
;
//不允许实例化
private
ConfigService
()
{
}
/**
* 获取系统配置
*
* @param keyName 例如 : litemall.system.freight.value
* @return 返回该值的字符串
*/
public
String
getSysValue
(
String
keyName
)
{
keyName
=
"litemall.system."
+
keyName
;
return
systemConfig
.
get
(
keyName
);
}
/**
* 获取系统配置数值型
*
* @param keyName 例如 : litemall.system.freight.value
* @return 返回该值的字符串
*/
public
Integer
getSysValueInt
(
String
keyName
)
{
keyName
=
"litemall.system."
+
keyName
;
return
Integer
.
parseInt
(
systemConfig
.
get
(
keyName
));
}
/**
* 获取系统设置实例
*
* @return
*/
public
static
ConfigService
getCfg
()
{
return
systemConfigService
;
}
@PostConstruct
public
void
inist
()
{
systemConfigService
=
this
;
systemConfigService
.
systemConfig
=
new
HashMap
<>();
systemConfigService
.
inistConfigs
();
}
/**
* 读取全部配置
*/
private
void
inistConfigs
()
{
List
<
LitemallSystem
>
list
=
litemallSystemConfigService
.
queryAll
();
for
(
LitemallSystem
item
:
list
)
{
//属于系统配置,放置到系统配置组
if
(
item
.
getKeyName
().
startsWith
(
"litemall.system"
))
systemConfig
.
put
(
item
.
getKeyName
(),
item
.
getKeyValue
());
}
}
}
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/SystemConfig.java
View file @
83f86785
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
;
import
java.math.BigDecimal
;
/**
* 系统
通用设置服务类,注意用 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
;
public
class
SystemConfig
{
public
static
Integer
getNewLimit
()
{
return
ConfigService
.
getCfg
().
getSysValueInt
(
"indexlimit.new"
);
}
@PostConstruct
public
void
inist
()
{
systemConfig
=
this
;
systemConfig
.
systemConfigs
=
systemCfgService
.
queryAll
();
systemConfig
.
inistConfigs
();
public
static
Integer
getHotLimit
()
{
return
ConfigService
.
getCfg
().
getSysValueInt
(
"indexlimit.hot"
);
}
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
;
}
public
static
Integer
getBrandLimit
()
{
return
ConfigService
.
getCfg
().
getSysValueInt
(
"indexlimit.brand"
);
}
if
(
cfg
!=
null
)
{
switch
(
field
)
{
case
BANNER_TITLE:
return
cfg
.
getBaseValue
();
case
BANNER_IMAGE:
return
cfg
.
getExtraValue1
();
}
}
public
static
Integer
getTopicLimit
()
{
return
ConfigService
.
getCfg
().
getSysValueInt
(
"indexlimit.topic"
);
}
return
null
;
public
static
Integer
getCatlogListLimit
()
{
return
ConfigService
.
getCfg
().
getSysValueInt
(
"indexlimit.catloglist"
);
}
public
static
Integer
getCatlogMoreLimit
()
{
return
ConfigService
.
getCfg
().
getSysValueInt
(
"indexlimit.catloggood"
);
}
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
());
}
public
static
String
getHotBannerTitle
()
{
return
ConfigService
.
getCfg
().
getSysValue
(
"banner.hot.title"
);
}
return
-
1
;
public
static
String
getNewBannerTitle
()
{
return
ConfigService
.
getCfg
().
getSysValue
(
"banner.new.title"
);
}
public
static
String
getHotImageUrl
()
{
return
ConfigService
.
getCfg
().
getSysValue
(
"banner.hot.imageurl"
);
}
private
void
inistConfigs
()
{
for
(
LitemallSystem
cfg
:
systemConfigs
)
{
if
(
"index_banner"
.
equals
(
cfg
.
getGroup
())
&&
"new"
.
equals
(
cfg
.
getKey
()))
newBannerCfg
=
cfg
;
public
static
String
getNewImageUrl
()
{
return
ConfigService
.
getCfg
().
getSysValue
(
"banner.new.imageurl"
);
}
if
(
"index_banner"
.
equals
(
cfg
.
getGroup
())
&&
"hot"
.
equals
(
cfg
.
getKey
()))
hotBannerCfg
=
cfg
;
public
static
BigDecimal
getFreight
()
{
return
new
BigDecimal
(
ConfigService
.
getCfg
().
getSysValue
(
"freight.value"
));
}
if
(
"index_limit"
.
equals
(
cfg
.
getGroup
()))
indexLimitCfg
=
cfg
;
}
public
static
BigDecimal
getFreightLimit
()
{
return
new
BigDecimal
(
ConfigService
.
getCfg
().
getSysValue
(
"freight.limit"
));
}
}
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxGoodsController.java
View file @
83f86785
...
...
@@ -3,9 +3,9 @@ package org.linlinjava.litemall.wx.web;
import
com.mysql.jdbc.StringUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
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
;
...
...
@@ -280,8 +280,8 @@ public class WxGoodsController {
public
Object
newGoods
()
{
Map
<
String
,
String
>
bannerInfo
=
new
HashMap
<>();
bannerInfo
.
put
(
"url"
,
""
);
bannerInfo
.
put
(
"name"
,
SystemConfig
.
get
SystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_NEW
,
SystemConfig
.
BANNER_TITLE
));
bannerInfo
.
put
(
"imgUrl"
,
SystemConfig
.
get
SystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_NEW
,
SystemConfig
.
BANNER_IMAGE
));
bannerInfo
.
put
(
"name"
,
SystemConfig
.
get
NewBannerTitle
(
));
bannerInfo
.
put
(
"imgUrl"
,
SystemConfig
.
get
NewImageUrl
(
));
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"bannerInfo"
,
bannerInfo
);
...
...
@@ -309,8 +309,8 @@ public class WxGoodsController {
public
Object
hotGoods
()
{
Map
<
String
,
String
>
bannerInfo
=
new
HashMap
<>();
bannerInfo
.
put
(
"url"
,
""
);
bannerInfo
.
put
(
"name"
,
SystemConfig
.
get
SystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_HOT
,
SystemConfig
.
BANNER_TITLE
));
bannerInfo
.
put
(
"imgUrl"
,
SystemConfig
.
get
SystemConfig
().
getBannerInfo
(
SystemConfig
.
BANNER_HOT
,
SystemConfig
.
BANNER_IMAGE
));
bannerInfo
.
put
(
"name"
,
SystemConfig
.
get
HotBannerTitle
(
));
bannerInfo
.
put
(
"imgUrl"
,
SystemConfig
.
get
HotImageUrl
(
));
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"bannerInfo"
,
bannerInfo
);
return
ResponseUtil
.
ok
(
data
);
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxHomeController.java
View file @
83f86785
...
...
@@ -2,9 +2,9 @@ package org.linlinjava.litemall.wx.web;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
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
;
...
...
@@ -62,20 +62,20 @@ public class WxHomeController {
List
<
LitemallCategory
>
channel
=
categoryService
.
queryChannel
();
data
.
put
(
"channel"
,
channel
);
List
<
LitemallGoods
>
newGoods
=
goodsService
.
queryByNew
(
0
,
SystemConfig
.
get
SystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_NEW
));
List
<
LitemallGoods
>
newGoods
=
goodsService
.
queryByNew
(
0
,
SystemConfig
.
get
NewLimit
(
));
data
.
put
(
"newGoodsList"
,
newGoods
);
List
<
LitemallGoods
>
hotGoods
=
goodsService
.
queryByHot
(
0
,
SystemConfig
.
get
SystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_HOT
));
List
<
LitemallGoods
>
hotGoods
=
goodsService
.
queryByHot
(
0
,
SystemConfig
.
get
HotLimit
(
));
data
.
put
(
"hotGoodsList"
,
hotGoods
);
List
<
LitemallBrand
>
brandList
=
brandService
.
query
(
0
,
SystemConfig
.
get
SystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_BRAND
));
List
<
LitemallBrand
>
brandList
=
brandService
.
query
(
0
,
SystemConfig
.
get
BrandLimit
(
));
data
.
put
(
"brandList"
,
brandList
);
List
<
LitemallTopic
>
topicList
=
topicService
.
queryList
(
0
,
SystemConfig
.
get
SystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_TOPIC
));
List
<
LitemallTopic
>
topicList
=
topicService
.
queryList
(
0
,
SystemConfig
.
get
TopicLimit
(
));
data
.
put
(
"topicList"
,
topicList
);
List
<
Map
>
categoryList
=
new
ArrayList
<>();
List
<
LitemallCategory
>
catL1List
=
categoryService
.
queryL1WithoutRecommend
(
0
,
SystemConfig
.
get
SystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_CALLIST
));
List
<
LitemallCategory
>
catL1List
=
categoryService
.
queryL1WithoutRecommend
(
0
,
SystemConfig
.
get
CatlogListLimit
(
));
for
(
LitemallCategory
catL1
:
catL1List
)
{
List
<
LitemallCategory
>
catL2List
=
categoryService
.
queryByPid
(
catL1
.
getId
());
List
<
Integer
>
l2List
=
new
ArrayList
<>();
...
...
@@ -87,7 +87,7 @@ public class WxHomeController {
if
(
l2List
.
size
()
==
0
)
{
categoryGoods
=
new
ArrayList
<>();
}
else
{
categoryGoods
=
goodsService
.
queryByCategory
(
l2List
,
0
,
SystemConfig
.
get
SystemConfig
().
getIndexLimit
(
SystemConfig
.
LIMIT_CALGOOD
));
categoryGoods
=
goodsService
.
queryByCategory
(
l2List
,
0
,
SystemConfig
.
get
CatlogMoreLimit
(
));
}
Map
catGoods
=
new
HashMap
();
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java
View file @
83f86785
...
...
@@ -18,6 +18,7 @@ import org.linlinjava.litemall.db.service.*;
import
org.linlinjava.litemall.db.util.OrderHandleOption
;
import
org.linlinjava.litemall.db.util.OrderUtil
;
import
org.linlinjava.litemall.wx.annotation.LoginUser
;
import
org.linlinjava.litemall.wx.service.SystemConfig
;
import
org.linlinjava.litemall.wx.util.IpUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.PlatformTransactionManager
;
...
...
@@ -292,8 +293,8 @@ public class WxOrderController {
// 根据订单商品总价计算运费,满88则免运费,否则8元;
BigDecimal
freightPrice
=
new
BigDecimal
(
0.00
);
if
(
checkedGoodsPrice
.
compareTo
(
new
BigDecimal
(
88.00
))
<
0
)
{
freightPrice
=
new
BigDecimal
(
8.00
);
if
(
checkedGoodsPrice
.
compareTo
(
SystemConfig
.
getFreightLimit
(
))
<
0
)
{
freightPrice
=
SystemConfig
.
getFreight
(
);
}
// 可以使用的其他钱,例如用户积分
...
...
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