Explorar el Código

新增店铺状态修改时判断有无未完成订单逻辑

codingliang hace 1 año
padre
commit
0f57eb80c5

+ 7 - 0
src/main/java/com/sqx/modules/order/dao/AppOrderDao.java

@@ -89,4 +89,11 @@ public interface AppOrderDao extends BaseMapper<TbOrder> {
      * @return 订单id集合
      */
     List<Long> selectCurWaitReceivingOrderIds();
+
+    /**
+     * 统计当前订单未完成店铺数量
+     * @param shopId 店铺id
+     * @return 未完成订单数
+     */
+    int countUnFinishNumByShopId(@Param("shopId") Long shopId);
 }

+ 9 - 1
src/main/java/com/sqx/modules/shop/controller/app/ShopMessageController.java

@@ -10,7 +10,15 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
 
 @Api(tags={"商户端-商户管理"})
 @RestController

+ 6 - 0
src/main/resources/mapper/order/OrderMapper.xml

@@ -440,4 +440,10 @@
                 and expect_delivery_time <![CDATA[ <= ]]> adddate(now(),interval 30 minute)
     </select>
 
+    <select id="countUnFinishNumByShopId" resultType="java.lang.Integer">
+        select count(order_id)
+        from tb_order
+        where shop_id = #{shopId} and status in (6, 3)
+    </select>
+
 </mapper>