Authored by sailing-PC\sailing

fix count issue

@@ -36,5 +36,5 @@ public interface SellerOrderMapper { @@ -36,5 +36,5 @@ public interface SellerOrderMapper {
36 * @param uid 36 * @param uid
37 * @return 37 * @return
38 */ 38 */
39 - Integer selectOrderNumByUid(@Param("uid") int uid); 39 + Integer selectOrderNumByUid(@Param("uid") int uid, @Param("statusList")Collection<Integer> statusList);
40 } 40 }
@@ -218,6 +218,10 @@ @@ -218,6 +218,10 @@
218 218
219 219
220 <select id="selectOrderNumByUid" resultType="java.lang.Integer"> 220 <select id="selectOrderNumByUid" resultType="java.lang.Integer">
221 - select count(*) from seller_order where uid = #{uid,jdbcType=INTEGER} and is_del = 1 221 + select count(*) from seller_order where uid = #{uid,jdbcType=INTEGER}
  222 + and is_del = 1 and status in
  223 + <foreach collection="statusList" item="status" open="(" close=")" separator=",">
  224 + #{status,jdbcType=INTEGER}
  225 + </foreach>
222 </select> 226 </select>
223 </mapper> 227 </mapper>
@@ -504,7 +504,9 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi @@ -504,7 +504,9 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
504 */ 504 */
505 public OrderSummaryResp selectOrderNumByUid(int uid) { 505 public OrderSummaryResp selectOrderNumByUid(int uid) {
506 //todo add cache 506 //todo add cache
507 - Integer num = sellerOrderMapper.selectOrderNumByUid(uid); 507 + SellerOrderListType listType = SellerOrderListType.IN_SALE;
  508 + List<Integer> statusListInSale = listType.getStatus();
  509 + Integer num = sellerOrderMapper.selectOrderNumByUid(uid, statusListInSale);
508 List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_SEND, SellerOrderListType.WAITING_PAY); 510 List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_SEND, SellerOrderListType.WAITING_PAY);
509 List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList()); 511 List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
510 Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList); 512 Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList);