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
a5c2aff4
Commit
a5c2aff4
authored
Nov 16, 2018
by
Junling Bu
Browse files
chore[后端服务]: 后端服务代码基于IDEA的reformat code工具格式化代码,但是mybatis generator生成的代码除外。
parent
556f269d
Changes
132
Hide whitespace changes
Inline
Side-by-side
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallBrandService.java
View file @
a5c2aff4
package
org.linlinjava.litemall.db.service
;
import
com.github.pagehelper.PageHelper
;
import
org.linlinjava.litemall.db.domain.LitemallBrandExample
;
import
org.linlinjava.litemall.db.dao.LitemallBrandMapper
;
import
org.linlinjava.litemall.db.domain.LitemallBrand.Column
;
import
org.linlinjava.litemall.db.domain.LitemallBrand
;
import
org.linlinjava.litemall.db.domain.LitemallBrand.Column
;
import
org.linlinjava.litemall.db.domain.LitemallBrandExample
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCartService.java
View file @
a5c2aff4
...
...
@@ -77,10 +77,10 @@ public class LitemallCartService {
LitemallCartExample
example
=
new
LitemallCartExample
();
LitemallCartExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
userId
);
}
if
(!
StringUtils
.
isEmpty
(
goodsId
)){
if
(!
StringUtils
.
isEmpty
(
goodsId
))
{
criteria
.
andGoodsIdEqualTo
(
goodsId
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -97,15 +97,15 @@ public class LitemallCartService {
LitemallCartExample
example
=
new
LitemallCartExample
();
LitemallCartExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
userId
!=
null
){
if
(
userId
!=
null
)
{
criteria
.
andUserIdEqualTo
(
userId
);
}
if
(
goodsId
!=
null
){
if
(
goodsId
!=
null
)
{
criteria
.
andGoodsIdEqualTo
(
goodsId
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
cartMapper
.
countByExample
(
example
);
return
(
int
)
cartMapper
.
countByExample
(
example
);
}
public
void
deleteById
(
Integer
id
)
{
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCategoryService.java
View file @
a5c2aff4
...
...
@@ -15,6 +15,7 @@ import java.util.List;
public
class
LitemallCategoryService
{
@Resource
private
LitemallCategoryMapper
categoryMapper
;
private
LitemallCategory
.
Column
[]
CHANNEL
=
{
LitemallCategory
.
Column
.
id
,
LitemallCategory
.
Column
.
name
,
LitemallCategory
.
Column
.
iconUrl
};
public
List
<
LitemallCategory
>
queryL1WithoutRecommend
(
int
offset
,
int
limit
)
{
LitemallCategoryExample
example
=
new
LitemallCategoryExample
();
...
...
@@ -56,10 +57,10 @@ public class LitemallCategoryService {
LitemallCategoryExample
example
=
new
LitemallCategoryExample
();
LitemallCategoryExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
id
)){
if
(!
StringUtils
.
isEmpty
(
id
))
{
criteria
.
andIdEqualTo
(
Integer
.
valueOf
(
id
));
}
if
(!
StringUtils
.
isEmpty
(
name
)){
if
(!
StringUtils
.
isEmpty
(
name
))
{
criteria
.
andNameLike
(
"%"
+
name
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -76,15 +77,15 @@ public class LitemallCategoryService {
LitemallCategoryExample
example
=
new
LitemallCategoryExample
();
LitemallCategoryExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
id
)){
if
(!
StringUtils
.
isEmpty
(
id
))
{
criteria
.
andIdEqualTo
(
Integer
.
valueOf
(
id
));
}
if
(!
StringUtils
.
isEmpty
(
name
)){
if
(!
StringUtils
.
isEmpty
(
name
))
{
criteria
.
andNameLike
(
"%"
+
name
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
categoryMapper
.
countByExample
(
example
);
return
(
int
)
categoryMapper
.
countByExample
(
example
);
}
public
int
updateById
(
LitemallCategory
category
)
{
...
...
@@ -102,7 +103,6 @@ public class LitemallCategoryService {
categoryMapper
.
insertSelective
(
category
);
}
private
LitemallCategory
.
Column
[]
CHANNEL
=
{
LitemallCategory
.
Column
.
id
,
LitemallCategory
.
Column
.
name
,
LitemallCategory
.
Column
.
iconUrl
};
public
List
<
LitemallCategory
>
queryChannel
()
{
LitemallCategoryExample
example
=
new
LitemallCategoryExample
();
example
.
or
().
andLevelEqualTo
(
"L1"
).
andDeletedEqualTo
(
false
);
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCollectService.java
View file @
a5c2aff4
package
org.linlinjava.litemall.db.service
;
import
com.github.pagehelper.PageHelper
;
import
org.linlinjava.litemall.db.domain.LitemallCollect
;
import
org.linlinjava.litemall.db.dao.LitemallCollectMapper
;
import
org.linlinjava.litemall.db.domain.LitemallCollect
;
import
org.linlinjava.litemall.db.domain.LitemallCollectExample
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
...
...
@@ -19,7 +19,7 @@ public class LitemallCollectService {
public
int
count
(
int
uid
,
Integer
gid
)
{
LitemallCollectExample
example
=
new
LitemallCollectExample
();
example
.
or
().
andUserIdEqualTo
(
uid
).
andValueIdEqualTo
(
gid
).
andDeletedEqualTo
(
false
);
return
(
int
)
collectMapper
.
countByExample
(
example
);
return
(
int
)
collectMapper
.
countByExample
(
example
);
}
public
List
<
LitemallCollect
>
queryByType
(
Integer
userId
,
Byte
type
,
Integer
page
,
Integer
size
)
{
...
...
@@ -33,7 +33,7 @@ public class LitemallCollectService {
public
int
countByType
(
Integer
userId
,
Byte
type
)
{
LitemallCollectExample
example
=
new
LitemallCollectExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andTypeEqualTo
(
type
).
andDeletedEqualTo
(
false
);
return
(
int
)
collectMapper
.
countByExample
(
example
);
return
(
int
)
collectMapper
.
countByExample
(
example
);
}
public
LitemallCollect
queryByTypeAndValue
(
Integer
userId
,
Byte
type
,
Integer
valueId
)
{
...
...
@@ -56,10 +56,10 @@ public class LitemallCollectService {
LitemallCollectExample
example
=
new
LitemallCollectExample
();
LitemallCollectExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
valueId
)){
if
(!
StringUtils
.
isEmpty
(
valueId
))
{
criteria
.
andValueIdEqualTo
(
Integer
.
valueOf
(
valueId
));
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -76,14 +76,14 @@ public class LitemallCollectService {
LitemallCollectExample
example
=
new
LitemallCollectExample
();
LitemallCollectExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
valueId
)){
if
(!
StringUtils
.
isEmpty
(
valueId
))
{
criteria
.
andValueIdEqualTo
(
Integer
.
valueOf
(
valueId
));
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
collectMapper
.
countByExample
(
example
);
return
(
int
)
collectMapper
.
countByExample
(
example
);
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCommentService.java
View file @
a5c2aff4
...
...
@@ -5,7 +5,6 @@ import org.linlinjava.litemall.db.dao.LitemallCommentMapper;
import
org.linlinjava.litemall.db.domain.LitemallComment
;
import
org.linlinjava.litemall.db.domain.LitemallCommentExample
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
...
...
@@ -20,45 +19,41 @@ public class LitemallCommentService {
public
List
<
LitemallComment
>
queryGoodsByGid
(
Integer
id
,
int
offset
,
int
limit
)
{
LitemallCommentExample
example
=
new
LitemallCommentExample
();
example
.
setOrderByClause
(
LitemallComment
.
Column
.
addTime
.
desc
());
example
.
or
().
andValueIdEqualTo
(
id
).
andTypeEqualTo
((
byte
)
0
).
andDeletedEqualTo
(
false
);
example
.
or
().
andValueIdEqualTo
(
id
).
andTypeEqualTo
((
byte
)
0
).
andDeletedEqualTo
(
false
);
PageHelper
.
startPage
(
offset
,
limit
);
return
commentMapper
.
selectByExample
(
example
);
}
public
int
countGoodsByGid
(
Integer
id
,
int
offset
,
int
limit
)
{
LitemallCommentExample
example
=
new
LitemallCommentExample
();
example
.
or
().
andValueIdEqualTo
(
id
).
andTypeEqualTo
((
byte
)
0
).
andDeletedEqualTo
(
false
);
return
(
int
)
commentMapper
.
countByExample
(
example
);
example
.
or
().
andValueIdEqualTo
(
id
).
andTypeEqualTo
((
byte
)
0
).
andDeletedEqualTo
(
false
);
return
(
int
)
commentMapper
.
countByExample
(
example
);
}
public
List
<
LitemallComment
>
query
(
Byte
type
,
Integer
valueId
,
Integer
showType
,
Integer
offset
,
Integer
limit
)
{
LitemallCommentExample
example
=
new
LitemallCommentExample
();
example
.
setOrderByClause
(
LitemallComment
.
Column
.
addTime
.
desc
());
if
(
showType
==
0
)
{
if
(
showType
==
0
)
{
example
.
or
().
andValueIdEqualTo
(
valueId
).
andTypeEqualTo
(
type
).
andDeletedEqualTo
(
false
);
}
else
if
(
showType
==
1
){
}
else
if
(
showType
==
1
)
{
example
.
or
().
andValueIdEqualTo
(
valueId
).
andTypeEqualTo
(
type
).
andHasPictureEqualTo
(
true
).
andDeletedEqualTo
(
false
);
}
else
{
}
else
{
throw
new
RuntimeException
(
"showType不支持"
);
}
PageHelper
.
startPage
(
offset
,
limit
);
return
commentMapper
.
selectByExample
(
example
);
}
public
int
count
(
Byte
type
,
Integer
valueId
,
Integer
showType
,
Integer
offset
,
Integer
size
){
public
int
count
(
Byte
type
,
Integer
valueId
,
Integer
showType
,
Integer
offset
,
Integer
size
)
{
LitemallCommentExample
example
=
new
LitemallCommentExample
();
if
(
showType
==
0
)
{
if
(
showType
==
0
)
{
example
.
or
().
andValueIdEqualTo
(
valueId
).
andTypeEqualTo
(
type
).
andDeletedEqualTo
(
false
);
}
else
if
(
showType
==
1
){
}
else
if
(
showType
==
1
)
{
example
.
or
().
andValueIdEqualTo
(
valueId
).
andTypeEqualTo
(
type
).
andHasPictureEqualTo
(
true
).
andDeletedEqualTo
(
false
);
}
else
{
}
else
{
throw
new
RuntimeException
(
"showType不支持"
);
}
return
(
int
)
commentMapper
.
countByExample
(
example
);
return
(
int
)
commentMapper
.
countByExample
(
example
);
}
public
int
save
(
LitemallComment
comment
)
{
...
...
@@ -72,13 +67,13 @@ public class LitemallCommentService {
LitemallCommentExample
.
Criteria
criteria
=
example
.
createCriteria
();
// type=2 是订单商品回复,这里过滤
criteria
.
andTypeNotEqualTo
((
byte
)
2
);
criteria
.
andTypeNotEqualTo
((
byte
)
2
);
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
valueId
)){
criteria
.
andValueIdEqualTo
(
Integer
.
valueOf
(
valueId
)).
andTypeEqualTo
((
byte
)
0
);
if
(!
StringUtils
.
isEmpty
(
valueId
))
{
criteria
.
andValueIdEqualTo
(
Integer
.
valueOf
(
valueId
)).
andTypeEqualTo
((
byte
)
0
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -94,15 +89,15 @@ public class LitemallCommentService {
LitemallCommentExample
example
=
new
LitemallCommentExample
();
LitemallCommentExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
valueId
)){
criteria
.
andValueIdEqualTo
(
Integer
.
valueOf
(
valueId
)).
andTypeEqualTo
((
byte
)
0
);
if
(!
StringUtils
.
isEmpty
(
valueId
))
{
criteria
.
andValueIdEqualTo
(
Integer
.
valueOf
(
valueId
)).
andTypeEqualTo
((
byte
)
0
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
commentMapper
.
countByExample
(
example
);
return
(
int
)
commentMapper
.
countByExample
(
example
);
}
public
void
deleteById
(
Integer
id
)
{
...
...
@@ -111,10 +106,10 @@ public class LitemallCommentService {
public
String
queryReply
(
Integer
id
)
{
LitemallCommentExample
example
=
new
LitemallCommentExample
();
example
.
or
().
andTypeEqualTo
((
byte
)
2
).
andValueIdEqualTo
(
id
);
example
.
or
().
andTypeEqualTo
((
byte
)
2
).
andValueIdEqualTo
(
id
);
List
<
LitemallComment
>
commentReply
=
commentMapper
.
selectByExampleSelective
(
example
,
LitemallComment
.
Column
.
content
);
// 目前业务只支持回复一次
if
(
commentReply
.
size
()
==
1
){
if
(
commentReply
.
size
()
==
1
)
{
return
commentReply
.
get
(
0
).
getContent
();
}
return
null
;
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallFeedbackService.java
View file @
a5c2aff4
...
...
@@ -30,10 +30,10 @@ public class LitemallFeedbackService {
LitemallFeedbackExample
example
=
new
LitemallFeedbackExample
();
LitemallFeedbackExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
userId
!=
null
){
if
(
userId
!=
null
)
{
criteria
.
andUserIdEqualTo
(
userId
);
}
if
(!
StringUtils
.
isEmpty
(
username
)){
if
(!
StringUtils
.
isEmpty
(
username
))
{
criteria
.
andUsernameLike
(
"%"
+
username
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -50,13 +50,13 @@ public class LitemallFeedbackService {
LitemallFeedbackExample
example
=
new
LitemallFeedbackExample
();
LitemallFeedbackExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
userId
!=
null
){
if
(
userId
!=
null
)
{
criteria
.
andUserIdEqualTo
(
userId
);
}
if
(!
StringUtils
.
isEmpty
(
username
)){
if
(!
StringUtils
.
isEmpty
(
username
))
{
criteria
.
andUsernameLike
(
"%"
+
username
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
feedbackMapper
.
countByExample
(
example
);
return
(
int
)
feedbackMapper
.
countByExample
(
example
);
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallFootprintService.java
View file @
a5c2aff4
...
...
@@ -24,17 +24,17 @@ public class LitemallFootprintService {
return
footprintMapper
.
selectByExample
(
example
);
}
public
int
countByAddTime
(
Integer
userId
,
Integer
page
,
Integer
size
)
{
public
int
countByAddTime
(
Integer
userId
,
Integer
page
,
Integer
size
)
{
LitemallFootprintExample
example
=
new
LitemallFootprintExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andDeletedEqualTo
(
false
);
return
(
int
)
footprintMapper
.
countByExample
(
example
);
return
(
int
)
footprintMapper
.
countByExample
(
example
);
}
public
LitemallFootprint
findById
(
Integer
id
)
{
return
footprintMapper
.
selectByPrimaryKey
(
id
);
}
public
void
deleteById
(
Integer
id
){
public
void
deleteById
(
Integer
id
)
{
footprintMapper
.
logicalDeleteByPrimaryKey
(
id
);
}
...
...
@@ -48,10 +48,10 @@ public class LitemallFootprintService {
LitemallFootprintExample
example
=
new
LitemallFootprintExample
();
LitemallFootprintExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
goodsId
)){
if
(!
StringUtils
.
isEmpty
(
goodsId
))
{
criteria
.
andGoodsIdEqualTo
(
Integer
.
valueOf
(
goodsId
));
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -68,14 +68,14 @@ public class LitemallFootprintService {
LitemallFootprintExample
example
=
new
LitemallFootprintExample
();
LitemallFootprintExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
goodsId
)){
if
(!
StringUtils
.
isEmpty
(
goodsId
))
{
criteria
.
andGoodsIdEqualTo
(
Integer
.
valueOf
(
goodsId
));
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
footprintMapper
.
countByExample
(
example
);
return
(
int
)
footprintMapper
.
countByExample
(
example
);
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGoodsAttributeService.java
View file @
a5c2aff4
package
org.linlinjava.litemall.db.service
;
import
com.github.pagehelper.PageHelper
;
import
org.linlinjava.litemall.db.dao.LitemallGoodsAttributeMapper
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsAttribute
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsAttributeExample
;
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGoodsProductService.java
View file @
a5c2aff4
...
...
@@ -42,7 +42,7 @@ public class LitemallGoodsProductService {
public
int
count
()
{
LitemallGoodsProductExample
example
=
new
LitemallGoodsProductExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
return
(
int
)
goodsProductMapper
.
countByExample
(
example
);
return
(
int
)
goodsProductMapper
.
countByExample
(
example
);
}
public
void
deleteByGid
(
Integer
gid
)
{
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGoodsService.java
View file @
a5c2aff4
package
org.linlinjava.litemall.db.service
;
import
com.github.pagehelper.PageHelper
;
import
org.linlinjava.litemall.db.dao.LitemallGoodsMapper
;
import
org.linlinjava.litemall.db.domain.LitemallGoods
;
import
org.linlinjava.litemall.db.domain.LitemallGoods.Column
;
import
org.linlinjava.litemall.db.dao.LitemallGoodsMapper
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsExample
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
...
...
@@ -15,11 +15,10 @@ import java.util.List;
@Service
public
class
LitemallGoodsService
{
Column
[]
columns
=
new
Column
[]{
Column
.
id
,
Column
.
name
,
Column
.
brief
,
Column
.
picUrl
,
Column
.
isHot
,
Column
.
isNew
,
Column
.
counterPrice
,
Column
.
retailPrice
};
@Resource
private
LitemallGoodsMapper
goodsMapper
;
Column
[]
columns
=
new
Column
[]{
Column
.
id
,
Column
.
name
,
Column
.
brief
,
Column
.
picUrl
,
Column
.
isHot
,
Column
.
isNew
,
Column
.
counterPrice
,
Column
.
retailPrice
};
/**
* 获取热卖商品
*
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGoodsSpecificationService.java
View file @
a5c2aff4
package
org.linlinjava.litemall.db.service
;
import
com.github.pagehelper.PageHelper
;
import
org.linlinjava.litemall.db.dao.LitemallGoodsSpecificationMapper
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsSpecification
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsSpecificationExample
;
...
...
@@ -40,38 +39,17 @@ public class LitemallGoodsSpecificationService {
goodsSpecificationMapper
.
insertSelective
(
goodsSpecification
);
}
private
class
VO
{
private
String
name
;
private
List
<
LitemallGoodsSpecification
>
valueList
;
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
List
<
LitemallGoodsSpecification
>
getValueList
()
{
return
valueList
;
}
public
void
setValueList
(
List
<
LitemallGoodsSpecification
>
valueList
)
{
this
.
valueList
=
valueList
;
}
}
/**
* [
*
{
*
name: '',
*
valueList: [ {}, {}]
*
},
*
{
*
name: '',
*
valueList: [ {}, {}]
*
}
*
]
* {
* name: '',
* valueList: [ {}, {}]
* },
* {
* name: '',
* valueList: [ {}, {}]
* }
* ]
*
* @param id
* @return
...
...
@@ -82,10 +60,10 @@ public class LitemallGoodsSpecificationService {
Map
<
String
,
VO
>
map
=
new
HashMap
<>();
List
<
VO
>
specificationVoList
=
new
ArrayList
<>();
for
(
LitemallGoodsSpecification
goodsSpecification
:
goodsSpecificationList
){
for
(
LitemallGoodsSpecification
goodsSpecification
:
goodsSpecificationList
)
{
String
specification
=
goodsSpecification
.
getSpecification
();
VO
goodsSpecificationVo
=
map
.
get
(
specification
);
if
(
goodsSpecificationVo
==
null
){
if
(
goodsSpecificationVo
==
null
)
{
goodsSpecificationVo
=
new
VO
();
goodsSpecificationVo
.
setName
(
specification
);
List
<
LitemallGoodsSpecification
>
valueList
=
new
ArrayList
<>();
...
...
@@ -93,8 +71,7 @@ public class LitemallGoodsSpecificationService {
goodsSpecificationVo
.
setValueList
(
valueList
);
map
.
put
(
specification
,
goodsSpecificationVo
);
specificationVoList
.
add
(
goodsSpecificationVo
);
}
else
{
}
else
{
List
<
LitemallGoodsSpecification
>
valueList
=
goodsSpecificationVo
.
getValueList
();
valueList
.
add
(
goodsSpecification
);
}
...
...
@@ -103,4 +80,25 @@ public class LitemallGoodsSpecificationService {
return
specificationVoList
;
}
private
class
VO
{
private
String
name
;
private
List
<
LitemallGoodsSpecification
>
valueList
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
List
<
LitemallGoodsSpecification
>
getValueList
()
{
return
valueList
;
}
public
void
setValueList
(
List
<
LitemallGoodsSpecification
>
valueList
)
{
this
.
valueList
=
valueList
;
}
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponRulesService.java
View file @
a5c2aff4
...
...
@@ -22,6 +22,7 @@ public class LitemallGrouponRulesService {
private
LitemallGrouponRulesMapper
mapper
;
@Resource
private
LitemallGoodsMapper
goodsMapper
;
private
LitemallGoods
.
Column
[]
goodsColumns
=
new
LitemallGoods
.
Column
[]{
LitemallGoods
.
Column
.
id
,
LitemallGoods
.
Column
.
name
,
LitemallGoods
.
Column
.
brief
,
LitemallGoods
.
Column
.
picUrl
,
LitemallGoods
.
Column
.
counterPrice
,
LitemallGoods
.
Column
.
retailPrice
};
public
int
createRules
(
LitemallGrouponRules
rules
)
{
rules
.
setAddTime
(
LocalDateTime
.
now
());
...
...
@@ -64,7 +65,6 @@ public class LitemallGrouponRulesService {
return
queryList
(
offset
,
limit
,
"add_time"
,
"desc"
);
}
private
LitemallGoods
.
Column
[]
goodsColumns
=
new
LitemallGoods
.
Column
[]{
LitemallGoods
.
Column
.
id
,
LitemallGoods
.
Column
.
name
,
LitemallGoods
.
Column
.
brief
,
LitemallGoods
.
Column
.
picUrl
,
LitemallGoods
.
Column
.
counterPrice
,
LitemallGoods
.
Column
.
retailPrice
};
public
List
<
Map
<
String
,
Object
>>
queryList
(
int
offset
,
int
limit
,
String
sort
,
String
order
)
{
LitemallGrouponRulesExample
example
=
new
LitemallGrouponRulesExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
...
...
@@ -72,7 +72,7 @@ public class LitemallGrouponRulesService {
PageHelper
.
startPage
(
offset
,
limit
);
List
<
LitemallGrouponRules
>
grouponRules
=
mapper
.
selectByExample
(
example
);
List
<
Map
<
String
,
Object
>>
grouponList
=
new
ArrayList
<>(
grouponRules
.
size
());
List
<
Map
<
String
,
Object
>>
grouponList
=
new
ArrayList
<>(
grouponRules
.
size
());
for
(
LitemallGrouponRules
rule
:
grouponRules
)
{
Integer
goodsId
=
rule
.
getGoodsId
();
LitemallGoods
goods
=
goodsMapper
.
selectByPrimaryKeySelective
(
goodsId
,
goodsColumns
);
...
...
@@ -92,7 +92,7 @@ public class LitemallGrouponRulesService {
public
int
countList
(
int
offset
,
int
limit
,
String
sort
,
String
order
)
{
LitemallGrouponRulesExample
example
=
new
LitemallGrouponRulesExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
return
(
int
)
mapper
.
countByExample
(
example
);
return
(
int
)
mapper
.
countByExample
(
example
);
}
/**
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java
View file @
a5c2aff4
...
...
@@ -3,15 +3,13 @@ package org.linlinjava.litemall.db.service;
import
com.alibaba.druid.util.StringUtils
;
import
com.github.pagehelper.PageHelper
;
import
org.linlinjava.litemall.db.dao.LitemallGrouponMapper
;
import
org.linlinjava.litemall.db.domain.*
;
import
org.linlinjava.litemall.db.domain.LitemallGroupon
;
import
org.linlinjava.litemall.db.domain.LitemallGrouponExample
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
LitemallGrouponService
{
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallIssueService.java
View file @
a5c2aff4
...
...
@@ -36,8 +36,8 @@ public class LitemallIssueService {
LitemallIssueExample
example
=
new
LitemallIssueExample
();
LitemallIssueExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
question
)){
criteria
.
andQuestionLike
(
"%"
+
question
+
"%"
);
if
(!
StringUtils
.
isEmpty
(
question
))
{
criteria
.
andQuestionLike
(
"%"
+
question
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -53,12 +53,12 @@ public class LitemallIssueService {
LitemallIssueExample
example
=
new
LitemallIssueExample
();
LitemallIssueExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
question
)){
criteria
.
andQuestionLike
(
"%"
+
question
+
"%"
);
if
(!
StringUtils
.
isEmpty
(
question
))
{
criteria
.
andQuestionLike
(
"%"
+
question
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
issueMapper
.
countByExample
(
example
);
return
(
int
)
issueMapper
.
countByExample
(
example
);
}
public
int
updateById
(
LitemallIssue
issue
)
{
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallKeywordService.java
View file @
a5c2aff4
...
...
@@ -69,7 +69,7 @@ public class LitemallKeywordService {
criteria
.
andDeletedEqualTo
(
false
);
PageHelper
.
startPage
(
page
,
limit
);
return
(
int
)
keywordsMapper
.
countByExample
(
example
);
return
(
int
)
keywordsMapper
.
countByExample
(
example
);
}
public
void
add
(
LitemallKeyword
keywords
)
{
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallOrderGoodsService.java
View file @
a5c2aff4
package
org.linlinjava.litemall.db.service
;
import
org.linlinjava.litemall.db.dao.LitemallOrderGoodsMapper
;
import
org.linlinjava.litemall.db.domain.LitemallOrder
;
import
org.linlinjava.litemall.db.domain.LitemallOrderGoods
;
import
org.linlinjava.litemall.db.domain.LitemallOrderGoodsExample
;
import
org.springframework.stereotype.Service
;
...
...
@@ -26,6 +25,7 @@ public class LitemallOrderGoodsService {
example
.
or
().
andOrderIdEqualTo
(
orderId
).
andDeletedEqualTo
(
false
);
return
orderGoodsMapper
.
selectByExample
(
example
);
}
public
List
<
LitemallOrderGoods
>
findByOidAndGid
(
Integer
orderId
,
Integer
goodsId
)
{
LitemallOrderGoodsExample
example
=
new
LitemallOrderGoodsExample
();
example
.
or
().
andOrderIdEqualTo
(
orderId
).
andGoodsIdEqualTo
(
goodsId
).
andDeletedEqualTo
(
false
);
...
...
@@ -45,6 +45,6 @@ public class LitemallOrderGoodsService {
LitemallOrderGoodsExample
example
=
new
LitemallOrderGoodsExample
();
example
.
or
().
andOrderIdEqualTo
(
orderId
).
andDeletedEqualTo
(
false
);
long
count
=
orderGoodsMapper
.
countByExample
(
example
);
return
(
short
)
count
;
return
(
short
)
count
;
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallOrderService.java
View file @
a5c2aff4
...
...
@@ -34,7 +34,7 @@ public class LitemallOrderService {
public
int
count
(
Integer
userId
)
{
LitemallOrderExample
example
=
new
LitemallOrderExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andDeletedEqualTo
(
false
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
}
public
LitemallOrder
findById
(
Integer
orderId
)
{
...
...
@@ -52,10 +52,10 @@ public class LitemallOrderService {
return
sb
.
toString
();
}
public
int
countByOrderSn
(
Integer
userId
,
String
orderSn
){
public
int
countByOrderSn
(
Integer
userId
,
String
orderSn
)
{
LitemallOrderExample
example
=
new
LitemallOrderExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andOrderSnEqualTo
(
orderSn
).
andDeletedEqualTo
(
false
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
}
// TODO 这里应该产生一个唯一的订单,但是实际上这里仍然存在两个订单相同的可能性
...
...
@@ -63,7 +63,7 @@ public class LitemallOrderService {
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
String
now
=
df
.
format
(
LocalDate
.
now
());
String
orderSn
=
now
+
getRandomNum
(
6
);
while
(
countByOrderSn
(
userId
,
orderSn
)
!=
0
){
while
(
countByOrderSn
(
userId
,
orderSn
)
!=
0
)
{
orderSn
=
getRandomNum
(
6
);
}
return
orderSn
;
...
...
@@ -74,7 +74,7 @@ public class LitemallOrderService {
example
.
setOrderByClause
(
LitemallOrder
.
Column
.
addTime
.
desc
());
LitemallOrderExample
.
Criteria
criteria
=
example
.
or
();
criteria
.
andUserIdEqualTo
(
userId
);
if
(
orderStatus
!=
null
)
{
if
(
orderStatus
!=
null
)
{
criteria
.
andOrderStatusIn
(
orderStatus
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -85,24 +85,24 @@ public class LitemallOrderService {
LitemallOrderExample
example
=
new
LitemallOrderExample
();
LitemallOrderExample
.
Criteria
criteria
=
example
.
or
();
criteria
.
andUserIdEqualTo
(
userId
);
if
(
orderStatus
!=
null
)
{
if
(
orderStatus
!=
null
)
{
criteria
.
andOrderStatusIn
(
orderStatus
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
}
public
List
<
LitemallOrder
>
querySelective
(
Integer
userId
,
String
orderSn
,
List
<
Short
>
orderStatusArray
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
)
{
LitemallOrderExample
example
=
new
LitemallOrderExample
();
LitemallOrderExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
userId
!=
null
){
if
(
userId
!=
null
)
{
criteria
.
andUserIdEqualTo
(
userId
);
}
if
(!
StringUtils
.
isEmpty
(
orderSn
)){
if
(!
StringUtils
.
isEmpty
(
orderSn
))
{
criteria
.
andOrderSnEqualTo
(
orderSn
);
}
if
(
orderStatusArray
!=
null
&&
orderStatusArray
.
size
()
!=
0
){
if
(
orderStatusArray
!=
null
&&
orderStatusArray
.
size
()
!=
0
)
{
criteria
.
andOrderStatusIn
(
orderStatusArray
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -119,15 +119,15 @@ public class LitemallOrderService {
LitemallOrderExample
example
=
new
LitemallOrderExample
();
LitemallOrderExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
userId
!=
null
){
if
(
userId
!=
null
)
{
criteria
.
andUserIdEqualTo
(
userId
);
}
if
(!
StringUtils
.
isEmpty
(
orderSn
)){
if
(!
StringUtils
.
isEmpty
(
orderSn
))
{
criteria
.
andOrderSnEqualTo
(
orderSn
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
}
public
int
updateWithOptimisticLocker
(
LitemallOrder
order
)
{
...
...
@@ -143,7 +143,7 @@ public class LitemallOrderService {
public
int
count
()
{
LitemallOrderExample
example
=
new
LitemallOrderExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
return
(
int
)
litemallOrderMapper
.
countByExample
(
example
);
}
public
List
<
LitemallOrder
>
queryUnpaid
()
{
...
...
@@ -164,7 +164,7 @@ public class LitemallOrderService {
return
litemallOrderMapper
.
selectOneByExample
(
example
);
}
public
Map
<
Object
,
Object
>
orderInfo
(
Integer
userId
){
public
Map
<
Object
,
Object
>
orderInfo
(
Integer
userId
)
{
LitemallOrderExample
example
=
new
LitemallOrderExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andDeletedEqualTo
(
false
);
List
<
LitemallOrder
>
orders
=
litemallOrderMapper
.
selectByExampleSelective
(
example
,
LitemallOrder
.
Column
.
orderStatus
,
LitemallOrder
.
Column
.
comments
);
...
...
@@ -173,20 +173,16 @@ public class LitemallOrderService {
int
unship
=
0
;
int
unrecv
=
0
;
int
uncomment
=
0
;
for
(
LitemallOrder
order
:
orders
){
if
(
OrderUtil
.
isCreateStatus
(
order
)){
for
(
LitemallOrder
order
:
orders
)
{
if
(
OrderUtil
.
isCreateStatus
(
order
))
{
unpaid
++;
}
else
if
(
OrderUtil
.
isPayStatus
(
order
)){
}
else
if
(
OrderUtil
.
isPayStatus
(
order
))
{
unship
++;
}
else
if
(
OrderUtil
.
isShipStatus
(
order
)){
}
else
if
(
OrderUtil
.
isShipStatus
(
order
))
{
unrecv
++;
}
else
if
(
OrderUtil
.
isConfirmStatus
(
order
)
||
OrderUtil
.
isAutoConfirmStatus
(
order
)){
}
else
if
(
OrderUtil
.
isConfirmStatus
(
order
)
||
OrderUtil
.
isAutoConfirmStatus
(
order
))
{
uncomment
+=
order
.
getComments
();
}
else
{
}
else
{
// do nothing
}
}
...
...
@@ -202,7 +198,7 @@ public class LitemallOrderService {
public
List
<
LitemallOrder
>
queryComment
()
{
LitemallOrderExample
example
=
new
LitemallOrderExample
();
example
.
or
().
andCommentsGreaterThan
((
short
)
0
).
andDeletedEqualTo
(
false
);
example
.
or
().
andCommentsGreaterThan
((
short
)
0
).
andDeletedEqualTo
(
false
);
return
litemallOrderMapper
.
selectByExample
(
example
);
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallRegionService.java
View file @
a5c2aff4
package
org.linlinjava.litemall.db.service
;
import
com.github.pagehelper.PageHelper
;
import
org.linlinjava.litemall.db.dao.
*
;
import
org.linlinjava.litemall.db.dao.
LitemallRegionMapper
;
import
org.linlinjava.litemall.db.domain.LitemallRegion
;
import
org.linlinjava.litemall.db.domain.LitemallRegionExample
;
import
org.springframework.stereotype.Service
;
...
...
@@ -29,10 +29,10 @@ public class LitemallRegionService {
LitemallRegionExample
example
=
new
LitemallRegionExample
();
LitemallRegionExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
name
)){
if
(!
StringUtils
.
isEmpty
(
name
))
{
criteria
.
andNameLike
(
"%"
+
name
+
"%"
);
}
if
(!
StringUtils
.
isEmpty
(
code
)){
if
(!
StringUtils
.
isEmpty
(
code
))
{
criteria
.
andCodeEqualTo
(
code
);
}
...
...
@@ -48,12 +48,12 @@ public class LitemallRegionService {
LitemallRegionExample
example
=
new
LitemallRegionExample
();
LitemallRegionExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
name
)){
if
(!
StringUtils
.
isEmpty
(
name
))
{
criteria
.
andNameLike
(
"%"
+
name
+
"%"
);
}
if
(
code
!=
null
){
if
(
code
!=
null
)
{
criteria
.
andCodeEqualTo
(
code
);
}
return
(
int
)
regionMapper
.
countByExample
(
example
);
return
(
int
)
regionMapper
.
countByExample
(
example
);
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallSearchHistoryService.java
View file @
a5c2aff4
...
...
@@ -39,11 +39,11 @@ public class LitemallSearchHistoryService {
LitemallSearchHistoryExample
example
=
new
LitemallSearchHistoryExample
();
LitemallSearchHistoryExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
keyword
)){
criteria
.
andKeywordLike
(
"%"
+
keyword
+
"%"
);
if
(!
StringUtils
.
isEmpty
(
keyword
))
{
criteria
.
andKeywordLike
(
"%"
+
keyword
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -59,14 +59,14 @@ public class LitemallSearchHistoryService {
LitemallSearchHistoryExample
example
=
new
LitemallSearchHistoryExample
();
LitemallSearchHistoryExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
userId
)){
if
(!
StringUtils
.
isEmpty
(
userId
))
{
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
if
(!
StringUtils
.
isEmpty
(
keyword
)){
criteria
.
andKeywordLike
(
"%"
+
keyword
+
"%"
);
if
(!
StringUtils
.
isEmpty
(
keyword
))
{
criteria
.
andKeywordLike
(
"%"
+
keyword
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
searchHistoryMapper
.
countByExample
(
example
);
return
(
int
)
searchHistoryMapper
.
countByExample
(
example
);
}
}
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallStorageService.java
View file @
a5c2aff4
...
...
@@ -47,10 +47,10 @@ public class LitemallStorageService {
LitemallStorageExample
example
=
new
LitemallStorageExample
();
LitemallStorageExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
key
)){
if
(!
StringUtils
.
isEmpty
(
key
))
{
criteria
.
andKeyEqualTo
(
key
);
}
if
(!
StringUtils
.
isEmpty
(
name
)){
if
(!
StringUtils
.
isEmpty
(
name
))
{
criteria
.
andNameLike
(
"%"
+
name
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
...
...
@@ -67,14 +67,14 @@ public class LitemallStorageService {
LitemallStorageExample
example
=
new
LitemallStorageExample
();
LitemallStorageExample
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
key
)){
if
(!
StringUtils
.
isEmpty
(
key
))
{
criteria
.
andKeyEqualTo
(
key
);
}
if
(!
StringUtils
.
isEmpty
(
name
)){
if
(!
StringUtils
.
isEmpty
(
name
))
{
criteria
.
andNameLike
(
"%"
+
name
+
"%"
);
}
criteria
.
andDeletedEqualTo
(
false
);
return
(
int
)
storageMapper
.
countByExample
(
example
);
return
(
int
)
storageMapper
.
countByExample
(
example
);
}
}
Prev
1
2
3
4
5
6
7
Next
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