فهرست منبع

增加排序字段

PLF 5 سال پیش
والد
کامیت
c95c9c0270

+ 1 - 1
src/main/java/com/caimei/controller/products/DetailsController.java

@@ -44,7 +44,7 @@ public class DetailsController {
      */
     @ResponseBody
     @RequestMapping("/addCart")
-    public WxJsonModel addCart(@RequestBody CmMallCart cmMallCart, HttpServletRequest request) {
+    public synchronized WxJsonModel addCart(@RequestBody CmMallCart cmMallCart, HttpServletRequest request) {
         WxJsonModel model = WxJsonModel.newInstance();
         if (cmMallCart == null) return model.error("参数异常");
         String openid = (String) request.getSession().getAttribute("openid");

+ 11 - 6
src/main/resources/mapper/HomePageMapper.xml

@@ -14,7 +14,9 @@
           AND delFlag = '0'
         ORDER BY
           IF(ISNULL(sort),1,0) ASC,
-          sort ASC
+          sort ASC,
+          addTime DESC,
+          id DESC
     </select>
 
     <select id="findProducts" resultType="com.caimei.entity.CmOrganizeProducts" parameterType="int">
@@ -35,7 +37,9 @@
           AND p.productID IS NOT NULL
         ORDER BY
           IF(ISNULL(cop.commonlyProductSort),1,0) ASC,
-          cop.commonlyProductSort ASC
+          cop.commonlyProductSort ASC,
+          cop.addTime DESC,
+          cop.id DESC
         LIMIT
           5
     </select>
@@ -74,7 +78,8 @@
           AND cmop.delFlag = '0'
           AND p.productID IS NOT NULL
         ORDER BY
-          cmop.addTime DESC
+          cmop.addTime DESC,
+          cmop.id DESC
     </select>
 
     <select id="preferred" parameterType="int" resultType="com.caimei.entity.CmOrganizeProducts">
@@ -103,15 +108,15 @@
         </where>
         <if test="preferredProduct != null and preferredProduct != ''">
             ORDER BY IF(ISNULL(cmop.preferredProductSort),1,0) ASC,
-            cmop.preferredProductSort ASC,cmop.addTime DESC
+            cmop.preferredProductSort ASC,cmop.addTime DESC,cmop.id DESC
         </if>
         <if test="commonlyProduct != null and commonlyProduct != ''">
             ORDER BY IF(ISNULL(cmop.commonlyProductSort),1,0) ASC,
-            cmop.commonlyProductSort ASC,cmop.addTime DESC
+            cmop.commonlyProductSort ASC,cmop.addTime DESC,cmop.id DESC
         </if>
         <if test="preferentialProduct != null and preferentialProduct != ''">
             ORDER BY IF(ISNULL(cmop.preferentialProductSort),1,0) ASC,
-            cmop.preferentialProductSort ASC,cmop.addTime DESC
+            cmop.preferentialProductSort ASC,cmop.addTime DESC,cmop.id DESC
         </if>
     </select>