jinlin
2024-10-15 9f401fc426b8a559f595ab49bc306e94c1d31ad8
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?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}
    </delete>
    <delete id="deleteByPid">
        delete
        from product_model
        where PID = ${id}
    </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
    </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.anchors_content            as anchorsContent,
               s.anchors_points             as anchorsPoints,
               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,
               p.task_mtbcf_regul_succ_rate as success_rate
        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
                 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
        order by sort
    </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>
    <select id="getProductPath" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
        select a.*, b.id as paramId
        from product_model a,
             param_data b
        where a.IS_DELETE = 0
          and b.IS_DELETE = 0
          and a.ship_id = ${shipId}
          and a.id = b.product_id
    </select>
    <select id="getByPid" resultType="java.lang.Long">
        select id
        from product_model
        where IS_DELETE=0 and PID=${id}
    </select>
</mapper>