576 lines
26 KiB
XML
576 lines
26 KiB
XML
<?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">
|
|
<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"/>
|
|
<result property="drawCashId" column="draw_cash_id"/>
|
|
<result property="drawCashTime" column="draw_cash_time"/>
|
|
<result property="arrivalTime" column="arrival_time"/>
|
|
<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"/>
|
|
<result property="afterServiceStatus" column="after_service_status"/>
|
|
<result property="handoverImages" column="handover_images"/>
|
|
<result property="handoverRemark" column="handover_remark"/>
|
|
<result property="confirmStartTime" column="confirm_start_time"/>
|
|
<result property="confirmTimeoutRemainingTime" column="confirm_timeout_remaining_time"/>
|
|
<result property="timeout" column="timeout_"/>
|
|
<result property="afterTimeout" column="after_timeout"/>
|
|
<result property="timeoutFineTimes" column="timeout_fine_times"/>
|
|
<result property="delayCount" column="delay_count"/>
|
|
<result property="returnReason" column="return_reason"/>
|
|
<result property="returnReasonDetail" column="return_reason_detail"/>
|
|
<result property="returnImages" column="return_images"/>
|
|
<result property="workerRemark" column="worker_remark"/>
|
|
<result property="shareAccountCountdownEndTime" column="share_account_countdown_end_time"/>
|
|
<result property="shareAccountCountdownDuration" column="share_account_countdown_duration"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectOrderDetail">
|
|
SELECT id,
|
|
code,
|
|
order_master_id,
|
|
order_master_code,
|
|
customer_id,
|
|
order_type,
|
|
order_status,
|
|
worker_id,
|
|
rev_time,
|
|
expect_time_start,
|
|
expect_time_end,
|
|
work_begin_time,
|
|
work_finish_time,
|
|
draw_cash_id,
|
|
draw_cash_time,
|
|
arrival_time,
|
|
draw_cash_status,
|
|
clock_in_location,
|
|
ledger_account_status,
|
|
shelve_status,
|
|
create_by,
|
|
create_time,
|
|
update_time,
|
|
remark,
|
|
handover_images,
|
|
handover_remark,
|
|
confirm_start_time,
|
|
timeout_,
|
|
timeout_fine_times,
|
|
after_timeout,
|
|
delay_count,
|
|
return_reason,
|
|
return_reason_detail,
|
|
return_images,
|
|
worker_remark,
|
|
after_service_status,
|
|
share_account_countdown_end_time,
|
|
share_account_countdown_duration
|
|
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.draw_cash_id,
|
|
od.draw_cash_time,
|
|
od.arrival_time,
|
|
od.draw_cash_status,
|
|
od.clock_in_location,
|
|
od.ledger_account_status,
|
|
od.shelve_status,
|
|
od.create_by,
|
|
od.create_time,
|
|
od.update_time,
|
|
od.remark,
|
|
od.handover_images,
|
|
od.handover_remark,
|
|
od.confirm_start_time,
|
|
od.draw_cash_status,
|
|
od.timeout_,
|
|
od.timeout_fine_times,
|
|
od.after_timeout,
|
|
od.delay_count,
|
|
od.return_reason,
|
|
od.return_reason_detail,
|
|
od.return_images,
|
|
od.worker_remark,
|
|
od.after_service_status,
|
|
od.share_account_countdown_end_time,
|
|
od.share_account_countdown_duration
|
|
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
|
|
left join worker w on od.worker_id = w.worker_id
|
|
</sql>
|
|
|
|
<select id="selectOrderDetailList" parameterType="com.ghy.order.domain.OrderDetail" resultMap="OrderDetailResult">
|
|
<include refid="selectOrderDetailMoreInfo"/>
|
|
<where>
|
|
<if test="keyWords != null and keyWords != ''">
|
|
AND
|
|
(
|
|
om.code LIKE concat('%', #{keyWords}, '%')
|
|
or ca.name LIKE concat('%', #{keyWords}, '%')
|
|
or ca.phone LIKE concat('%', #{keyWords}, '%')
|
|
or ca.address like concat('%', #{keyWords}, '%')
|
|
or g.goods_name like concat('%', #{keyWords}, '%')
|
|
)
|
|
</if>
|
|
<if test="deptId != null and deptId != ''">
|
|
AND w.dept_id = #{deptId}
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
AND od.code LIKE concat('%', #{code}, '%')
|
|
</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>
|
|
<if test="orderStatusList != null and orderStatusList.size() > 0">
|
|
AND od.order_status in
|
|
<foreach collection="orderStatusList" item="orderStatus" open="(" separator="," close=")">
|
|
#{orderStatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">
|
|
AND od.order_master_code = #{orderMasterCode}
|
|
</if>
|
|
<if test="workerId != null and workerId != 0">
|
|
AND od.worker_id = #{workerId}
|
|
</if>
|
|
<if test="workerIds != null and workerIds.size() > 0">
|
|
AND od.worker_id in
|
|
<foreach collection="workerIds" item="workerId" open="(" separator="," close=")">
|
|
#{workerId}
|
|
</foreach>
|
|
</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="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>
|
|
<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>
|
|
<if test="afterServiceStatus != null">
|
|
AND od.after_service_status = #{afterServiceStatus}
|
|
</if>
|
|
<if test="orderDetailIds != null">
|
|
AND od.id in ( ${orderDetailIds} )
|
|
</if>
|
|
<if test="shelveStatus != null">
|
|
AND od.shelve_status = ${shelveStatus}
|
|
</if>
|
|
<if test="shelveStatus == null">
|
|
AND od.shelve_status = 0
|
|
</if>
|
|
<if test="drawCashStatus != null">
|
|
AND od.draw_cash_status = ${drawCashStatus}
|
|
</if>
|
|
<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>
|
|
<!-- <if test="workFinishTimeExisted">-->
|
|
<!-- AND od.work_finish_time is not null-->
|
|
<!-- </if>-->
|
|
<if test="timeout != null">
|
|
AND od.timeout_ = #{timeout}
|
|
</if>
|
|
<!-- <if test="isCall != null">-->
|
|
<!-- AND om.is_call = #{isCall}-->
|
|
<!-- </if>-->
|
|
</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}, '%')
|
|
</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>
|
|
<if test="orderStatusList != null and orderStatusList.size() > 0">
|
|
AND od.order_status in
|
|
<foreach collection="orderStatusList" item="orderStatus" open="(" separator="," close=")">
|
|
#{orderStatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="orderMasterCode != null and orderMasterCode != 0">
|
|
AND od.order_detail_code = #{orderMasterCode}
|
|
</if>
|
|
<if test="workerId != null and workerId != 0">
|
|
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>
|
|
<if test="expectTimeStart != null">
|
|
AND od.expect_time_start >= #{expectTimeStart}
|
|
</if>
|
|
<if test="expectTimeEnd != null">
|
|
AND od.expect_time_end <= #{expectTimeEnd}
|
|
</if>
|
|
<if test="shelveStatus != null">
|
|
AND od.shelve_status = ${shelveStatus}
|
|
</if>
|
|
<!-- <if test="workFinishTimeExisted">-->
|
|
<!-- AND od.work_finish_time is not null-->
|
|
<!-- </if>-->
|
|
<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>
|
|
<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>
|
|
<if test="afterServiceStatus != null">
|
|
AND od.after_service_status = #{afterServiceStatus}
|
|
</if>
|
|
</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="selectById" parameterType="long" resultMap="OrderDetailResult">
|
|
<include refid="selectOrderDetail"/>
|
|
WHERE id = #{orderDetailId}
|
|
</select>
|
|
|
|
|
|
<select id="selectByOrderMasterId" parameterType="long" resultMap="OrderDetailResult">
|
|
<include refid="selectOrderDetail"/>
|
|
WHERE order_master_id = #{orderMasterId}
|
|
</select>
|
|
|
|
<delete id="deleteOrderDetailByIds" parameterType="Long">
|
|
DELETE FROM order_detail WHERE id IN
|
|
<foreach collection="array" item="orderDetailId" open="(" separator="," close=")">
|
|
#{orderDetailId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteByMaster">
|
|
DELETE
|
|
FROM order_detail
|
|
WHERE order_master_id = #{masterId}
|
|
</delete>
|
|
|
|
<update id="updateOrderDetail" parameterType="com.ghy.order.domain.OrderDetail">
|
|
UPDATE order_detail
|
|
<set>
|
|
<if test="code != null and code != ''">code = #{code},</if>
|
|
<if test="orderMasterId != null and orderMasterId != 0">order_master_id = #{orderMasterId},</if>
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code = #{orderMasterCode},</if>
|
|
<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>
|
|
<if test="expectTimeStart != null">expect_time_start = #{expectTimeStart},</if>
|
|
<if test="expectTimeEnd != null">expect_time_end = #{expectTimeEnd},</if>
|
|
<if test="useTimeNotRange">expect_time_end = null,</if>
|
|
<if test="workBeginTime != null">work_begin_time = #{workBeginTime},</if>
|
|
<if test="workFinishTime != null">work_finish_time = #{workFinishTime},</if>
|
|
<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>
|
|
<if test="clockInLocation != null and clockInLocation != ''">clock_in_location = #{clockInLocation},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="handoverImages != null">handover_images = #{handoverImages},</if>
|
|
<if test="handoverRemark != null">handover_remark = #{handoverRemark},</if>
|
|
<if test="confirmStartTime != null">confirm_start_time = #{confirmStartTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="ledgerAccountStatus != null">ledger_account_status = #{ledgerAccountStatus},</if>
|
|
<if test="timeout != null">timeout_ = #{timeout},</if>
|
|
<if test="delayCount != null">delay_count = #{delayCount},</if>
|
|
<if test="returnReason != null">return_reason = #{returnReason},</if>
|
|
<if test="returnReasonDetail != null">return_reason_detail = #{returnReasonDetail},</if>
|
|
<if test="returnImages != null">return_images = #{returnImages},</if>
|
|
<if test="workerRemark != null">worker_remark = #{workerRemark},</if>
|
|
<if test="afterServiceStatus != null">after_service_status = #{afterServiceStatus},</if>
|
|
<if test="shareAccountCountdownEndTime != null">share_account_countdown_end_time = #{shareAccountCountdownEndTime},</if>
|
|
<if test="shareAccountCountdownDuration != null">share_account_countdown_duration = #{shareAccountCountdownDuration},</if>
|
|
update_time = SYSDATE()
|
|
</set>
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<update id="updateStatus">
|
|
UPDATE order_detail
|
|
SET order_status = #{orderStatus},
|
|
update_time = SYSDATE()
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<update id="updateTimeout">
|
|
UPDATE order_detail
|
|
SET timeout_ = #{timeout},
|
|
timeout_fine_times = #{timeoutFineTimes}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<update id="updateAfterTimeout">
|
|
UPDATE order_detail
|
|
SET after_timeout = #{timeout},
|
|
timeout_fine_times = #{timeoutFineTimes},
|
|
update_time = SYSDATE()
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<insert id="insertOrderDetail" parameterType="com.ghy.order.domain.OrderDetail" useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
INSERT INTO order_detail(
|
|
<if test="code != null and code != ''">code,</if>
|
|
<if test="orderMasterId != null and orderMasterId != 0">order_master_id,</if>
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code,</if>
|
|
<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>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="handoverImages != null">handover_images,</if>
|
|
<if test="handoverRemark != null">handover_remark,</if>
|
|
<if test="confirmStartTime != null">confirm_start_time,</if>
|
|
<if test="delayCount != null">delay_count,</if>
|
|
<if test="returnReason != null">return_reason,</if>
|
|
<if test="returnReasonDetail != null">return_reason_detail,</if>
|
|
<if test="returnImages != null">return_images,</if>
|
|
<if test="workerRemark != null">worker_remark,</if>
|
|
<if test="shareAccountCountdownEndTime != null">share_account_countdown_end_time,</if>
|
|
<if test="shareAccountCountdownDuration != null">share_account_countdown_duration,</if>
|
|
<if test="expectTimeStart != null">expect_time_start,</if>
|
|
<if test="expectTimeEnd != null">expect_time_end,</if>
|
|
<if test="workBeginTime != null">work_begin_time,</if>
|
|
<if test="workFinishTime != null">work_finish_time,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
create_time
|
|
)VALUES(
|
|
<if test="code != null and code != ''">#{code},</if>
|
|
<if test="orderMasterId != null and orderMasterId != 0">#{orderMasterId},</if>
|
|
<if test="orderMasterCode != null and orderMasterCode != ''">#{orderMasterCode},</if>
|
|
<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>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="handoverImages != null">#{handoverImages},</if>
|
|
<if test="handoverRemark != null">#{handoverRemark},</if>
|
|
<if test="confirmStartTime != null">#{confirmStartTime},</if>
|
|
<if test="delayCount != null">#{delayCount},</if>
|
|
<if test="returnReason != null">#{returnReason},</if>
|
|
<if test="returnReasonDetail != null">#{returnReasonDetail},</if>
|
|
<if test="returnImages != null">#{returnImages},</if>
|
|
<if test="workerRemark != null">#{workerRemark},</if>
|
|
<if test="shareAccountCountdownEndTime != null">#{shareAccountCountdownEndTime},</if>
|
|
<if test="shareAccountCountdownDuration != null">#{shareAccountCountdownDuration},</if>
|
|
<if test="expectTimeStart != null">#{expectTimeStart},</if>
|
|
<if test="expectTimeEnd != null">#{expectTimeEnd},</if>
|
|
<if test="workBeginTime != null">#{workBeginTime},</if>
|
|
<if test="workFinishTime != null">#{workFinishTime},</if>
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<select id="selectByStatus" resultMap="OrderDetailResult">
|
|
<include refid="selectOrderDetail"/>
|
|
WHERE `order_status` IN
|
|
<foreach collection="list" item="orderStatus" open="(" separator="," close=")">
|
|
#{orderStatus}
|
|
</foreach>
|
|
</select>
|
|
|
|
<update id="updateDrawCashStatus">
|
|
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()
|
|
WHERE draw_cash_id = #{drawCashId}
|
|
</update>
|
|
|
|
<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
|
|
from order_detail od left join order_master om on od.order_master_id = om.id
|
|
where 1 = 1
|
|
<if test="timeout != null">
|
|
AND od.timeout_ = #{timeout}
|
|
</if>
|
|
<if test="isCall != null">
|
|
AND om.is_call = #{isCall}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="searchByOrderStartTime" resultMap="OrderDetailResult">
|
|
<include refid="selectOrderDetail"/>
|
|
<where>
|
|
<if test="startTime != null">
|
|
and create_time <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and create_time <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper>
|