子订单列表查询增加查询条件

This commit is contained in:
donqi 2022-07-05 14:09:52 +08:00
parent 2eda5293f8
commit 69a95f665a
3 changed files with 57 additions and 9 deletions

View File

@ -56,4 +56,10 @@ public class OrderDetail extends BaseEntity {
private Date workFinishTime;
private Date createTime;
private Long goodsCategoryId;
private String goodsName;
private Long countryId;
}

View File

@ -45,29 +45,71 @@
FROM order_detail
</sql>
<sql id="selectOrderDetailMoreInfo">
SELECT od.id,
od.code,
od.order_master_id,
od.order_master_code,
od.customer_id,
od.order_type,
od.order_status,
od.worker_id,
od.rev_time,
od.expect_time_start,
od.expect_time_end,
od.work_begin_time,
od.work_finish_time,
od.create_by,
od.create_time,
od.remark
FROM order_detail od
LEFT JOIN order_master om ON om.id = od.order_master_id
LEFT JOIN customer_address ca ON ca.customer_address_id = om.address_id
LEFT JOIN goods g ON g.goods_id = om.goods_id
</sql>
<select id="selectOrderDetailList" parameterType="com.ghy.order.domain.OrderDetail" resultMap="OrderDetailResult">
<include refid="selectOrderDetail"/>
<include refid="selectOrderDetailMoreInfo"/>
<where>
<if test="code != null and code != ''">
AND code LIKE concat('%', #{code}, '%')
AND od.code LIKE concat('%', #{code}, '%')
</if>
<if test="customerId != null and customerId != 0">
AND customer_id = #{customerId}
AND od.customer_id = #{customerId}
</if>
<if test="orderType != null">
AND order_type = #{orderType}
AND od.order_type = #{orderType}
</if>
<if test="orderStatus != null">
AND order_status = #{orderStatus}
AND od.order_status = #{orderStatus}
</if>
<if test="orderMasterCode != null and orderMasterCode != 0">
AND order_detail_code = #{orderMasterCode}
AND od.order_detail_code = #{orderMasterCode}
</if>
<if test="workerId != null and workerId != 0">
AND worker_id = #{workerId}
AND od.worker_id = #{workerId}
</if>
<if test="goodsCategoryId != null">
AND g.dept_goods_category_id = #{goodsCategoryId}
</if>
<if test="goodsName != null and goodsName != ''">
AND g.goods_name like concat('%', #{goodsName}, '%')
</if>
<if test="countryId != null">
AND ca.country_id = #{countryId}
</if>
</where>
order by create_time desc
order by od.create_time
<trim suffixOverrides=",">
<choose>
<when test="params.createTimeSort != null and params.createTimeSort != ''">
${params.createTimeSort}
</when>
<otherwise>
desc
</otherwise>
</choose>
</trim>
</select>
<select id="selectById" parameterType="long" resultMap="OrderDetailResult">

View File

@ -111,7 +111,7 @@
AND ca.country_id = #{countryId}
</if>
</where>
order by create_time
order by om.create_time
<trim suffixOverrides=",">
<choose>
<when test="params.createTimeSort != null and params.createTimeSort != ''">