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
046203a1
Commit
046203a1
authored
Nov 11, 2018
by
Junling Bu
Browse files
feat[litemall-wx-api, litemall-wx]: 商品评价列表显示商品评价回复。
parent
f5432529
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCommentService.java
View file @
046203a1
...
...
@@ -69,9 +69,11 @@ public class LitemallCommentService {
public
List
<
LitemallComment
>
querySelective
(
String
userId
,
String
valueId
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
)
{
LitemallCommentExample
example
=
new
LitemallCommentExample
();
example
.
setOrderByClause
(
LitemallComment
.
Column
.
addTime
.
desc
());
LitemallCommentExample
.
Criteria
criteria
=
example
.
createCriteria
();
// type=2 是订单商品回复,这里过滤
criteria
.
andTypeNotEqualTo
((
byte
)
2
);
if
(!
StringUtils
.
isEmpty
(
userId
)){
criteria
.
andUserIdEqualTo
(
Integer
.
valueOf
(
userId
));
}
...
...
@@ -107,4 +109,18 @@ public class LitemallCommentService {
commentMapper
.
logicalDeleteByPrimaryKey
(
id
);
}
public
String
queryReply
(
Integer
id
)
{
LitemallCommentExample
example
=
new
LitemallCommentExample
();
example
.
or
().
andTypeEqualTo
((
byte
)
2
).
andValueIdEqualTo
(
id
);
List
<
LitemallComment
>
commentReply
=
commentMapper
.
selectByExampleSelective
(
example
,
LitemallComment
.
Column
.
content
);
// 目前业务只支持回复一次
if
(
commentReply
.
size
()
==
1
){
return
commentReply
.
get
(
0
).
getContent
();
}
return
null
;
}
public
LitemallComment
findById
(
Integer
id
)
{
return
commentMapper
.
selectByPrimaryKey
(
id
);
}
}
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCommentController.java
View file @
046203a1
...
...
@@ -172,12 +172,16 @@ public class WxCommentController {
List
<
Map
<
String
,
Object
>>
commentVoList
=
new
ArrayList
<>(
commentList
.
size
());
for
(
LitemallComment
comment
:
commentList
){
Map
<
String
,
Object
>
commentVo
=
new
HashMap
<>();
UserInfo
userInfo
=
userInfoService
.
getInfo
(
comment
.
getUserId
());
commentVo
.
put
(
"userInfo"
,
userInfo
);
commentVo
.
put
(
"addTime"
,
comment
.
getAddTime
());
commentVo
.
put
(
"content"
,
comment
.
getContent
());
commentVo
.
put
(
"picList"
,
comment
.
getPicUrls
());
UserInfo
userInfo
=
userInfoService
.
getInfo
(
comment
.
getUserId
());
commentVo
.
put
(
"userInfo"
,
userInfo
);
String
reply
=
commentService
.
queryReply
(
comment
.
getId
());
commentVo
.
put
(
"reply"
,
reply
);
commentVoList
.
add
(
commentVo
);
}
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
...
...
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