修改订单列表总数
This commit is contained in:
@@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface BuyOrderDao extends BaseMapper<BuyOrder> {
|
public interface BuyOrderDao extends BaseMapper<BuyOrder> {
|
||||||
List<BuyOrder> orderList(BuyOrderListRequestVo requestVo);
|
List<BuyOrder> orderList(BuyOrderListRequestVo requestVo);
|
||||||
List<BuyOrder> orderListCount(BuyOrderListRequestVo requestVo);
|
int orderListCount(BuyOrderListRequestVo requestVo);
|
||||||
|
|
||||||
List<BuyOrder> orderStatusNum(Integer userId);
|
List<BuyOrder> orderStatusNum(Integer userId);
|
||||||
|
|
||||||
|
|||||||
@@ -422,14 +422,17 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
|||||||
List<BuyOrderResponseVo> data = new ArrayList<>();
|
List<BuyOrderResponseVo> data = new ArrayList<>();
|
||||||
requestVo.setIndex((requestVo.getPageIndex()-1)*10);
|
requestVo.setIndex((requestVo.getPageIndex()-1)*10);
|
||||||
List<BuyOrder> buyOrderList = buyOrderDao.orderList(requestVo);
|
List<BuyOrder> buyOrderList = buyOrderDao.orderList(requestVo);
|
||||||
int count = buyOrderDao.orderListCount(requestVo).size();
|
int count = buyOrderDao.orderListCount(requestVo);
|
||||||
for (BuyOrder buyOrder : buyOrderList) {
|
for (BuyOrder buyOrder : buyOrderList) {
|
||||||
BuyOrderResponseVo responseVo = setBuyOrderInfo(buyOrder);
|
BuyOrderResponseVo responseVo = setBuyOrderInfo(buyOrder);
|
||||||
data.add(responseVo);
|
data.add(responseVo);
|
||||||
}
|
}
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
Integer totalSize = count;
|
Integer totalSize = count;
|
||||||
Integer totalPage = totalSize / requestVo.getPageSize() + 1;
|
Integer totalPage = totalSize / requestVo.getPageSize();
|
||||||
|
if (totalSize % requestVo.getPageSize()!=0){
|
||||||
|
totalPage = totalPage + 1;
|
||||||
|
}
|
||||||
result.put("totalDataSize", totalSize);
|
result.put("totalDataSize", totalSize);
|
||||||
result.put("totalPage", totalPage);
|
result.put("totalPage", totalPage);
|
||||||
result.put("data", data);
|
result.put("data", data);
|
||||||
|
|||||||
@@ -81,38 +81,39 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="orderListCount" resultType="com.peanut.modules.book.entity.BuyOrder"
|
<select id="orderListCount" resultType="int" parameterType="com.peanut.modules.book.vo.request.BuyOrderListRequestVo">
|
||||||
parameterType="com.peanut.modules.book.vo.request.BuyOrderListRequestVo" resultMap="buyOrderMap">
|
select count(1) from (
|
||||||
select b.*
|
select b.*
|
||||||
from buy_order b
|
from buy_order b
|
||||||
<if test="productName != null and productName!= ''">
|
<if test="productName != null and productName!= ''">left join buy_order_product p on b.order_id = p.order_id
|
||||||
left join buy_order_product p on b.order_id = p.order_id
|
left join
|
||||||
left join shop_product s on s.product_id = p.product_id
|
shop_product s on s.product_id = p.product_id
|
||||||
</if>
|
</if>
|
||||||
<where>
|
<where>
|
||||||
<if test="searchKeyWord != null and searchKeyWord!= ''">
|
<if test="searchKeyWord != null and searchKeyWord!= ''">
|
||||||
and (b.order_sn like concat('%',concat(#{searchKeyWord},'%'))
|
and (b.order_sn like concat('%',concat(#{searchKeyWord},'%'))
|
||||||
or b.shipping_user like concat('%',concat(#{searchKeyWord},'%'))
|
or b.shipping_user like concat('%',concat(#{searchKeyWord},'%'))
|
||||||
or b.user_phone like concat('%',concat(#{searchKeyWord},'%')))
|
or b.user_phone like concat('%',concat(#{searchKeyWord},'%')))
|
||||||
</if>
|
</if>
|
||||||
|
<if test="productName != null and productName!= ''">
|
||||||
|
and (s.product_name like concat('%',concat(#{productName},'%')))
|
||||||
|
</if>
|
||||||
|
<if test="orderStatus != null and orderStatus!= ''">
|
||||||
|
and b.order_status = #{orderStatus}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null">
|
||||||
|
and b.create_time >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
and b.create_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
and b.order_type = 'order'
|
||||||
|
and b.del_flag = 0
|
||||||
|
</where>
|
||||||
<if test="productName != null and productName!= ''">
|
<if test="productName != null and productName!= ''">
|
||||||
and (s.product_name like concat('%',concat(#{productName},'%')))
|
group by b.order_id
|
||||||
</if>
|
</if>
|
||||||
<if test="orderStatus != null and orderStatus!= ''">
|
) t
|
||||||
and b.order_status = #{orderStatus}
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null">
|
|
||||||
and b.create_time >= #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
and b.create_time <= #{endTime}
|
|
||||||
</if>
|
|
||||||
and b.order_type = 'order'
|
|
||||||
and b.del_flag = 0
|
|
||||||
</where>
|
|
||||||
<if test="productName != null and productName!= ''">
|
|
||||||
group by b.order_id
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="orderList" resultType="com.peanut.modules.book.entity.BuyOrder"
|
<select id="orderList" resultType="com.peanut.modules.book.entity.BuyOrder"
|
||||||
|
|||||||
Reference in New Issue
Block a user