jinlin
2024-07-30 481b82866b1714f79dc35ecf2bc26436b027954e
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?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.zt.life.modules.mainPart.basicInfo.dao.XhProductModelDao">
    <delete id="deleteByShipId">
        delete from product_model where ship_id =${shipId} and product_type &gt; 2
    </delete>
 
    <select id="getList" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select *
        from product_model
        <where>
            is_delete = 0
            <if test="pid!=null">
                and pid =${pid}
            </if>
            <if test="pid==null">
                and pid is null
            </if>
            <if test="whereSql!=null">
                and ${whereSql}
            </if>
        </where>
        ORDER BY
        product_type,sort
    </select>
    <select id="getNo" resultType="java.lang.Integer">
        SELECT COUNT(*)
        FROM product_model
        <where>
            is_delete = 0
            <if test="pid!=null">
                and pid = ${pid}
            </if>
            <if test="pid==null">
                and pid is null
            </if>
            and product_type =${productType}
        </where>
        Group by product_type
    </select>
    <select id="getProductList" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select a.name, a.id
        from product_model a
        where a.is_delete = 0
          and a.product_type = 1
    </select>
    <select id="getProduct" resultType="com.zt.life.modules.mainPart.basicInfo.model.ProductImg">
        SELECT a.operat_img                as imgPath,
               a.`NAME`                    as imgName,
               'node'                      as nodeType,
               ''                          as nodeTypeExt,
               s.svg_content               as svgContent,
               s.width                     as imgWidth,
               s.height                    as imgHeight,
               a.id                        as dataId,
               ''                          as statusImg,
               d.dict_code                 as productType,
               p.repairable                as isRepair,
               p.task_mtbcf_accept         as taskMtbcf,
               p.task_mtbcf_other_params2   as taskMtbcfOtherParams2,
               p.task_mtbcf_other_params3   as taskMtbcfOtherParams3,
               p.reliab_distrib_type       as reliabDistribType,
               p.repair_distrib_type       as repairDistribType,
               p.repair_mttcr              as repairMttcr,
               p.repair_mttcr_other_params2 as repairMttcrOtherParams2,
               p.repair_mttcr_other_params3 as repairMttcrOtherParams3
        FROM product_model a
                 left join sys_dict_data d on d.DICT_VALUE = a.product_type and dict_type_id = '1728965873022050306'
                 left join param_data p on p.product_id = a.id and p.page_code = 'expect'
                 left join sys_picture_base s on s.id = a.operat_img
        WHERE a.is_delete = 0
          AND ((a.PID = ${productId})
            or (a.PID in (select pid from product_model where id = ${productId} and product_type = 10) and
                a.product_type &lt;&gt; 10))
          and a.id not in (
            select node_id
            from model_rbd_node
            where product_id in (
                select pid
                from product_model
                where id = ${productId}
                  and is_delete = 0
                union
                select id
                from product_model
                where is_delete = 0
                  and pid = ${parentId}
                  and id &lt;&gt; ${productId}
            )
            union
            select node_id
            from model_rbd_node
            where product_id in (
                select id
                from product_model
                where is_delete = 0 and pid = ${productId}
            )
        )
 
 
 
    </select>
    <select id="getTaskProductList" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select a.name, a.id
        from product_model a
        where a.is_delete = 0
          and a.product_type = 2
    </select>
    <select id="getById" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select a.*
        from product_model a
        where a.is_delete = 0
          and a.id = #{id}
    </select>
    <select id="getByShipId" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select a.*
        from product_model a
        where a.is_delete = 0
          and a.ship_id = #{shipId}
          and a.product_type &gt; 2
    </select>
 
    <select id="getProductTree" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select a.*
        from product_model a
        where a.is_delete = 0
        <if test="shipId!=null">
            and a.ship_id = #{shipId}
        </if>
    </select>
</mapper>