Merge branch 'pull/340'
This commit is contained in:
@@ -229,16 +229,18 @@ public class AdminOrderService {
|
||||
return ResponseUtil.badArgument();
|
||||
}
|
||||
// 目前只支持回复一次
|
||||
if (commentService.findById(commentId).getAdminContent().length() != 0) {
|
||||
LitemallComment comment = commentService.findById(commentId);
|
||||
if(comment == null){
|
||||
return ResponseUtil.badArgument();
|
||||
}
|
||||
if (!StringUtils.isEmpty(comment.getAdminContent())) {
|
||||
return ResponseUtil.fail(ORDER_REPLY_EXIST, "订单商品已回复!");
|
||||
}
|
||||
String content = JacksonUtil.parseString(body, "content");
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
return ResponseUtil.badArgument();
|
||||
}
|
||||
// 创建评价回复
|
||||
LitemallComment comment = new LitemallComment();
|
||||
comment.setId(commentId);
|
||||
// 更新评价回复
|
||||
comment.setAdminContent(content);
|
||||
commentService.updateById(comment);
|
||||
|
||||
|
||||
@@ -218,8 +218,9 @@ DROP TABLE IF EXISTS `litemall_comment`;
|
||||
CREATE TABLE `litemall_comment` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`value_id` int(11) NOT NULL DEFAULT '0' COMMENT '如果type=0,则是商品评论;如果是type=1,则是专题评论。',
|
||||
`type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '评论类型,如果type=0,则是商品评论;如果是type=1,则是专题评论;如果type=3,则是订单商品评论。',
|
||||
`type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '评论类型,如果type=0,则是商品评论;如果是type=1,则是专题评论;',
|
||||
`content` varchar(1023) NOT NULL COMMENT '评论内容',
|
||||
`admin_content` varchar(511) NOT NULL COMMENT '管理员回复内容',
|
||||
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户表的用户ID',
|
||||
`has_picture` tinyint(1) DEFAULT '0' COMMENT '是否含有图片',
|
||||
`pic_urls` varchar(1023) DEFAULT NULL COMMENT '图片地址列表,采用JSON数组格式',
|
||||
|
||||
@@ -811,6 +811,142 @@ public class LitemallCommentExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentIsNull() {
|
||||
addCriterion("admin_content is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentIsNotNull() {
|
||||
addCriterion("admin_content is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentEqualTo(String value) {
|
||||
addCriterion("admin_content =", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_comment
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria andAdminContentEqualToColumn(LitemallComment.Column column) {
|
||||
addCriterion(new StringBuilder("admin_content = ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentNotEqualTo(String value) {
|
||||
addCriterion("admin_content <>", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_comment
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria andAdminContentNotEqualToColumn(LitemallComment.Column column) {
|
||||
addCriterion(new StringBuilder("admin_content <> ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentGreaterThan(String value) {
|
||||
addCriterion("admin_content >", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_comment
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria andAdminContentGreaterThanColumn(LitemallComment.Column column) {
|
||||
addCriterion(new StringBuilder("admin_content > ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("admin_content >=", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_comment
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria andAdminContentGreaterThanOrEqualToColumn(LitemallComment.Column column) {
|
||||
addCriterion(new StringBuilder("admin_content >= ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentLessThan(String value) {
|
||||
addCriterion("admin_content <", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_comment
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria andAdminContentLessThanColumn(LitemallComment.Column column) {
|
||||
addCriterion(new StringBuilder("admin_content < ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentLessThanOrEqualTo(String value) {
|
||||
addCriterion("admin_content <=", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_comment
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria andAdminContentLessThanOrEqualToColumn(LitemallComment.Column column) {
|
||||
addCriterion(new StringBuilder("admin_content <= ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentLike(String value) {
|
||||
addCriterion("admin_content like", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentNotLike(String value) {
|
||||
addCriterion("admin_content not like", value, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentIn(List<String> values) {
|
||||
addCriterion("admin_content in", values, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentNotIn(List<String> values) {
|
||||
addCriterion("admin_content not in", values, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentBetween(String value1, String value2) {
|
||||
addCriterion("admin_content between", value1, value2, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAdminContentNotBetween(String value1, String value2) {
|
||||
addCriterion("admin_content not between", value1, value2, "adminContent");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIsNull() {
|
||||
addCriterion("user_id is null");
|
||||
return (Criteria) this;
|
||||
|
||||
@@ -83,17 +83,6 @@ 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);
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, value_id, `type`, content, admin_content, user_id, has_picture, pic_urls, star, add_time, update_time,
|
||||
deleted
|
||||
id, value_id, `type`, content, admin_content, user_id, has_picture, pic_urls, star,
|
||||
add_time, update_time, deleted
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCommentExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
@@ -250,12 +250,14 @@
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into litemall_comment (value_id, `type`, content, admin_content,
|
||||
user_id, has_picture, pic_urls,
|
||||
insert into litemall_comment (value_id, `type`, content,
|
||||
admin_content, user_id, has_picture,
|
||||
pic_urls,
|
||||
star, add_time, update_time,
|
||||
deleted)
|
||||
values (#{valueId,jdbcType=INTEGER}, #{type,jdbcType=TINYINT}, #{content,jdbcType=VARCHAR}, #{adminContent,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=INTEGER}, #{hasPicture,jdbcType=BIT}, #{picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
|
||||
values (#{valueId,jdbcType=INTEGER}, #{type,jdbcType=TINYINT}, #{content,jdbcType=VARCHAR},
|
||||
#{adminContent,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER}, #{hasPicture,jdbcType=BIT},
|
||||
#{picUrls,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler},
|
||||
#{star,jdbcType=SMALLINT}, #{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
|
||||
#{deleted,jdbcType=BIT})
|
||||
</insert>
|
||||
@@ -313,6 +315,9 @@
|
||||
<if test="content != null">
|
||||
#{content,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="adminContent != null">
|
||||
#{adminContent,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=INTEGER},
|
||||
</if>
|
||||
|
||||
@@ -147,9 +147,6 @@ public class WxCommentController {
|
||||
UserInfo userInfo = userInfoService.getInfo(comment.getUserId());
|
||||
commentVo.put("userInfo", userInfo);
|
||||
|
||||
String reply = commentService.queryReply(comment.getId());
|
||||
commentVo.put("reply", reply);
|
||||
|
||||
commentVoList.add(commentVo);
|
||||
}
|
||||
return ResponseUtil.okList(commentVoList, commentList);
|
||||
|
||||
@@ -326,6 +326,7 @@
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
margin-top: 23rpx;
|
||||
margin-bottom: 23rpx;
|
||||
background: rgba(0, 0, 0, 0.03);
|
||||
padding: 21rpx;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.4.0",
|
||||
"appid": "wx1cd22d00f1fac673",
|
||||
"projectname": "litemall-wx-l",
|
||||
"appid": "wxa5b486c6b918ecfb",
|
||||
"projectname": "litemall-wx",
|
||||
"simulatorType": "wechat",
|
||||
"simulatorPluginLibVersion": {},
|
||||
"condition": {
|
||||
|
||||
Reference in New Issue
Block a user