订单列表增加按照商品名称查询

This commit is contained in:
wuchunlei
2023-12-07 15:38:18 +08:00
parent b321ad333a
commit d93391fbf9
4 changed files with 71 additions and 25 deletions

View File

@@ -81,27 +81,73 @@
</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">
<!--
select order_sn, province, city, district, user_phone, address, payment_method, order_status, remark
-->
select *
from buy_order
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">
order_sn like #{searchKeyWord}
<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="orderStatus != null">
and order_status = #{orderStatus}
<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 create_time &gt;= #{startTime}
and b.create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
and b.create_time &lt;= #{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 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 &gt;= #{startTime}
</if>
<if test="endTime != null">
and b.create_time &lt;= #{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}
</select>