Ver Fonte

评论数

suochencheng há 7 anos atrás
pai
commit
3e196cf158

+ 6 - 3
src/main/java/com/izouma/awesomeadmin/dao/ProductCommentMapper.java

@@ -1,16 +1,17 @@
 package com.izouma.awesomeadmin.dao;
 package com.izouma.awesomeadmin.dao;
 
 
 import java.util.*;
 import java.util.*;
+
 import com.izouma.awesomeadmin.datasource.DataSource;
 import com.izouma.awesomeadmin.datasource.DataSource;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 import com.izouma.awesomeadmin.model.ProductComment;
 import com.izouma.awesomeadmin.model.ProductComment;
 
 
 
 
 /**
 /**
-*  Dao接口
-*/
+ * Dao接口
+ */
 @Repository("com.zoumaframe.dao.ProductCommentMapper")
 @Repository("com.zoumaframe.dao.ProductCommentMapper")
-public interface ProductCommentMapper{
+public interface ProductCommentMapper {
 
 
     int deleteByPrimaryKey(Integer id);
     int deleteByPrimaryKey(Integer id);
 
 
@@ -29,5 +30,7 @@ public interface ProductCommentMapper{
     ProductComment queryProductComment(ProductComment record);
     ProductComment queryProductComment(ProductComment record);
 
 
     List<ProductComment> query(ProductComment record);
     List<ProductComment> query(ProductComment record);
+
+    ProductComment getCount(ProductComment record);
 }
 }
 
 

+ 290 - 216
src/main/java/com/izouma/awesomeadmin/dao/ProductCommentMapper.xml

@@ -1,24 +1,24 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.izouma.awesomeadmin.dao.ProductCommentMapper" >
-    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.ProductComment" >
-                <id column="id" property="id" jdbcType="INTEGER" />
-                                        <result column="del_flag" property="delFlag" jdbcType="CHAR" />
-                                <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
-                                <result column="update_user" property="updateUser" jdbcType="VARCHAR" />
-                                <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
-                                <result column="create_user" property="createUser" jdbcType="VARCHAR" />
-                                <result column="product_id" property="productId" jdbcType="VARCHAR" />
-                                <result column="order_id" property="orderId" jdbcType="VARCHAR" />
-                                <result column="user_id" property="userId" jdbcType="VARCHAR" />
-                                <result column="store_id" property="storeId" jdbcType="VARCHAR" />
-                                <result column="context" property="context" jdbcType="VARCHAR" />
-                                <result column="star_level" property="starLevel" jdbcType="VARCHAR" />
-                                <result column="anonymous" property="anonymous" jdbcType="CHAR" />
-                                <result column="type_flag" property="typeFlag" jdbcType="INTEGER" />
-            </resultMap>
-    <sql id="Base_Column_List" >
-        <trim  suffixOverrides="," >
+<mapper namespace="com.izouma.awesomeadmin.dao.ProductCommentMapper">
+    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.ProductComment">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
+        <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+        <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
+        <result column="product_id" property="productId" jdbcType="VARCHAR"/>
+        <result column="order_id" property="orderId" jdbcType="VARCHAR"/>
+        <result column="user_id" property="userId" jdbcType="VARCHAR"/>
+        <result column="store_id" property="storeId" jdbcType="VARCHAR"/>
+        <result column="context" property="context" jdbcType="VARCHAR"/>
+        <result column="star_level" property="starLevel" jdbcType="VARCHAR"/>
+        <result column="anonymous" property="anonymous" jdbcType="CHAR"/>
+        <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <trim suffixOverrides=",">
             id,
             id,
 
 
             del_flag,
             del_flag,
@@ -47,215 +47,219 @@
 
 
             type_flag,
             type_flag,
 
 
-            </trim>
+        </trim>
     </sql>
     </sql>
-    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
         select
         select
-        <include refid="Base_Column_List" />
+        <include refid="Base_Column_List"/>
         from product_comment
         from product_comment
         where id = #{id,jdbcType=INTEGER}
         where id = #{id,jdbcType=INTEGER}
     </select>
     </select>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
         delete from product_comment
         delete from product_comment
         where id = #{id,jdbcType=INTEGER}
         where id = #{id,jdbcType=INTEGER}
     </delete>
     </delete>
-    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ProductComment" useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ProductComment" useGeneratedKeys="true"
+            keyProperty="id">
         insert into product_comment
         insert into product_comment
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-                <if test="id!= null" >
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id!= null">
                 id,
                 id,
             </if>
             </if>
-                <if test="delFlag!= null" >
+            <if test="delFlag!= null">
                 del_flag,
                 del_flag,
             </if>
             </if>
-                <if test="updateTime!= null" >
+            <if test="updateTime!= null">
                 update_time,
                 update_time,
             </if>
             </if>
-                <if test="updateUser!= null" >
+            <if test="updateUser!= null">
                 update_user,
                 update_user,
             </if>
             </if>
-                <if test="createTime!= null" >
+            <if test="createTime!= null">
                 create_time,
                 create_time,
             </if>
             </if>
-                <if test="createUser!= null" >
+            <if test="createUser!= null">
                 create_user,
                 create_user,
             </if>
             </if>
-                <if test="productId!= null" >
+            <if test="productId!= null">
                 product_id,
                 product_id,
             </if>
             </if>
-                <if test="orderId!= null" >
+            <if test="orderId!= null">
                 order_id,
                 order_id,
             </if>
             </if>
-                <if test="userId!= null" >
+            <if test="userId!= null">
                 user_id,
                 user_id,
             </if>
             </if>
-                <if test="storeId!= null" >
+            <if test="storeId!= null">
                 store_id,
                 store_id,
             </if>
             </if>
-                <if test="context!= null" >
+            <if test="context!= null">
                 context,
                 context,
             </if>
             </if>
-                <if test="starLevel!= null" >
+            <if test="starLevel!= null">
                 star_level,
                 star_level,
             </if>
             </if>
-                <if test="anonymous!= null" >
+            <if test="anonymous!= null">
                 anonymous,
                 anonymous,
             </if>
             </if>
-                <if test="typeFlag!= null" >
+            <if test="typeFlag!= null">
                 type_flag,
                 type_flag,
             </if>
             </if>
-            </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-                    <if test="id != null" >
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
                 #{id,jdbcType=INTEGER},
                 #{id,jdbcType=INTEGER},
             </if>
             </if>
-                    <if test="delFlag != null" >
+            <if test="delFlag != null">
                 #{delFlag,jdbcType=CHAR},
                 #{delFlag,jdbcType=CHAR},
             </if>
             </if>
-                    <if test="updateTime != null" >
+            <if test="updateTime != null">
                 #{updateTime,jdbcType=TIMESTAMP},
                 #{updateTime,jdbcType=TIMESTAMP},
             </if>
             </if>
-                    <if test="updateUser != null" >
+            <if test="updateUser != null">
                 #{updateUser,jdbcType=VARCHAR},
                 #{updateUser,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="createTime != null" >
+            <if test="createTime != null">
                 #{createTime,jdbcType=TIMESTAMP},
                 #{createTime,jdbcType=TIMESTAMP},
             </if>
             </if>
-                    <if test="createUser != null" >
+            <if test="createUser != null">
                 #{createUser,jdbcType=VARCHAR},
                 #{createUser,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="productId != null" >
+            <if test="productId != null">
                 #{productId,jdbcType=VARCHAR},
                 #{productId,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="orderId != null" >
+            <if test="orderId != null">
                 #{orderId,jdbcType=VARCHAR},
                 #{orderId,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="userId != null" >
+            <if test="userId != null">
                 #{userId,jdbcType=VARCHAR},
                 #{userId,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="storeId != null" >
+            <if test="storeId != null">
                 #{storeId,jdbcType=VARCHAR},
                 #{storeId,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="context != null" >
+            <if test="context != null">
                 #{context,jdbcType=VARCHAR},
                 #{context,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="starLevel != null" >
+            <if test="starLevel != null">
                 #{starLevel,jdbcType=VARCHAR},
                 #{starLevel,jdbcType=VARCHAR},
             </if>
             </if>
-                    <if test="anonymous != null" >
+            <if test="anonymous != null">
                 #{anonymous,jdbcType=CHAR},
                 #{anonymous,jdbcType=CHAR},
             </if>
             </if>
-                    <if test="typeFlag != null" >
+            <if test="typeFlag != null">
                 #{typeFlag,jdbcType=INTEGER},
                 #{typeFlag,jdbcType=INTEGER},
             </if>
             </if>
-                </trim>
+        </trim>
     </insert>
     </insert>
-    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.ProductComment" >
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.ProductComment">
         update product_comment
         update product_comment
-        <set >
-                    <if test="id != null" >
-               id= #{id,jdbcType=INTEGER},
+        <set>
+            <if test="id != null">
+                id= #{id,jdbcType=INTEGER},
             </if>
             </if>
-                     <if test="delFlag != null" >
-               del_flag= #{delFlag,jdbcType=CHAR},
+            <if test="delFlag != null">
+                del_flag= #{delFlag,jdbcType=CHAR},
             </if>
             </if>
-                     <if test="updateTime != null" >
-               update_time= #{updateTime,jdbcType=TIMESTAMP},
+            <if test="updateTime != null">
+                update_time= #{updateTime,jdbcType=TIMESTAMP},
             </if>
             </if>
-                     <if test="updateUser != null" >
-               update_user= #{updateUser,jdbcType=VARCHAR},
+            <if test="updateUser != null">
+                update_user= #{updateUser,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="createTime != null" >
-               create_time= #{createTime,jdbcType=TIMESTAMP},
+            <if test="createTime != null">
+                create_time= #{createTime,jdbcType=TIMESTAMP},
             </if>
             </if>
-                     <if test="createUser != null" >
-               create_user= #{createUser,jdbcType=VARCHAR},
+            <if test="createUser != null">
+                create_user= #{createUser,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="productId != null" >
-               product_id= #{productId,jdbcType=VARCHAR},
+            <if test="productId != null">
+                product_id= #{productId,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="orderId != null" >
-               order_id= #{orderId,jdbcType=VARCHAR},
+            <if test="orderId != null">
+                order_id= #{orderId,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="userId != null" >
-               user_id= #{userId,jdbcType=VARCHAR},
+            <if test="userId != null">
+                user_id= #{userId,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="storeId != null" >
-               store_id= #{storeId,jdbcType=VARCHAR},
+            <if test="storeId != null">
+                store_id= #{storeId,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="context != null" >
-               context= #{context,jdbcType=VARCHAR},
+            <if test="context != null">
+                context= #{context,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="starLevel != null" >
-               star_level= #{starLevel,jdbcType=VARCHAR},
+            <if test="starLevel != null">
+                star_level= #{starLevel,jdbcType=VARCHAR},
             </if>
             </if>
-                     <if test="anonymous != null" >
-               anonymous= #{anonymous,jdbcType=CHAR},
+            <if test="anonymous != null">
+                anonymous= #{anonymous,jdbcType=CHAR},
             </if>
             </if>
-                     <if test="typeFlag != null" >
-               type_flag= #{typeFlag,jdbcType=INTEGER},
+            <if test="typeFlag != null">
+                type_flag= #{typeFlag,jdbcType=INTEGER},
             </if>
             </if>
-                 </set>
+        </set>
         where id = #{id,jdbcType=INTEGER}
         where id = #{id,jdbcType=INTEGER}
     </update>
     </update>
-    <select id="queryProductCommentByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductComment">
-        select <include refid="Base_Column_List"/> from product_comment
+    <select id="queryProductCommentByPage" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.ProductComment">
+        select
+        <include refid="Base_Column_List"/>
+        from product_comment
         <where>
         <where>
             and del_flag = 'N'
             and del_flag = 'N'
-                    <if test="record.id != null and !&quot;&quot;.equals(record.id)">
-                and  id = #{record.id}
+            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
+                and id = #{record.id}
+            </if>
+            <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
+                and del_flag = #{record.delFlag}
             </if>
             </if>
-                     <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
-                and  del_flag = #{record.delFlag}
+            <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
+                and update_time = #{record.updateTime}
             </if>
             </if>
-                     <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
-                and  update_time = #{record.updateTime}
+            <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
+                and update_user = #{record.updateUser}
             </if>
             </if>
-                     <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
-                and  update_user = #{record.updateUser}
+            <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
+                and create_time = #{record.createTime}
             </if>
             </if>
-                     <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
-                and  create_time = #{record.createTime}
+            <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
+                and create_user = #{record.createUser}
             </if>
             </if>
-                     <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
-                and  create_user = #{record.createUser}
+            <if test="record.productId != null and !&quot;&quot;.equals(record.productId)">
+                and product_id = #{record.productId}
             </if>
             </if>
-                     <if test="record.productId != null and !&quot;&quot;.equals(record.productId)">
-                and  product_id = #{record.productId}
+            <if test="record.orderId != null and !&quot;&quot;.equals(record.orderId)">
+                and order_id = #{record.orderId}
             </if>
             </if>
-                     <if test="record.orderId != null and !&quot;&quot;.equals(record.orderId)">
-                and  order_id = #{record.orderId}
+            <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
+                and user_id = #{record.userId}
             </if>
             </if>
-                     <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
-                and  user_id = #{record.userId}
+            <if test="record.storeId != null and !&quot;&quot;.equals(record.storeId)">
+                and store_id = #{record.storeId}
             </if>
             </if>
-                     <if test="record.storeId != null and !&quot;&quot;.equals(record.storeId)">
-                and  store_id = #{record.storeId}
+            <if test="record.context != null and !&quot;&quot;.equals(record.context)">
+                and context = #{record.context}
             </if>
             </if>
-                     <if test="record.context != null and !&quot;&quot;.equals(record.context)">
-                and  context = #{record.context}
+            <if test="record.starLevel != null and !&quot;&quot;.equals(record.starLevel)">
+                and star_level = #{record.starLevel}
             </if>
             </if>
-                     <if test="record.starLevel != null and !&quot;&quot;.equals(record.starLevel)">
-                and  star_level = #{record.starLevel}
+            <if test="record.anonymous != null and !&quot;&quot;.equals(record.anonymous)">
+                and anonymous = #{record.anonymous}
             </if>
             </if>
-                     <if test="record.anonymous != null and !&quot;&quot;.equals(record.anonymous)">
-                and  anonymous = #{record.anonymous}
+            <if test="record.typeFlag != null and !&quot;&quot;.equals(record.typeFlag)">
+                and type_flag = #{record.typeFlag}
             </if>
             </if>
-                     <if test="record.typeFlag != null and !&quot;&quot;.equals(record.typeFlag)">
-                and  type_flag = #{record.typeFlag}
+            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR product_id LIKE concat('%',#{record.searchKey},'%')
+                    OR order_id LIKE concat('%',#{record.searchKey},'%')
+                    OR user_id LIKE concat('%',#{record.searchKey},'%')
+                    OR store_id LIKE concat('%',#{record.searchKey},'%')
+                    OR context LIKE concat('%',#{record.searchKey},'%')
+                    OR star_level LIKE concat('%',#{record.searchKey},'%')
+                    OR anonymous LIKE concat('%',#{record.searchKey},'%')
+                    OR type_flag LIKE concat('%',#{record.searchKey},'%')
+                </trim>
             </if>
             </if>
-                  <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
-             <trim prefix="and (" suffix=")" prefixOverrides="OR" >
-                                                                                                                                                                                                                                                                                                                                                                                                                                    OR  product_id LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  order_id LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  user_id LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  store_id LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  context LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  star_level LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  anonymous LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  type_flag LIKE concat('%',#{record.searchKey},'%')
-                                                             </trim>
-         </if>
 
 
             <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
             <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
                 <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
                 <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
@@ -309,98 +313,101 @@
         </if>
         </if>
         id desc
         id desc
     </select>
     </select>
-    <select id="queryAllProductComment" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductComment">
-        select <include refid="Base_Column_List"/> from product_comment
+    <select id="queryAllProductComment" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.ProductComment">
+        select
+        <include refid="Base_Column_List"/>
+        from product_comment
         <where>
         <where>
             and del_flag = 'N'
             and del_flag = 'N'
-                    <if test="id != null and !&quot;&quot;.equals(id)">
-                and  id = #{id}
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
             </if>
             </if>
-                    <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
-                and  del_flag = #{delFlag}
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
             </if>
             </if>
-                    <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
-                and  update_time = #{updateTime}
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
             </if>
             </if>
-                    <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
-                and  update_user = #{updateUser}
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
             </if>
             </if>
-                    <if test="createTime != null and !&quot;&quot;.equals(createTime)">
-                and  create_time = #{createTime}
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
             </if>
             </if>
-                    <if test="createUser != null and !&quot;&quot;.equals(createUser)">
-                and  create_user = #{createUser}
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
             </if>
             </if>
-                    <if test="productId != null and !&quot;&quot;.equals(productId)">
-                and  product_id = #{productId}
+            <if test="productId != null and !&quot;&quot;.equals(productId)">
+                and product_id = #{productId}
             </if>
             </if>
-                    <if test="orderId != null and !&quot;&quot;.equals(orderId)">
-                and  order_id = #{orderId}
+            <if test="orderId != null and !&quot;&quot;.equals(orderId)">
+                and order_id = #{orderId}
             </if>
             </if>
-                    <if test="userId != null and !&quot;&quot;.equals(userId)">
-                and  user_id = #{userId}
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                and user_id = #{userId}
             </if>
             </if>
-                    <if test="storeId != null and !&quot;&quot;.equals(storeId)">
-                and  store_id = #{storeId}
+            <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+                and store_id = #{storeId}
             </if>
             </if>
-                    <if test="context != null and !&quot;&quot;.equals(context)">
-                and  context = #{context}
+            <if test="context != null and !&quot;&quot;.equals(context)">
+                and context = #{context}
             </if>
             </if>
-                    <if test="starLevel != null and !&quot;&quot;.equals(starLevel)">
-                and  star_level = #{starLevel}
+            <if test="starLevel != null and !&quot;&quot;.equals(starLevel)">
+                and star_level = #{starLevel}
             </if>
             </if>
-                    <if test="anonymous != null and !&quot;&quot;.equals(anonymous)">
-                and  anonymous = #{anonymous}
+            <if test="anonymous != null and !&quot;&quot;.equals(anonymous)">
+                and anonymous = #{anonymous}
             </if>
             </if>
-                    <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
-                and  type_flag = #{typeFlag}
+            <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+                and type_flag = #{typeFlag}
             </if>
             </if>
-                    <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
-                <trim prefix="and (" suffix=")" prefixOverrides="OR" >
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                OR  product_id LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  order_id LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  user_id LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  store_id LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  context LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  star_level LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  anonymous LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  type_flag LIKE concat('%',#{searchKey},'%')
-                                                                                        </trim>
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR product_id LIKE concat('%',#{searchKey},'%')
+                    OR order_id LIKE concat('%',#{searchKey},'%')
+                    OR user_id LIKE concat('%',#{searchKey},'%')
+                    OR store_id LIKE concat('%',#{searchKey},'%')
+                    OR context LIKE concat('%',#{searchKey},'%')
+                    OR star_level LIKE concat('%',#{searchKey},'%')
+                    OR anonymous LIKE concat('%',#{searchKey},'%')
+                    OR type_flag LIKE concat('%',#{searchKey},'%')
+                </trim>
             </if>
             </if>
-<if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
-    <foreach item="item" index="index" collection="advancedQuery.split('_;')">
-        <choose>
-            <when test="item.indexOf('like') != -1">
-                <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
-                    <if test="detailIndex == 3">
-                        concat('%',#{itemDetail},'%')
-                    </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
 
 
-                    <if test="detailIndex &lt; 3">
-                        ${itemDetail}
-                    </if>
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
 
 
-                </foreach>
-            </when>
-            <otherwise>
-                <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
-                    <if test="detailIndex == 3">
-                        #{itemDetail}
-                    </if>
-
-                    <if test="detailIndex &lt; 3">
-                        ${itemDetail}
-                    </if>
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
 
 
-                </foreach>
-            </otherwise>
-        </choose>
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
 
 
+                            </foreach>
+                        </otherwise>
+                    </choose>
 
 
-    </foreach>
+
+                </foreach>
 
 
 
 
-</if>
+            </if>
         </where>
         </where>
         order by
         order by
 
 
@@ -419,53 +426,106 @@
 
 
         id desc
         id desc
     </select>
     </select>
-    <select id="queryProductComment" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductComment">
-        select <include refid="Base_Column_List"/> from product_comment
+    <select id="queryProductComment" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.ProductComment">
+        select
+        <include refid="Base_Column_List"/>
+        from product_comment
         <where>
         <where>
             and del_flag = 'N'
             and del_flag = 'N'
-                    <if test="id != null and !&quot;&quot;.equals(id)">
+            <if test="id != null and !&quot;&quot;.equals(id)">
                 and id = #{id}
                 and id = #{id}
             </if>
             </if>
-                     <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                 and del_flag = #{delFlag}
                 and del_flag = #{delFlag}
             </if>
             </if>
-                     <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
                 and update_time = #{updateTime}
                 and update_time = #{updateTime}
             </if>
             </if>
-                     <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
                 and update_user = #{updateUser}
                 and update_user = #{updateUser}
             </if>
             </if>
-                     <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
                 and create_time = #{createTime}
                 and create_time = #{createTime}
             </if>
             </if>
-                     <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
                 and create_user = #{createUser}
                 and create_user = #{createUser}
             </if>
             </if>
-                     <if test="productId != null and !&quot;&quot;.equals(productId)">
+            <if test="productId != null and !&quot;&quot;.equals(productId)">
                 and product_id = #{productId}
                 and product_id = #{productId}
             </if>
             </if>
-                     <if test="orderId != null and !&quot;&quot;.equals(orderId)">
+            <if test="orderId != null and !&quot;&quot;.equals(orderId)">
                 and order_id = #{orderId}
                 and order_id = #{orderId}
             </if>
             </if>
-                     <if test="userId != null and !&quot;&quot;.equals(userId)">
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
                 and user_id = #{userId}
                 and user_id = #{userId}
             </if>
             </if>
-                     <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+            <if test="storeId != null and !&quot;&quot;.equals(storeId)">
                 and store_id = #{storeId}
                 and store_id = #{storeId}
             </if>
             </if>
-                     <if test="context != null and !&quot;&quot;.equals(context)">
+            <if test="context != null and !&quot;&quot;.equals(context)">
                 and context = #{context}
                 and context = #{context}
             </if>
             </if>
-                     <if test="starLevel != null and !&quot;&quot;.equals(starLevel)">
+            <if test="starLevel != null and !&quot;&quot;.equals(starLevel)">
                 and star_level = #{starLevel}
                 and star_level = #{starLevel}
             </if>
             </if>
-                     <if test="anonymous != null and !&quot;&quot;.equals(anonymous)">
+            <if test="anonymous != null and !&quot;&quot;.equals(anonymous)">
                 and anonymous = #{anonymous}
                 and anonymous = #{anonymous}
             </if>
             </if>
-                     <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+            <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
                 and type_flag = #{typeFlag}
                 and type_flag = #{typeFlag}
             </if>
             </if>
-         
+
+        </where>
+        LIMIT 1
+    </select>
+    <select id="getCount" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductComment">
+        select count(1) commentCount, AVG(star_level) AS star_level from product_comment
+        <where>
+            and del_flag = 'N'
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="productId != null and !&quot;&quot;.equals(productId)">
+                and product_id = #{productId}
+            </if>
+            <if test="orderId != null and !&quot;&quot;.equals(orderId)">
+                and order_id = #{orderId}
+            </if>
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                and user_id = #{userId}
+            </if>
+            <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+                and store_id = #{storeId}
+            </if>
+            <if test="context != null and !&quot;&quot;.equals(context)">
+                and context = #{context}
+            </if>
+            <if test="starLevel != null and !&quot;&quot;.equals(starLevel)">
+                and star_level = #{starLevel}
+            </if>
+            <if test="anonymous != null and !&quot;&quot;.equals(anonymous)">
+                and anonymous = #{anonymous}
+            </if>
+            <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+                and type_flag = #{typeFlag}
+            </if>
+
         </where>
         </where>
         LIMIT 1
         LIMIT 1
     </select>
     </select>
@@ -476,11 +536,25 @@
         </where>
         </where>
     </update>
     </update>
     <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductComment">
     <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductComment">
-        select <include refid="Base_Column_List"/> from product_comment
+        select
+        <include refid="Base_Column_List"/>
+        from product_comment
         <where>
         <where>
             and del_flag = 'N'
             and del_flag = 'N'
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </where>
+        </where>
         order by id desc
         order by id desc
     </select>
     </select>
+
+    <resultMap id="AllInfoForGetOne" type="com.izouma.awesomeadmin.model.ProductComment" extends="BaseResultMap">
+
+
+        <collection property="productCommentImageList"
+                    ofType="com.izouma.awesomeadmin.model.ProductCommentImage"
+                    select="com.izouma.awesomeadmin.dao.ProductCommentImageMapper.queryAllProductCommentImage"
+                    column="{ productId = id }"/>
+
+
+    </resultMap>
+
 </mapper>
 </mapper>
 
 

+ 2 - 2
src/main/java/com/izouma/awesomeadmin/dao/ProductImageMapper.xml

@@ -258,7 +258,7 @@
             </trim>
             </trim>
             ,
             ,
         </if>
         </if>
-        id desc
+        rank desc, id desc
     </select>
     </select>
     <select id="queryAllProductImage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductImage">
     <select id="queryAllProductImage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductImage">
         select <include refid="Base_Column_List"/> from product_image
         select <include refid="Base_Column_List"/> from product_image
@@ -355,7 +355,7 @@
             ,
             ,
         </if>
         </if>
 
 
-        id desc
+        rank desc,id desc
     </select>
     </select>
     <select id="queryProductImage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductImage">
     <select id="queryProductImage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductImage">
         select <include refid="Base_Column_List"/> from product_image
         select <include refid="Base_Column_List"/> from product_image

+ 20 - 4
src/main/java/com/izouma/awesomeadmin/dao/ProductInfoMapper.xml

@@ -209,7 +209,7 @@
             <if test="salesVolume != null">
             <if test="salesVolume != null">
                 #{salesVolume,jdbcType=INTEGER},
                 #{salesVolume,jdbcType=INTEGER},
             </if>
             </if>
-            <if test="price != null" >
+            <if test="price != null">
                 #{price,jdbcType=DECIMAL},
                 #{price,jdbcType=DECIMAL},
             </if>
             </if>
         </trim>
         </trim>
@@ -277,7 +277,7 @@
             <if test="salesVolume != null">
             <if test="salesVolume != null">
                 sales_volume= #{salesVolume,jdbcType=INTEGER},
                 sales_volume= #{salesVolume,jdbcType=INTEGER},
             </if>
             </if>
-            <if test="price != null" >
+            <if test="price != null">
                 price= #{price,jdbcType=DECIMAL},
                 price= #{price,jdbcType=DECIMAL},
             </if>
             </if>
         </set>
         </set>
@@ -418,7 +418,7 @@
             </trim>
             </trim>
             ,
             ,
         </if>
         </if>
-       rank desc, id desc
+        rank desc, id desc
     </select>
     </select>
     <select id="queryAllProductInfo" parameterType="java.util.Map"
     <select id="queryAllProductInfo" parameterType="java.util.Map"
             resultType="com.izouma.awesomeadmin.model.ProductInfo">
             resultType="com.izouma.awesomeadmin.model.ProductInfo">
@@ -556,7 +556,7 @@
 
 
         rank desc, id desc
         rank desc, id desc
     </select>
     </select>
-    <select id="queryProductInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductInfo">
+    <select id="queryProductInfo" parameterType="java.util.Map" resultMap="AllInfoForGetOne">
         select
         select
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
         from product_info
         from product_info
@@ -641,5 +641,21 @@
         </where>
         </where>
         order by id desc
         order by id desc
     </select>
     </select>
+
+    <resultMap id="AllInfoForGetOne" type="com.izouma.awesomeadmin.model.ProductInfo" extends="BaseResultMap">
+
+
+        <collection property="productImageList"
+                    ofType="com.izouma.awesomeadmin.model.ProductImage"
+                    select="com.izouma.awesomeadmin.dao.ProductImageMapper.queryAllProductImage"
+                    column="{ productId = id }"/>
+
+        <collection property="productPriceList"
+                    ofType="com.izouma.awesomeadmin.model.ProductPrice"
+                    select="com.izouma.awesomeadmin.dao.ProductPriceMapper.queryAllProductPrice"
+                    column="{ productId = id }"/>
+
+    </resultMap>
+
 </mapper>
 </mapper>
 
 

+ 90 - 56
src/main/java/com/izouma/awesomeadmin/model/ProductComment.java

@@ -1,13 +1,14 @@
 package com.izouma.awesomeadmin.model;
 package com.izouma.awesomeadmin.model;
 
 
 import java.util.*;
 import java.util.*;
+
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude;
 
 
 
 
 @JsonAutoDetect
 @JsonAutoDetect
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @JsonInclude(JsonInclude.Include.NON_NULL)
-public class ProductComment{
+public class ProductComment {
     private Integer id;
     private Integer id;
     private String delFlag;
     private String delFlag;
     private Date updateTime;
     private Date updateTime;
@@ -23,140 +24,173 @@ public class ProductComment{
     private String anonymous;
     private String anonymous;
     private Integer typeFlag;
     private Integer typeFlag;
 
 
-private String searchKey;
+    private Integer commentCount;
+
+    private List<ProductCommentImage> productCommentImageList;
+
 
 
-/**
-* and,test_name,like,value;or,remark,=,123
-*/
-private String advancedQuery;
+    private String searchKey;
 
 
-/**
-* column_name_,desc_;column_name_,asc
-*/
-private String orderByStr;
+    /**
+     * and,test_name,like,value;or,remark,=,123
+     */
+    private String advancedQuery;
 
 
-    public Integer getId(){
+    /**
+     * column_name_,desc_;column_name_,asc
+     */
+    private String orderByStr;
+
+    public Integer getId() {
         return this.id;
         return this.id;
     }
     }
 
 
-    public void setId(Integer id){
+    public void setId(Integer id) {
         this.id = id;
         this.id = id;
     }
     }
-    public String getDelFlag(){
+
+    public String getDelFlag() {
         return this.delFlag;
         return this.delFlag;
     }
     }
 
 
-    public void setDelFlag(String delFlag){
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
         this.delFlag = delFlag;
     }
     }
-    public Date getUpdateTime(){
+
+    public Date getUpdateTime() {
         return this.updateTime;
         return this.updateTime;
     }
     }
 
 
-    public void setUpdateTime(Date updateTime){
+    public void setUpdateTime(Date updateTime) {
         this.updateTime = updateTime;
         this.updateTime = updateTime;
     }
     }
-    public String getUpdateUser(){
+
+    public String getUpdateUser() {
         return this.updateUser;
         return this.updateUser;
     }
     }
 
 
-    public void setUpdateUser(String updateUser){
+    public void setUpdateUser(String updateUser) {
         this.updateUser = updateUser;
         this.updateUser = updateUser;
     }
     }
-    public Date getCreateTime(){
+
+    public Date getCreateTime() {
         return this.createTime;
         return this.createTime;
     }
     }
 
 
-    public void setCreateTime(Date createTime){
+    public void setCreateTime(Date createTime) {
         this.createTime = createTime;
         this.createTime = createTime;
     }
     }
-    public String getCreateUser(){
+
+    public String getCreateUser() {
         return this.createUser;
         return this.createUser;
     }
     }
 
 
-    public void setCreateUser(String createUser){
+    public void setCreateUser(String createUser) {
         this.createUser = createUser;
         this.createUser = createUser;
     }
     }
-    public String getProductId(){
+
+    public String getProductId() {
         return this.productId;
         return this.productId;
     }
     }
 
 
-    public void setProductId(String productId){
+    public void setProductId(String productId) {
         this.productId = productId;
         this.productId = productId;
     }
     }
-    public String getOrderId(){
+
+    public String getOrderId() {
         return this.orderId;
         return this.orderId;
     }
     }
 
 
-    public void setOrderId(String orderId){
+    public void setOrderId(String orderId) {
         this.orderId = orderId;
         this.orderId = orderId;
     }
     }
-    public String getUserId(){
+
+    public String getUserId() {
         return this.userId;
         return this.userId;
     }
     }
 
 
-    public void setUserId(String userId){
+    public void setUserId(String userId) {
         this.userId = userId;
         this.userId = userId;
     }
     }
-    public String getStoreId(){
+
+    public String getStoreId() {
         return this.storeId;
         return this.storeId;
     }
     }
 
 
-    public void setStoreId(String storeId){
+    public void setStoreId(String storeId) {
         this.storeId = storeId;
         this.storeId = storeId;
     }
     }
-    public String getContext(){
+
+    public String getContext() {
         return this.context;
         return this.context;
     }
     }
 
 
-    public void setContext(String context){
+    public void setContext(String context) {
         this.context = context;
         this.context = context;
     }
     }
-    public String getStarLevel(){
+
+    public String getStarLevel() {
         return this.starLevel;
         return this.starLevel;
     }
     }
 
 
-    public void setStarLevel(String starLevel){
+    public void setStarLevel(String starLevel) {
         this.starLevel = starLevel;
         this.starLevel = starLevel;
     }
     }
-    public String getAnonymous(){
+
+    public String getAnonymous() {
         return this.anonymous;
         return this.anonymous;
     }
     }
 
 
-    public void setAnonymous(String anonymous){
+    public void setAnonymous(String anonymous) {
         this.anonymous = anonymous;
         this.anonymous = anonymous;
     }
     }
-    public Integer getTypeFlag(){
+
+    public Integer getTypeFlag() {
         return this.typeFlag;
         return this.typeFlag;
     }
     }
 
 
-    public void setTypeFlag(Integer typeFlag){
+    public void setTypeFlag(Integer typeFlag) {
         this.typeFlag = typeFlag;
         this.typeFlag = typeFlag;
     }
     }
 
 
-public String getSearchKey() {
-    return searchKey;
-}
+    public String getSearchKey() {
+        return searchKey;
+    }
 
 
-public void setSearchKey(String searchKey) {
-    this.searchKey = searchKey;
-}
+    public void setSearchKey(String searchKey) {
+        this.searchKey = searchKey;
+    }
 
 
-public String getAdvancedQuery() {
-    return advancedQuery;
-}
+    public String getAdvancedQuery() {
+        return advancedQuery;
+    }
 
 
-public void setAdvancedQuery(String advancedQuery) {
-    this.advancedQuery = advancedQuery;
-}
+    public void setAdvancedQuery(String advancedQuery) {
+        this.advancedQuery = advancedQuery;
+    }
 
 
-public String getOrderByStr() {
-    return orderByStr;
-}
+    public String getOrderByStr() {
+        return orderByStr;
+    }
 
 
-public void setOrderByStr(String orderByStr) {
-    this.orderByStr = orderByStr;
-}
+    public void setOrderByStr(String orderByStr) {
+        this.orderByStr = orderByStr;
+    }
 
 
+    public Integer getCommentCount() {
+        return commentCount;
+    }
+
+    public void setCommentCount(Integer commentCount) {
+        this.commentCount = commentCount;
+    }
+
+    public List<ProductCommentImage> getProductCommentImageList() {
+        return productCommentImageList;
+    }
+
+    public void setProductCommentImageList(List<ProductCommentImage> productCommentImageList) {
+        this.productCommentImageList = productCommentImageList;
+    }
 }
 }
 
 

+ 20 - 0
src/main/java/com/izouma/awesomeadmin/model/ProductInfo.java

@@ -32,6 +32,10 @@ public class ProductInfo {
     private Integer salesVolume;
     private Integer salesVolume;
     private BigDecimal price;
     private BigDecimal price;
 
 
+    private List<ProductImage> productImageList;
+
+    private List<ProductPrice> productPriceList;
+
     private String searchKey;
     private String searchKey;
 
 
     /**
     /**
@@ -235,5 +239,21 @@ public class ProductInfo {
     public void setPrice(BigDecimal price) {
     public void setPrice(BigDecimal price) {
         this.price = price;
         this.price = price;
     }
     }
+
+    public List<ProductImage> getProductImageList() {
+        return productImageList;
+    }
+
+    public void setProductImageList(List<ProductImage> productImageList) {
+        this.productImageList = productImageList;
+    }
+
+    public List<ProductPrice> getProductPriceList() {
+        return productPriceList;
+    }
+
+    public void setProductPriceList(List<ProductPrice> productPriceList) {
+        this.productPriceList = productPriceList;
+    }
 }
 }
 
 

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/service/ProductCommentService.java

@@ -23,5 +23,7 @@ public interface ProductCommentService{
     boolean deleteProductComment(String id);
     boolean deleteProductComment(String id);
 
 
     boolean updateProductComment(ProductComment record);
     boolean updateProductComment(ProductComment record);
+
+    ProductComment getCount(ProductComment record);
 }
 }
 
 

+ 34 - 18
src/main/java/com/izouma/awesomeadmin/service/impl/ProductCommentServiceImpl.java

@@ -1,6 +1,7 @@
 package com.izouma.awesomeadmin.service.impl;
 package com.izouma.awesomeadmin.service.impl;
 
 
 import java.util.*;
 import java.util.*;
+
 import org.apache.log4j.Logger;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -11,10 +12,10 @@ import com.izouma.awesomeadmin.service.ProductCommentService;
 import com.izouma.awesomeadmin.dao.ProductCommentMapper;
 import com.izouma.awesomeadmin.dao.ProductCommentMapper;
 
 
 /**
 /**
-*  service接口实现类
-*/
+ * service接口实现类
+ */
 @Service
 @Service
-public class ProductCommentServiceImpl implements ProductCommentService{
+public class ProductCommentServiceImpl implements ProductCommentService {
 
 
     private static Logger logger = Logger.getLogger(ProductCommentServiceImpl.class);
     private static Logger logger = Logger.getLogger(ProductCommentServiceImpl.class);
 
 
@@ -27,26 +28,27 @@ public class ProductCommentServiceImpl implements ProductCommentService{
         logger.info("getProductCommentList");
         logger.info("getProductCommentList");
         try {
         try {
 
 
-        return productCommentMapper.queryAllProductComment(record);
+            return productCommentMapper.queryAllProductComment(record);
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getProductCommentList", e);
+            logger.error("getProductCommentList", e);
         }
         }
 
 
         return null;
         return null;
     }
     }
+
     @Override
     @Override
     public List<ProductComment> getProductCommentByPage(Page page, ProductComment record) {
     public List<ProductComment> getProductCommentByPage(Page page, ProductComment record) {
 
 
         logger.info("getProductCommentByPage");
         logger.info("getProductCommentByPage");
         try {
         try {
 
 
-        Map<String, Object> parameter = new HashMap<String, Object>();
-        parameter.put("record", record);
-        parameter.put(AppConstant.PAGE, page);
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
 
 
-        return productCommentMapper.queryProductCommentByPage(parameter);
+            return productCommentMapper.queryProductCommentByPage(parameter);
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getProductCommentByPage", e);
+            logger.error("getProductCommentByPage", e);
         }
         }
 
 
         return null;
         return null;
@@ -60,7 +62,7 @@ public class ProductCommentServiceImpl implements ProductCommentService{
 
 
             return productCommentMapper.selectByPrimaryKey(Integer.valueOf(id));
             return productCommentMapper.selectByPrimaryKey(Integer.valueOf(id));
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getProductCommentById", e);
+            logger.error("getProductCommentById", e);
         }
         }
 
 
         return null;
         return null;
@@ -74,7 +76,21 @@ public class ProductCommentServiceImpl implements ProductCommentService{
 
 
             return productCommentMapper.queryProductComment(record);
             return productCommentMapper.queryProductComment(record);
         } catch (Exception e) {
         } catch (Exception e) {
-        logger.error("getProductComment", e);
+            logger.error("getProductComment", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public ProductComment getCount(ProductComment record) {
+
+        logger.info("getCount");
+        try {
+
+            return productCommentMapper.getCount(record);
+        } catch (Exception e) {
+            logger.error("getCount", e);
         }
         }
 
 
         return null;
         return null;
@@ -89,7 +105,7 @@ public class ProductCommentServiceImpl implements ProductCommentService{
             int updates = productCommentMapper.insertSelective(record);
             int updates = productCommentMapper.insertSelective(record);
 
 
             if (updates > 0) {
             if (updates > 0) {
-                 return true;
+                return true;
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             logger.error("createProductComment", e);
             logger.error("createProductComment", e);
@@ -104,13 +120,13 @@ public class ProductCommentServiceImpl implements ProductCommentService{
         logger.info("deleteProductComment");
         logger.info("deleteProductComment");
         try {
         try {
 
 
-             int updates = productCommentMapper.delete(id);
+            int updates = productCommentMapper.delete(id);
 
 
             if (updates > 0) {
             if (updates > 0) {
-                 return true;
+                return true;
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-             logger.error("deleteProductComment", e);
+            logger.error("deleteProductComment", e);
         }
         }
 
 
         return false;
         return false;
@@ -125,10 +141,10 @@ public class ProductCommentServiceImpl implements ProductCommentService{
             int updates = productCommentMapper.updateByPrimaryKeySelective(record);
             int updates = productCommentMapper.updateByPrimaryKeySelective(record);
 
 
             if (updates > 0) {
             if (updates > 0) {
-                 return true;
+                return true;
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-             logger.error("updateProductComment", e);
+            logger.error("updateProductComment", e);
         }
         }
 
 
         return false;
         return false;

+ 71 - 54
src/main/java/com/izouma/awesomeadmin/web/ProductCommentController.java

@@ -1,25 +1,28 @@
 package com.izouma.awesomeadmin.web;
 package com.izouma.awesomeadmin.web;
 
 
-import java.util.*;
-
-import com.izouma.awesomeadmin.util.ExportExcelUtil;
-import org.apache.commons.lang.StringUtils;
-import org.apache.shiro.authz.annotation.RequiresAuthentication;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
 import com.izouma.awesomeadmin.constant.AppConstant;
 import com.izouma.awesomeadmin.constant.AppConstant;
 import com.izouma.awesomeadmin.dto.Page;
 import com.izouma.awesomeadmin.dto.Page;
 import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.ProductComment;
 import com.izouma.awesomeadmin.model.ProductComment;
 import com.izouma.awesomeadmin.service.ProductCommentService;
 import com.izouma.awesomeadmin.service.ProductCommentService;
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
-*  controller类
-*/
+ * controller类
+ */
 @Controller
 @Controller
 @RequestMapping("/productComment")
 @RequestMapping("/productComment")
 public class ProductCommentController {
 public class ProductCommentController {
@@ -28,8 +31,8 @@ public class ProductCommentController {
     private ProductCommentService productCommentService;
     private ProductCommentService productCommentService;
 
 
     /**
     /**
-    * <p>获取全部记录。</p>
-    */
+     * <p>获取全部记录。</p>
+     */
     @RequiresAuthentication
     @RequiresAuthentication
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
     @ResponseBody
@@ -39,8 +42,8 @@ public class ProductCommentController {
     }
     }
 
 
     /**
     /**
-    * <p>根据Id。</p>
-    */
+     * <p>根据Id。</p>
+     */
     @RequestMapping(value = "/getProductComment", method = RequestMethod.GET)
     @RequestMapping(value = "/getProductComment", method = RequestMethod.GET)
     @ResponseBody
     @ResponseBody
     public Result getProductComment(@RequestParam(required = false, value = "id") String id) {
     public Result getProductComment(@RequestParam(required = false, value = "id") String id) {
@@ -49,8 +52,8 @@ public class ProductCommentController {
     }
     }
 
 
     /**
     /**
-    * <p>根据条件获取。</p>
-    */
+     * <p>根据条件获取。</p>
+     */
     @RequestMapping(value = "/getOne", method = RequestMethod.GET)
     @RequestMapping(value = "/getOne", method = RequestMethod.GET)
     @ResponseBody
     @ResponseBody
     public Result getOne(ProductComment record) {
     public Result getOne(ProductComment record) {
@@ -60,14 +63,14 @@ public class ProductCommentController {
 
 
 
 
     /**
     /**
-    * <p>分页查询。</p>
-    */
+     * <p>分页查询。</p>
+     */
     @RequestMapping(value = "/page", method = RequestMethod.GET)
     @RequestMapping(value = "/page", method = RequestMethod.GET)
     @ResponseBody
     @ResponseBody
     public Result page(Page page, ProductComment record) {
     public Result page(Page page, ProductComment record) {
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> result = new HashMap<>();
 
 
-        List<ProductComment> pp =productCommentService.getProductCommentByPage(page, record);
+        List<ProductComment> pp = productCommentService.getProductCommentByPage(page, record);
 
 
         result.put(AppConstant.PAGE, page);
         result.put(AppConstant.PAGE, page);
         result.put("pp", pp);
         result.put("pp", pp);
@@ -76,90 +79,104 @@ public class ProductCommentController {
 
 
 
 
     /**
     /**
-    * <p>保存。</p>
-    */
+     * <p>保存。</p>
+     */
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ResponseBody
     @ResponseBody
     public Result save(ProductComment record) {
     public Result save(ProductComment record) {
         boolean num = productCommentService.createProductComment(record);
         boolean num = productCommentService.createProductComment(record);
         if (num) {
         if (num) {
-        return new Result(true, record.getId());
+            return new Result(true, record.getId());
         }
         }
         return new Result(false, "保存异常");
         return new Result(false, "保存异常");
     }
     }
 
 
     /**
     /**
-    * <p>更新信息。</p>
-    */
+     * <p>更新信息。</p>
+     */
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ResponseBody
     @ResponseBody
     public Result updateProductComment(ProductComment record) {
     public Result updateProductComment(ProductComment record) {
         boolean num = productCommentService.updateProductComment(record);
         boolean num = productCommentService.updateProductComment(record);
         if (num) {
         if (num) {
-        return new Result(true, "保存成功");
+            return new Result(true, "保存成功");
         }
         }
         return new Result(false, "保存异常");
         return new Result(false, "保存异常");
     }
     }
 
 
     /**
     /**
-    * <p>删除。</p>
-    */
+     * <p>删除。</p>
+     */
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @ResponseBody
     @ResponseBody
     public Result deleteProductComment(@RequestParam(required = true, value = "id") String id) {
     public Result deleteProductComment(@RequestParam(required = true, value = "id") String id) {
 
 
         boolean num = productCommentService.deleteProductComment(id);
         boolean num = productCommentService.deleteProductComment(id);
         if (num) {
         if (num) {
-        return new Result(true, "删除成功");
+            return new Result(true, "删除成功");
         }
         }
         return new Result(false, "删除异常");
         return new Result(false, "删除异常");
     }
     }
 
 
     /**
     /**
-    * 导出Excel
-    * @param request
-    * @param response
-    * @param record
-    * @throws Exception
-    */
+     * 导出Excel
+     *
+     * @param request
+     * @param response
+     * @param record
+     * @throws Exception
+     */
     @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
     @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
     @ResponseBody
     @ResponseBody
     public void exportExcel(HttpServletRequest request, HttpServletResponse response, ProductComment record) throws Exception {
     public void exportExcel(HttpServletRequest request, HttpServletResponse response, ProductComment record) throws Exception {
 
 
-    List<ProductComment> productComments = productCommentService.getProductCommentList(record);
+        List<ProductComment> productComments = productCommentService.getProductCommentList(record);
 
 
 
 
         String sheetName = "product_comment";
         String sheetName = "product_comment";
         String titleName = "商品评论数据表";
         String titleName = "商品评论数据表";
         String fileName = "商品评论表";
         String fileName = "商品评论表";
         int columnNumber = 14;
         int columnNumber = 14;
-        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
-        String[] columnName = {  "" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "商品" ,   "订单" ,   "用户" ,   "店铺" ,   "评论" ,   "星级" ,   "匿名" ,   "类型"  };
+        int[] columnWidth = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
+        String[] columnName = {"", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "商品", "订单", "用户", "店铺", "评论", "星级", "匿名", "类型"};
         String[][] dataList = new String[productComments.size()][14];
         String[][] dataList = new String[productComments.size()][14];
 
 
         for (int i = 0; i < productComments.size(); i++) {
         for (int i = 0; i < productComments.size(); i++) {
 
 
-                        dataList[i][0] = String.valueOf(productComments.get(i).getId());
-                        dataList[i][1] = String.valueOf(productComments.get(i).getDelFlag());
-                        dataList[i][2] = String.valueOf(productComments.get(i).getUpdateTime());
-                        dataList[i][3] = String.valueOf(productComments.get(i).getUpdateUser());
-                        dataList[i][4] = String.valueOf(productComments.get(i).getCreateTime());
-                        dataList[i][5] = String.valueOf(productComments.get(i).getCreateUser());
-                        dataList[i][6] = String.valueOf(productComments.get(i).getProductId());
-                        dataList[i][7] = String.valueOf(productComments.get(i).getOrderId());
-                        dataList[i][8] = String.valueOf(productComments.get(i).getUserId());
-                        dataList[i][9] = String.valueOf(productComments.get(i).getStoreId());
-                        dataList[i][10] = String.valueOf(productComments.get(i).getContext());
-                        dataList[i][11] = String.valueOf(productComments.get(i).getStarLevel());
-                        dataList[i][12] = String.valueOf(productComments.get(i).getAnonymous());
-                        dataList[i][13] = String.valueOf(productComments.get(i).getTypeFlag());
-                    }
+            dataList[i][0] = String.valueOf(productComments.get(i).getId());
+            dataList[i][1] = String.valueOf(productComments.get(i).getDelFlag());
+            dataList[i][2] = String.valueOf(productComments.get(i).getUpdateTime());
+            dataList[i][3] = String.valueOf(productComments.get(i).getUpdateUser());
+            dataList[i][4] = String.valueOf(productComments.get(i).getCreateTime());
+            dataList[i][5] = String.valueOf(productComments.get(i).getCreateUser());
+            dataList[i][6] = String.valueOf(productComments.get(i).getProductId());
+            dataList[i][7] = String.valueOf(productComments.get(i).getOrderId());
+            dataList[i][8] = String.valueOf(productComments.get(i).getUserId());
+            dataList[i][9] = String.valueOf(productComments.get(i).getStoreId());
+            dataList[i][10] = String.valueOf(productComments.get(i).getContext());
+            dataList[i][11] = String.valueOf(productComments.get(i).getStarLevel());
+            dataList[i][12] = String.valueOf(productComments.get(i).getAnonymous());
+            dataList[i][13] = String.valueOf(productComments.get(i).getTypeFlag());
+        }
 
 
 
 
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
-        columnNumber, columnWidth, columnName, dataList, response);
+                columnNumber, columnWidth, columnName, dataList, response);
 
 
 
 
-        }
     }
     }
 
 
+    /**
+     * 获取评论数和星级
+     *
+     * @param record
+     * @return
+     */
+    @RequestMapping(value = "/count", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getCount(ProductComment record) {
+        ProductComment data = productCommentService.getCount(record);
+        return new Result(true, data);
+    }
+}
+