2022-04-25 17:06:55 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.ghy.order.mapper.OrderDetailMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap id="OrderDetailResult" type="com.ghy.order.domain.OrderDetail">
|
2023-02-03 01:18:25 +08:00
|
|
|
<id property="id" column="id"/>
|
|
|
|
|
<result property="code" column="code"/>
|
|
|
|
|
<result property="orderMasterId" column="order_master_id"/>
|
|
|
|
|
<result property="orderMasterCode" column="order_master_code"/>
|
|
|
|
|
<result property="customerId" column="customer_id"/>
|
|
|
|
|
<result property="orderType" column="order_type"/>
|
|
|
|
|
<result property="orderStatus" column="order_status"/>
|
|
|
|
|
<result property="workerId" column="worker_id"/>
|
|
|
|
|
<result property="revTime" column="rev_time"/>
|
|
|
|
|
<result property="expectTimeStart" column="expect_time_start"/>
|
|
|
|
|
<result property="expectTimeEnd" column="expect_time_end"/>
|
|
|
|
|
<result property="workBeginTime" column="work_begin_time"/>
|
|
|
|
|
<result property="workFinishTime" column="work_finish_time"/>
|
2023-03-21 12:46:38 +08:00
|
|
|
<result property="drawCashId" column="draw_cash_id"/>
|
|
|
|
|
<result property="drawCashTime" column="draw_cash_time"/>
|
|
|
|
|
<result property="arrivalTime" column="arrival_time"/>
|
2023-02-03 01:18:25 +08:00
|
|
|
<result property="drawCashStatus" column="draw_cash_status"/>
|
|
|
|
|
<result property="clockInLocation" column="clock_in_location"/>
|
|
|
|
|
<result property="shelveStatus" column="shelve_status"/>
|
|
|
|
|
<result property="ledgerAccountStatus" column="ledger_account_status"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="remark" column="remark"/>
|
2023-05-05 10:12:23 +08:00
|
|
|
<result property="timeout" column="timeout_"/>
|
|
|
|
|
<result property="timeoutFineTimes" column="timeout_fine_times"/>
|
2022-04-25 17:06:55 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectOrderDetail">
|
|
|
|
|
SELECT id,
|
|
|
|
|
code,
|
2022-05-24 22:26:26 +08:00
|
|
|
order_master_id,
|
2022-04-25 17:06:55 +08:00
|
|
|
order_master_code,
|
|
|
|
|
customer_id,
|
|
|
|
|
order_type,
|
|
|
|
|
order_status,
|
|
|
|
|
worker_id,
|
|
|
|
|
rev_time,
|
2022-06-20 18:09:34 +08:00
|
|
|
expect_time_start,
|
|
|
|
|
expect_time_end,
|
2022-04-25 17:06:55 +08:00
|
|
|
work_begin_time,
|
|
|
|
|
work_finish_time,
|
2023-03-21 12:46:38 +08:00
|
|
|
draw_cash_id,
|
|
|
|
|
draw_cash_time,
|
|
|
|
|
arrival_time,
|
2023-02-03 01:18:25 +08:00
|
|
|
draw_cash_status,
|
2022-10-21 00:32:00 +08:00
|
|
|
clock_in_location,
|
2022-11-23 01:17:53 +08:00
|
|
|
ledger_account_status,
|
|
|
|
|
shelve_status,
|
2022-04-25 17:06:55 +08:00
|
|
|
create_by,
|
|
|
|
|
create_time,
|
2022-08-18 20:29:22 +08:00
|
|
|
update_time,
|
2023-05-05 10:12:23 +08:00
|
|
|
remark,
|
|
|
|
|
timeout_,
|
|
|
|
|
timeout_fine_times
|
2022-04-25 17:06:55 +08:00
|
|
|
FROM order_detail
|
|
|
|
|
</sql>
|
|
|
|
|
|
2022-07-05 14:09:52 +08:00
|
|
|
<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,
|
2023-03-21 12:46:38 +08:00
|
|
|
od.draw_cash_id,
|
|
|
|
|
od.draw_cash_time,
|
|
|
|
|
od.arrival_time,
|
2023-02-03 01:18:25 +08:00
|
|
|
od.draw_cash_status,
|
2022-10-21 00:32:00 +08:00
|
|
|
od.clock_in_location,
|
2022-11-23 01:17:53 +08:00
|
|
|
od.ledger_account_status,
|
|
|
|
|
od.shelve_status,
|
2022-07-05 14:09:52 +08:00
|
|
|
od.create_by,
|
|
|
|
|
od.create_time,
|
2022-11-21 00:57:57 +08:00
|
|
|
od.update_time,
|
2023-03-25 22:00:38 +08:00
|
|
|
od.remark,
|
2023-05-05 10:12:23 +08:00
|
|
|
od.draw_cash_status,
|
|
|
|
|
od.timeout_,
|
|
|
|
|
od.timeout_fine_times
|
2022-07-05 14:09:52 +08:00
|
|
|
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
|
2023-05-16 14:44:59 +08:00
|
|
|
left join worker w on od.worker_id = w.worker_id
|
2022-07-05 14:09:52 +08:00
|
|
|
</sql>
|
|
|
|
|
|
2022-04-25 17:06:55 +08:00
|
|
|
<select id="selectOrderDetailList" parameterType="com.ghy.order.domain.OrderDetail" resultMap="OrderDetailResult">
|
2022-07-05 14:09:52 +08:00
|
|
|
<include refid="selectOrderDetailMoreInfo"/>
|
2022-04-25 17:06:55 +08:00
|
|
|
<where>
|
2023-05-16 14:44:59 +08:00
|
|
|
<if test="deptId != null and deptId != ''">
|
|
|
|
|
AND w.dept_id = #{deptId}
|
|
|
|
|
</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="code != null and code != ''">
|
2022-07-05 14:09:52 +08:00
|
|
|
AND od.code LIKE concat('%', #{code}, '%')
|
2022-09-12 14:48:30 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="customerId != null and customerId != 0">
|
|
|
|
|
AND od.customer_id = #{customerId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderType != null">
|
|
|
|
|
AND od.order_type = #{orderType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderStatus != null">
|
|
|
|
|
AND od.order_status = #{orderStatus}
|
|
|
|
|
</if>
|
2023-04-19 22:34:50 +08:00
|
|
|
<if test="orderStatusList != null and orderStatusList.size() > 0">
|
|
|
|
|
AND od.order_status in
|
|
|
|
|
<foreach collection="orderStatusList" item="orderStatus" open="(" separator="," close=")">
|
|
|
|
|
#{orderStatus}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2022-12-11 21:38:01 +08:00
|
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">
|
|
|
|
|
AND od.order_master_code = #{orderMasterCode}
|
2022-09-12 14:48:30 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">
|
|
|
|
|
AND od.worker_id = #{workerId}
|
|
|
|
|
</if>
|
2023-06-14 22:02:30 +08:00
|
|
|
<if test="workerIds != null and workerIds.size() > 0">
|
|
|
|
|
AND od.worker_id in
|
|
|
|
|
<foreach collection="workerIds" item="workerId" open="(" separator="," close=")">
|
|
|
|
|
#{workerId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2023-06-14 23:04:51 +08:00
|
|
|
<if test="masterIds != null and masterIds.size() > 0">
|
|
|
|
|
AND od.order_master_id in
|
|
|
|
|
<foreach collection="masterIds" item="masterId" open="(" separator="," close=")">
|
|
|
|
|
#{masterId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2022-09-12 14:48:30 +08:00
|
|
|
<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>
|
|
|
|
|
<if test="expectTimeStart != null">
|
|
|
|
|
AND od.expect_time_start >= #{expectTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="expectTimeEnd != null">
|
|
|
|
|
AND od.expect_time_end <= #{expectTimeEnd}
|
|
|
|
|
</if>
|
2023-06-15 00:17:23 +08:00
|
|
|
<if test="createTimeStart != null">
|
|
|
|
|
AND od.create_time >= #{createTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTimeEnd != null">
|
|
|
|
|
AND od.create_time <= #{createTimeEnd}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="workFinishTimeStart != null">
|
|
|
|
|
AND od.work_finish_time >= #{workFinishTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="workFinishTimeEnd != null">
|
|
|
|
|
AND od.work_finish_time <= #{workFinishTimeEnd}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="workBeginTimeStart != null">
|
|
|
|
|
AND od.work_begin_time >= #{workBeginTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="workBeginTimeEnd != null">
|
|
|
|
|
AND od.work_begin_time <= #{workBeginTimeEnd}
|
|
|
|
|
</if>
|
2022-09-25 22:35:27 +08:00
|
|
|
<if test="orderDetailIds != null">
|
2022-10-02 23:28:43 +08:00
|
|
|
AND od.id in ( ${orderDetailIds} )
|
2022-09-25 22:35:27 +08:00
|
|
|
</if>
|
2022-10-31 00:07:07 +08:00
|
|
|
<if test="shelveStatus != null">
|
|
|
|
|
AND od.shelve_status = ${shelveStatus}
|
|
|
|
|
</if>
|
2022-11-21 00:57:57 +08:00
|
|
|
<if test="shelveStatus == null">
|
|
|
|
|
AND od.shelve_status = 0
|
|
|
|
|
</if>
|
2023-02-03 01:18:25 +08:00
|
|
|
<if test="drawCashStatus != null">
|
|
|
|
|
AND od.draw_cash_status = ${drawCashStatus}
|
|
|
|
|
</if>
|
2023-03-28 00:53:25 +08:00
|
|
|
<if test="drawCashStatusList != null and drawCashStatusList.size() > 0">
|
|
|
|
|
AND od.draw_cash_status in
|
|
|
|
|
<foreach collection="drawCashStatusList" item="drawCashStatus" open="(" separator="," close=")">
|
|
|
|
|
#{drawCashStatus}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2024-05-20 09:19:08 +08:00
|
|
|
<!-- <if test="workFinishTimeExisted">-->
|
|
|
|
|
<!-- AND od.work_finish_time is not null-->
|
|
|
|
|
<!-- </if>-->
|
2023-05-12 22:24:28 +08:00
|
|
|
<if test="timeout != null">
|
|
|
|
|
AND od.timeout_ = #{timeout}
|
|
|
|
|
</if>
|
2023-11-04 01:16:30 +08:00
|
|
|
<if test="isCall != null">
|
|
|
|
|
AND om.is_call = #{isCall}
|
|
|
|
|
</if>
|
2022-09-12 14:48:30 +08:00
|
|
|
</where>
|
|
|
|
|
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="countOrderDetailList" parameterType="com.ghy.order.domain.OrderDetail" resultType="Long">
|
|
|
|
|
SELECT COUNT(*) FROM order_detail od
|
|
|
|
|
<where>
|
|
|
|
|
<if test="code != null and code != ''">
|
|
|
|
|
AND od.code LIKE concat('%', #{code}, '%')
|
2022-04-25 17:06:55 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="customerId != null and customerId != 0">
|
2022-07-05 14:09:52 +08:00
|
|
|
AND od.customer_id = #{customerId}
|
2022-04-25 17:06:55 +08:00
|
|
|
</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="orderType != null">
|
2022-07-05 14:09:52 +08:00
|
|
|
AND od.order_type = #{orderType}
|
2022-04-25 17:06:55 +08:00
|
|
|
</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="orderStatus != null">
|
2022-07-05 14:09:52 +08:00
|
|
|
AND od.order_status = #{orderStatus}
|
2022-04-25 17:06:55 +08:00
|
|
|
</if>
|
2023-04-19 22:34:50 +08:00
|
|
|
<if test="orderStatusList != null and orderStatusList.size() > 0">
|
|
|
|
|
AND od.order_status in
|
|
|
|
|
<foreach collection="orderStatusList" item="orderStatus" open="(" separator="," close=")">
|
|
|
|
|
#{orderStatus}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="orderMasterCode != null and orderMasterCode != 0">
|
2022-07-05 14:09:52 +08:00
|
|
|
AND od.order_detail_code = #{orderMasterCode}
|
2022-04-25 17:06:55 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">
|
2022-07-05 14:09:52 +08:00
|
|
|
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}
|
2022-04-25 17:06:55 +08:00
|
|
|
</if>
|
2022-07-10 20:00:19 +08:00
|
|
|
<if test="expectTimeStart != null">
|
|
|
|
|
AND od.expect_time_start >= #{expectTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="expectTimeEnd != null">
|
|
|
|
|
AND od.expect_time_end <= #{expectTimeEnd}
|
|
|
|
|
</if>
|
2022-10-31 00:07:07 +08:00
|
|
|
<if test="shelveStatus != null">
|
|
|
|
|
AND od.shelve_status = ${shelveStatus}
|
|
|
|
|
</if>
|
2024-05-20 09:19:08 +08:00
|
|
|
<!-- <if test="workFinishTimeExisted">-->
|
|
|
|
|
<!-- AND od.work_finish_time is not null-->
|
|
|
|
|
<!-- </if>-->
|
2023-03-28 00:53:25 +08:00
|
|
|
<if test="drawCashStatusList != null and drawCashStatusList.size() > 0">
|
|
|
|
|
AND od.draw_cash_status in
|
|
|
|
|
<foreach collection="drawCashStatusList" item="drawCashStatus" open="(" separator="," close=")">
|
|
|
|
|
#{drawCashStatus}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2023-06-15 00:17:23 +08:00
|
|
|
<if test="timeout != null">
|
|
|
|
|
AND od.timeout_ = #{timeout}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="masterIds != null and masterIds.size() > 0">
|
|
|
|
|
AND od.order_master_id in
|
|
|
|
|
<foreach collection="masterIds" item="masterId" open="(" separator="," close=")">
|
|
|
|
|
#{masterId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderDetailIds != null">
|
|
|
|
|
AND od.id in ( ${orderDetailIds} )
|
|
|
|
|
</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
</where>
|
2022-07-05 14:09:52 +08:00
|
|
|
order by od.create_time
|
|
|
|
|
<trim suffixOverrides=",">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="params.createTimeSort != null and params.createTimeSort != ''">
|
|
|
|
|
${params.createTimeSort}
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
desc
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</trim>
|
2022-04-25 17:06:55 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectById" parameterType="long" resultMap="OrderDetailResult">
|
2022-05-24 22:26:26 +08:00
|
|
|
<include refid="selectOrderDetail"/> WHERE id = #{orderDetailId}
|
2022-04-25 17:06:55 +08:00
|
|
|
</select>
|
|
|
|
|
|
2022-06-10 16:44:13 +08:00
|
|
|
|
|
|
|
|
<select id="selectByOrderMasterId" parameterType="long" resultMap="OrderDetailResult">
|
|
|
|
|
<include refid="selectOrderDetail"/> WHERE order_master_id = #{orderMasterId}
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-04-25 17:06:55 +08:00
|
|
|
<delete id="deleteOrderDetailByIds" parameterType="Long">
|
|
|
|
|
DELETE FROM order_detail WHERE id IN
|
|
|
|
|
<foreach collection="array" item="orderDetailId" open="(" separator="," close=")">
|
|
|
|
|
#{orderDetailId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2023-05-16 22:48:43 +08:00
|
|
|
|
|
|
|
|
<delete id="deleteByMaster">
|
|
|
|
|
DELETE FROM order_detail WHERE order_master_id = #{masterId}
|
|
|
|
|
</delete>
|
2022-04-25 17:06:55 +08:00
|
|
|
|
|
|
|
|
<update id="updateOrderDetail" parameterType="com.ghy.order.domain.OrderDetail">
|
|
|
|
|
UPDATE order_detail
|
|
|
|
|
<set>
|
|
|
|
|
<if test="code != null and code != ''">code = #{code},</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="orderMasterId != null and orderMasterId != 0">order_master_id = #{orderMasterId},</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code = #{orderMasterCode},</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="customerId != null and customerId != 0">customer_id = #{customerId},</if>
|
|
|
|
|
<if test="orderType != null">order_type = #{orderType},</if>
|
|
|
|
|
<if test="orderStatus != null">order_status = #{orderStatus},</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">worker_id = #{workerId},</if>
|
|
|
|
|
<if test="revTime != null">rev_time = #{revTime},</if>
|
2022-06-20 18:09:34 +08:00
|
|
|
<if test="expectTimeStart != null">expect_time_start = #{expectTimeStart},</if>
|
|
|
|
|
<if test="expectTimeEnd != null">expect_time_end = #{expectTimeEnd},</if>
|
2022-10-27 00:54:15 +08:00
|
|
|
<if test="useTimeNotRange">expect_time_end = null,</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="workBeginTime != null">work_begin_time = #{workBeginTime},</if>
|
|
|
|
|
<if test="workFinishTime != null">work_finish_time = #{workFinishTime},</if>
|
2023-03-21 12:46:38 +08:00
|
|
|
<if test="drawCashId != null">draw_cash_id = #{drawCashId},</if>
|
|
|
|
|
<if test="drawCashTime != null">draw_cash_time = #{drawCashTime},</if>
|
|
|
|
|
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
|
2023-02-03 01:18:25 +08:00
|
|
|
<if test="drawCashStatus != null">draw_cash_status = #{drawCashStatus},</if>
|
2022-10-21 00:32:00 +08:00
|
|
|
<if test="clockInLocation != null and clockInLocation != ''">clock_in_location = #{clockInLocation},</if>
|
2022-07-28 02:00:18 +08:00
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
2022-11-23 01:17:53 +08:00
|
|
|
<if test="ledgerAccountStatus != null">ledger_account_status = #{ledgerAccountStatus},</if>
|
2023-07-09 16:39:49 +08:00
|
|
|
<if test="timeout != null">timeout_ = #{timeout},</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
update_time = SYSDATE()
|
|
|
|
|
</set>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
2022-07-22 22:25:44 +08:00
|
|
|
<update id="updateStatus">
|
|
|
|
|
UPDATE order_detail
|
|
|
|
|
SET order_status = #{orderStatus},
|
|
|
|
|
update_time = SYSDATE()
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
2023-05-05 10:12:23 +08:00
|
|
|
<update id="updateTimeout">
|
|
|
|
|
UPDATE order_detail
|
|
|
|
|
SET timeout_ = #{timeout},
|
|
|
|
|
timeout_fine_times = #{timeoutFineTimes}
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
2022-07-22 22:25:44 +08:00
|
|
|
<update id="updateByOrderMasterId">
|
|
|
|
|
UPDATE order_detail
|
|
|
|
|
<set>
|
|
|
|
|
<if test="orderStatus != null">order_status = #{orderStatus},</if>
|
|
|
|
|
update_time = SYSDATE()
|
|
|
|
|
</set>
|
|
|
|
|
WHERE order_master_id = #{orderMasterId}
|
|
|
|
|
</update>
|
|
|
|
|
|
2023-02-18 14:21:01 +08:00
|
|
|
<select id="statusCount" resultType="com.ghy.order.domain.OrderStatusCount">
|
|
|
|
|
SELECT
|
|
|
|
|
`order_status` AS `orderStatus`,
|
|
|
|
|
COUNT( * ) AS `count`
|
|
|
|
|
FROM
|
|
|
|
|
`order_detail`
|
|
|
|
|
GROUP BY
|
|
|
|
|
order_status
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-04-25 17:06:55 +08:00
|
|
|
<insert id="insertOrderDetail" parameterType="com.ghy.order.domain.OrderDetail" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO order_detail(
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="code != null and code != ''">code,</if>
|
|
|
|
|
<if test="orderMasterId != null and orderMasterId != 0">order_master_id,</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code,</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="customerId != null and customerId != 0">customer_id,</if>
|
|
|
|
|
<if test="orderType != null">order_type,</if>
|
|
|
|
|
<if test="orderStatus != null">order_status,</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">worker_id,</if>
|
|
|
|
|
<if test="revTime != null">rev_time,</if>
|
2022-06-30 17:48:25 +08:00
|
|
|
<if test="remark != null">remark,</if>
|
2022-06-20 18:09:34 +08:00
|
|
|
<if test="expectTimeStart != null">expect_time_start,</if>
|
|
|
|
|
<if test="expectTimeEnd != null">expect_time_end,</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="workBeginTime != null">work_begin_time,</if>
|
|
|
|
|
<if test="workFinishTime != null">work_finish_time,</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
|
create_time
|
|
|
|
|
)VALUES(
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="code != null and code != ''">#{code},</if>
|
2022-06-10 18:20:58 +08:00
|
|
|
<if test="orderMasterId != null and orderMasterId != 0">#{orderMasterId},</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">#{orderMasterCode},</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="customerId != null and customerId != 0">#{customerId},</if>
|
|
|
|
|
<if test="orderType != null">#{orderType},</if>
|
|
|
|
|
<if test="orderStatus != null">#{orderStatus},</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">#{workerId},</if>
|
|
|
|
|
<if test="revTime != null">#{revTime},</if>
|
2022-06-30 17:48:25 +08:00
|
|
|
<if test="remark != null">#{remark},</if>
|
2022-06-20 18:09:34 +08:00
|
|
|
<if test="expectTimeStart != null">#{expectTimeStart},</if>
|
|
|
|
|
<if test="expectTimeEnd != null">#{expectTimeEnd},</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="workBeginTime != null">#{workBeginTime},</if>
|
|
|
|
|
<if test="workFinishTime != null">#{workFinishTime},</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
|
SYSDATE()
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="checkOrderDetailCodeUnique" parameterType="String" resultMap="OrderDetailResult">
|
|
|
|
|
<include refid="selectOrderDetail"/>
|
|
|
|
|
WHERE `code` =#{orderDetailCode} LIMIT 1
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-06-01 14:50:58 +08:00
|
|
|
<select id="getByOrderIdList" resultMap="OrderDetailResult">
|
|
|
|
|
<include refid="selectOrderDetail" />
|
|
|
|
|
<where>
|
|
|
|
|
and order_master_id in
|
|
|
|
|
<foreach item="item" index="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-08-18 20:29:22 +08:00
|
|
|
<select id="selectByStatus" resultMap="OrderDetailResult">
|
2022-08-04 19:35:14 +08:00
|
|
|
<include refid="selectOrderDetail"/>
|
|
|
|
|
WHERE `order_status` IN
|
|
|
|
|
<foreach collection="list" item="orderStatus" open="(" separator="," close=")">
|
|
|
|
|
#{orderStatus}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
2023-03-21 12:46:38 +08:00
|
|
|
<update id="updateDrawCashStatus">
|
2023-05-18 21:18:43 +08:00
|
|
|
UPDATE order_detail SET
|
|
|
|
|
<if test="drawCashId != null">draw_cash_id = #{drawCashId},</if>
|
|
|
|
|
<if test="drawCashTime != null">draw_cash_time = #{drawCashTime},</if>
|
|
|
|
|
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
|
|
|
|
|
<if test="drawCashStatus != null">draw_cash_status = #{drawCashStatus},</if>
|
|
|
|
|
update_time = NOW()
|
2023-03-21 12:46:38 +08:00
|
|
|
WHERE draw_cash_id = #{drawCashId}
|
|
|
|
|
</update>
|
2023-06-15 00:17:23 +08:00
|
|
|
|
|
|
|
|
<select id="differentStatusOrderCount" resultType="com.ghy.order.domain.OrderDetailCount" parameterType="com.ghy.order.domain.OrderDetail">
|
|
|
|
|
select
|
|
|
|
|
count(case when od.order_status = 0 then 1 else null end) as newOrderNum,
|
|
|
|
|
count(case when od.order_status = 1 then 1 else null end) as acceptedOrderNum,
|
|
|
|
|
count(case when od.order_status = 2 then 1 else null end) as waitForDoorOrderNum,
|
|
|
|
|
count(case when od.order_status = 3 then 1 else null end) as servingOrderNum,
|
|
|
|
|
count(case when od.order_status = 4 then 1 else null end) as confirmingOrderNum,
|
|
|
|
|
count(case when od.order_status = 5 then 1 else null end) as finishedOrderNum,
|
|
|
|
|
count(case when od.order_status = 6 then 1 else null end) as canceledOrderNum
|
2023-11-04 01:16:30 +08:00
|
|
|
from order_detail od left join order_master om on od.order_master_id = om.id
|
2023-06-15 00:17:23 +08:00
|
|
|
where 1 = 1
|
|
|
|
|
<if test="timeout != null">
|
|
|
|
|
AND od.timeout_ = #{timeout}
|
|
|
|
|
</if>
|
2023-11-04 01:16:30 +08:00
|
|
|
<if test="isCall != null">
|
|
|
|
|
AND om.is_call = #{isCall}
|
|
|
|
|
</if>
|
2023-06-15 00:17:23 +08:00
|
|
|
</select>
|
2022-06-20 18:09:34 +08:00
|
|
|
</mapper>
|