zss
2 天以前 c145f0e2c2a4a301f11c8b4c132f50c8a56bec62
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
<?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.ruoyi.production.mapper.ProductOrderMapper">
 
 
    <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProductOrder">
        <id property="id" column="id"/>
        <result property="productModelId" column="product_model_id"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="salesLedgerId" column="sales_ledger_id"/>
        <result property="routeId" column="route_id"/>
        <result property="npsNo" column="nps_no"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <select id="pageProductOrder" resultType="com.ruoyi.production.dto.ProductOrderDto">
        select po.*,
        sl.sales_contract_no,
        sl.customer_name,
        slp.product_category,
        slp.specification_model,
        ppr.process_route_code,
        ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus
        from product_order po
        left join sales_ledger sl on po.sales_ledger_id = sl.id
        left join sales_ledger_product slp on po.product_model_id = slp.id
        left join product_process_route ppr on po.id = ppr.product_order_id
        <where>
            <if test="c.npsNo != null and c.npsNo != ''">
                and po.nps_no like concat('%',#{c.npsNo},'%')
            </if>
            <if test="c.salesContractNo != null and c.salesContractNo != ''">
                and sl.sales_contract_no like concat('%',#{c.salesContractNo},'%')
            </if>
            <if test="c.customerName != null and c.customerName != ''">
                and sl.customer_name like concat('%',#{c.customerName},'%')
            </if>
            <if test="c.productCategory != null and c.productCategory != ''">
                and slp.product_category like concat('%',#{c.productCategory},'%')
            </if>
            <if test="c.specificationModel != null and c.specificationModel != ''">
                and slp.specification_model like concat('%',#{c.specificationModel},'%')
            </if>
        </where>
    </select>
    <select id="productMainByOrderId" resultType="com.ruoyi.production.dto.ProductOrderDto">
        select po.*,
               pwo.work_order_no,
               pwo.report_work,
               pwo.status,
               pwo.quantity,
               pwo.plan_quantity
        from product_order po
                 left join product_work_order pwo on po.id = pwo.product_order_id
        where po.id = #{c.id}
    </select>
    <select id="listProcessRoute" resultType="com.ruoyi.production.pojo.ProcessRoute">
        select pr.*
        from process_route pr
                 left join product_model pm on pr.product_model_id = pm.id
                 left join sales_ledger_product slp on pm.id = slp.product_model_id
        where slp.id = #{productModelId}
    </select>
 
 
</mapper>