ソースを参照

Merge branch 'pull/340'

Junling Bu 6 年 前
コミット
62921c2e74

+ 6 - 4
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/service/AdminOrderService.java

@@ -229,16 +229,18 @@ public class AdminOrderService {
             return ResponseUtil.badArgument();
             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, "订单商品已回复!");
             return ResponseUtil.fail(ORDER_REPLY_EXIST, "订单商品已回复!");
         }
         }
         String content = JacksonUtil.parseString(body, "content");
         String content = JacksonUtil.parseString(body, "content");
         if (StringUtils.isEmpty(content)) {
         if (StringUtils.isEmpty(content)) {
             return ResponseUtil.badArgument();
             return ResponseUtil.badArgument();
         }
         }
-        // 创建评价回复
-        LitemallComment comment = new LitemallComment();
-        comment.setId(commentId);
+        // 更新评价回复
         comment.setAdminContent(content);
         comment.setAdminContent(content);
         commentService.updateById(comment);
         commentService.updateById(comment);
 
 

+ 2 - 1
litemall-db/sql/litemall_table.sql

@@ -218,8 +218,9 @@ DROP TABLE IF EXISTS `litemall_comment`;
 CREATE TABLE `litemall_comment` (
 CREATE TABLE `litemall_comment` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `value_id` int(11) NOT NULL DEFAULT '0' COMMENT '如果type=0,则是商品评论;如果是type=1,则是专题评论。',
   `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 '评论内容',
   `content` varchar(1023) NOT NULL COMMENT '评论内容',
+  `admin_content` varchar(511) NOT NULL COMMENT '管理员回复内容',
   `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户表的用户ID',
   `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户表的用户ID',
   `has_picture` tinyint(1) DEFAULT '0' COMMENT '是否含有图片',
   `has_picture` tinyint(1) DEFAULT '0' COMMENT '是否含有图片',
   `pic_urls` varchar(1023) DEFAULT NULL COMMENT '图片地址列表,采用JSON数组格式',
   `pic_urls` varchar(1023) DEFAULT NULL COMMENT '图片地址列表,采用JSON数组格式',

+ 136 - 0
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallCommentExample.java

@@ -811,6 +811,142 @@ public class LitemallCommentExample {
             return (Criteria) this;
             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() {
         public Criteria andUserIdIsNull() {
             addCriterion("user_id is null");
             addCriterion("user_id is null");
             return (Criteria) this;
             return (Criteria) this;

+ 0 - 11
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCommentService.java

@@ -83,17 +83,6 @@ public class LitemallCommentService {
         commentMapper.logicalDeleteByPrimaryKey(id);
         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) {
     public LitemallComment findById(Integer id) {
         return commentMapper.selectByPrimaryKey(id);
         return commentMapper.selectByPrimaryKey(id);
     }
     }

+ 11 - 6
litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallCommentMapper.xml

@@ -128,8 +128,8 @@
       WARNING - @mbg.generated
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
       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>
   </sql>
   <select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCommentExample" resultMap="BaseResultMap">
   <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">
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
       SELECT LAST_INSERT_ID()
       SELECT LAST_INSERT_ID()
     </selectKey>
     </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, 
       star, add_time, update_time, 
       deleted)
       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}, 
       #{star,jdbcType=SMALLINT}, #{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, 
       #{deleted,jdbcType=BIT})
       #{deleted,jdbcType=BIT})
   </insert>
   </insert>
@@ -313,6 +315,9 @@
       <if test="content != null">
       <if test="content != null">
         #{content,jdbcType=VARCHAR},
         #{content,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="adminContent != null">
+        #{adminContent,jdbcType=VARCHAR},
+      </if>
       <if test="userId != null">
       <if test="userId != null">
         #{userId,jdbcType=INTEGER},
         #{userId,jdbcType=INTEGER},
       </if>
       </if>

+ 0 - 3
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCommentController.java

@@ -147,9 +147,6 @@ public class WxCommentController {
             UserInfo userInfo = userInfoService.getInfo(comment.getUserId());
             UserInfo userInfo = userInfoService.getInfo(comment.getUserId());
             commentVo.put("userInfo", userInfo);
             commentVo.put("userInfo", userInfo);
 
 
-            String reply = commentService.queryReply(comment.getId());
-            commentVo.put("reply", reply);
-
             commentVoList.add(commentVo);
             commentVoList.add(commentVo);
         }
         }
         return ResponseUtil.okList(commentVoList, commentList);
         return ResponseUtil.okList(commentVoList, commentList);

+ 1 - 0
litemall-wx/pages/goods/goods.wxss

@@ -326,6 +326,7 @@
   height: auto;
   height: auto;
   overflow: hidden;
   overflow: hidden;
   margin-top: 23rpx;
   margin-top: 23rpx;
+  margin-bottom: 23rpx;
   background: rgba(0, 0, 0, 0.03);
   background: rgba(0, 0, 0, 0.03);
   padding: 21rpx;
   padding: 21rpx;
 }
 }

+ 2 - 2
litemall-wx/project.config.json

@@ -21,8 +21,8 @@
 	},
 	},
 	"compileType": "miniprogram",
 	"compileType": "miniprogram",
 	"libVersion": "2.4.0",
 	"libVersion": "2.4.0",
-	"appid": "wx1cd22d00f1fac673",
-	"projectname": "litemall-wx-l",
+	"appid": "wxa5b486c6b918ecfb",
+	"projectname": "litemall-wx",
 	"simulatorType": "wechat",
 	"simulatorType": "wechat",
 	"simulatorPluginLibVersion": {},
 	"simulatorPluginLibVersion": {},
 	"condition": {
 	"condition": {