<?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.qianwen.smartman.modules.coproduction.mapper.OrderMapper">
|
|
<select id="getOrderRecordInfo" resultType="com.qianwen.smartman.modules.coproduction.dto.OrderRecordInfoDTO">
|
SELECT bo.id orderId,
|
bo.order_status orderStatus,
|
bo.assign_num orderAssignNum,
|
bop.id processId,
|
bop.sort processSort,
|
borr.id recordId,
|
borr.workstation_id workstationId,
|
borr.qualify_num recordQualifyNum,
|
borr.scrapped_num recordScrappedNum
|
FROM blade_order bo
|
LEFT JOIN blade_order_process bop ON bo.id = bop.order_id
|
LEFT JOIN blade_order_report_record borr ON borr.process_id = bop.id
|
AND borr.is_deleted = 0
|
WHERE bo.plan_id = #{planId}
|
AND bo.is_deleted = 0
|
</select>
|
|
<select id="list" resultType="com.qianwen.smartman.modules.coproduction.vo.OrderVO">
|
select bo.id,
|
bo.order_code,
|
bo.assign_num,
|
bo.scrapped_num,
|
bo.qualify_num,
|
bo.order_status,
|
bo.plan_id,
|
bo.order_status_before,
|
bo.start_time,
|
bo.end_time,
|
bo.description,
|
bp.code planCode,
|
bpt.name productName,
|
bp.plan_start_time,
|
bp.plan_end_time,
|
bp.category,
|
bp.extend_field,
|
bd.dict_value orderStatusStr
|
from blade_order bo
|
left join blade_plan bp on bp.id = bo.plan_id and bp.is_deleted = 0
|
left join blade_product bpt on bpt.id = bp.product_id and bpt.is_deleted = 0
|
left join blade_dict bd on bd.code = 'order_status' and bd.dict_key = bo.order_status and bd.is_deleted = 0
|
where bo.is_deleted = 0
|
<if test="orderQueryVO.planId != null and orderQueryVO.planId != ''">
|
and bo.plan_id = #{orderQueryVO.planId}
|
</if>
|
<if test="orderQueryVO.orderStatus != null and orderQueryVO.orderStatus.size > 0">
|
and bo.order_status in
|
<foreach collection="orderQueryVO.orderStatus" item="orderStatus" open="(" separator="," close=")">
|
#{orderStatus}
|
</foreach>
|
</if>
|
<if test="orderQueryVO.planTypeId != null and orderQueryVO.planTypeId != ''">
|
and bp.type_id = #{orderQueryVO.planTypeId}
|
</if>
|
<if test="orderQueryVO.orderCode != null and orderQueryVO.orderCode != ''">
|
and bo.order_code like concat(#{orderQueryVO.orderCode},'%')
|
</if>
|
<if test="orderQueryVO.orderId != null and orderQueryVO.orderCode != ''">
|
and bo.id = #{orderQueryVO.orderId}
|
</if>
|
order by bo.create_time desc,bo.order_code desc
|
</select>
|
</mapper>
|