zouxuan há 4 anos atrás
pai
commit
5e68b2caa8
1 ficheiros alterados com 10 adições e 11 exclusões
  1. 10 11
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

+ 10 - 11
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -154,33 +154,32 @@
         ORDER BY g.id_
         <include refid="global.limit"/>
     </select>
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*) FROM goods g
+        <include refid="queryGoodsPageSql"/>
+    </select>
 
     <sql id="queryGoodsPageSql">
         <where>
             <if test="goodsCategoryId != null">
-                g.goods_category_id_ = #{goodsCategoryId}
+                AND g.goods_category_id_ = #{goodsCategoryId}
             </if>
             <if test="type != null">
-                g.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+                AND g.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
             <if test="isNew != null">
-                g.is_new_ = #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+                AND g.is_new_ = #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
             <if test="isTop != null">
-                g.is_top_ = #{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+                AND g.is_top_ = #{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
             <if test="status != null">
-                g.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+                AND g.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
         </where>
     </sql>
 
-    <!-- 查询当前表的总记录数 -->
-    <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM goods g
-        <include refid="queryGoodsPageSql"/>
-	</select>
-
     <select id="findGoodsBySubId" resultMap="Goods">
         SELECT g.* FROM subject_goods_mapper sgm
         LEFT JOIN goods g ON sgm.goods_category_id_ = g.goods_category_id_