订单列表增加按照商品名称查询
This commit is contained in:
@@ -18,6 +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);
|
||||||
|
|
||||||
List<BuyOrder> orderStatusNum(Integer userId);
|
List<BuyOrder> orderStatusNum(Integer userId);
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BookService bookService;
|
private BookService bookService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BuyOrderDao buyOrderDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BuyOrderProductService buyOrderProductService;
|
private BuyOrderProductService buyOrderProductService;
|
||||||
|
|
||||||
@@ -352,25 +355,17 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> orderList(BuyOrderListRequestVo requestVo) {
|
public Map<String, Object> orderList(BuyOrderListRequestVo requestVo) {
|
||||||
Page<BuyOrder> buyOrderPage = new Page<>(requestVo.getPageIndex(), requestVo.getPageSize());
|
|
||||||
List<BuyOrderResponseVo> data = new ArrayList<>();
|
List<BuyOrderResponseVo> data = new ArrayList<>();
|
||||||
QueryWrapper<BuyOrder> buyOrderQueryWrapper = new QueryWrapper<>();
|
requestVo.setIndex((requestVo.getPageIndex()-1)*10);
|
||||||
buyOrderQueryWrapper.and(StringUtils.isNotBlank(requestVo.getSearchKeyWord()),t->t.like("order_sn", requestVo.getSearchKeyWord()).or().like("shipping_user", requestVo.getSearchKeyWord()).or().like("user_phone", requestVo.getSearchKeyWord()));
|
List<BuyOrder> buyOrderList = buyOrderDao.orderList(requestVo);
|
||||||
buyOrderQueryWrapper.eq(StringUtils.isNotBlank(requestVo.getOrderStatus()), "order_status", requestVo.getOrderStatus());
|
int count = buyOrderDao.orderListCount(requestVo).size();
|
||||||
buyOrderQueryWrapper.gt(requestVo.getStartTime() != null, "create_time", requestVo.getStartTime());
|
|
||||||
buyOrderQueryWrapper.lt(requestVo.getEndTime() != null, "create_time", requestVo.getStartTime());
|
|
||||||
buyOrderQueryWrapper.eq("order_type","order");
|
|
||||||
buyOrderQueryWrapper.orderByDesc("create_time");
|
|
||||||
|
|
||||||
Integer totalSize = list(buyOrderQueryWrapper).size();
|
|
||||||
Integer totalPage = totalSize / requestVo.getPageSize() + 1;
|
|
||||||
Page<BuyOrder> page = page(buyOrderPage, buyOrderQueryWrapper);
|
|
||||||
List<BuyOrder> buyOrderList = page.getRecords();
|
|
||||||
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 totalPage = totalSize / requestVo.getPageSize() + 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);
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ public class BuyOrderListRequestVo {
|
|||||||
* 搜索关键词
|
* 搜索关键词
|
||||||
*/
|
*/
|
||||||
private String searchKeyWord;
|
private String searchKeyWord;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
/**
|
/**
|
||||||
* 开始时间
|
* 开始时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -81,27 +81,73 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="orderList" resultType="com.peanut.modules.book.entity.BuyOrder"
|
<select id="orderListCount" resultType="com.peanut.modules.book.entity.BuyOrder"
|
||||||
parameterType="com.peanut.modules.book.vo.request.BuyOrderListRequestVo" resultMap="buyOrderMap">
|
parameterType="com.peanut.modules.book.vo.request.BuyOrderListRequestVo" resultMap="buyOrderMap">
|
||||||
<!--
|
select b.*
|
||||||
select order_sn, province, city, district, user_phone, address, payment_method, order_status, remark
|
from buy_order b
|
||||||
-->
|
<if test="productName != null and productName!= ''">
|
||||||
select *
|
left join buy_order_product p on b.order_id = p.order_id
|
||||||
from buy_order
|
left join shop_product s on s.product_id = p.product_id
|
||||||
<where>
|
|
||||||
<if test="searchKeyWord != null">
|
|
||||||
order_sn like #{searchKeyWord}
|
|
||||||
</if>
|
</if>
|
||||||
<if test="orderStatus != null">
|
<where>
|
||||||
and order_status = #{orderStatus}
|
<if test="searchKeyWord != null and searchKeyWord!= ''">
|
||||||
|
and (b.order_sn like concat('%',concat(#{searchKeyWord},'%'))
|
||||||
|
or b.shipping_user like concat('%',concat(#{searchKeyWord},'%'))
|
||||||
|
or b.user_phone like concat('%',concat(#{searchKeyWord},'%')))
|
||||||
|
</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>
|
||||||
<if test="startTime != null">
|
<if test="startTime != null">
|
||||||
and create_time >= #{startTime}
|
and b.create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null">
|
<if test="endTime != null">
|
||||||
and create_time <= #{endTime}
|
and b.create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
|
and b.order_type = 'order'
|
||||||
|
and b.del_flag = 0
|
||||||
</where>
|
</where>
|
||||||
|
<if test="productName != null and productName!= ''">
|
||||||
|
group by b.order_id
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="orderList" resultType="com.peanut.modules.book.entity.BuyOrder"
|
||||||
|
parameterType="com.peanut.modules.book.vo.request.BuyOrderListRequestVo" resultMap="buyOrderMap">
|
||||||
|
select b.*
|
||||||
|
from buy_order b
|
||||||
|
<if test="productName != null and productName!= ''">
|
||||||
|
left join buy_order_product p on b.order_id = p.order_id
|
||||||
|
left join shop_product s on s.product_id = p.product_id
|
||||||
|
</if>
|
||||||
|
<where>
|
||||||
|
<if test="searchKeyWord != null and searchKeyWord!= ''">
|
||||||
|
and (b.order_sn like concat('%',concat(#{searchKeyWord},'%'))
|
||||||
|
or b.shipping_user like concat('%',concat(#{searchKeyWord},'%'))
|
||||||
|
or b.user_phone like concat('%',concat(#{searchKeyWord},'%')))
|
||||||
|
</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!= ''">
|
||||||
|
group by b.order_id
|
||||||
|
</if>
|
||||||
|
order by b.create_time desc
|
||||||
limit #{index},#{pageSize}
|
limit #{index},#{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user