yangys
2024-04-02 1a77b1a7c072b136925d6d73c4d8f017ca016e3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?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>