Authored by sailing-PC\sailing

fix count issue

... ... @@ -36,5 +36,5 @@ public interface SellerOrderMapper {
* @param uid
* @return
*/
Integer selectOrderNumByUid(@Param("uid") int uid);
Integer selectOrderNumByUid(@Param("uid") int uid, @Param("statusList")Collection<Integer> statusList);
}
\ No newline at end of file
... ...
... ... @@ -218,6 +218,10 @@
<select id="selectOrderNumByUid" resultType="java.lang.Integer">
select count(*) from seller_order where uid = #{uid,jdbcType=INTEGER} and is_del = 1
select count(*) from seller_order where uid = #{uid,jdbcType=INTEGER}
and is_del = 1 and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status,jdbcType=INTEGER}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -504,7 +504,9 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
*/
public OrderSummaryResp selectOrderNumByUid(int uid) {
//todo add cache
Integer num = sellerOrderMapper.selectOrderNumByUid(uid);
SellerOrderListType listType = SellerOrderListType.IN_SALE;
List<Integer> statusListInSale = listType.getStatus();
Integer num = sellerOrderMapper.selectOrderNumByUid(uid, statusListInSale);
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_SEND, SellerOrderListType.WAITING_PAY);
List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList);
... ...