admin
2024-10-15 6d313a4a6f9f9d7ea65ec50ab0d4491e595edb97
提交 | 用户 | 时间
e57a89 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper">
6     
7     <resultMap type="BsFormulaChildInfo" id="BsFormulaChildInfoResult">
8         <result property="id"    column="id"    />
9         <result property="workshopCode"    column="workshop_code"    />
10         <result property="lineCode"    column="line_code"    />
11         <result property="processesCode"    column="processes_code"    />
12         <result property="productCode"    column="product_code"    />
13         <result property="operationSteps"    column="operation_steps"    />
14         <result property="techRequirement"    column="tech_requirement"    />
15         <result property="operationType"    column="operation_type"    />
16         <result property="stepSort"    column="step_sort"    />
17         <result property="paramCode"    column="param_code"    />
18         <result property="materialCode"    column="material_code"    />
19         <result property="formulaCode"    column="formula_code"    />
20         <result property="picture"    column="picture"    />
21         <result property="remarks"    column="remarks"    />
22         <result property="createUser"    column="create_user"    />
23         <result property="createTime"    column="create_time"    />
24         <result property="updateUser"    column="update_user"    />
25         <result property="updateTime"    column="update_time"    />
0caf87 26         <result property="spareField1"    column="spare_field1"    />
27         <result property="spareField2"    column="spare_field2"    />
28         <result property="spareField3"    column="spare_field3"    />
29         <result property="spareField4"    column="spare_field4"    />
e57a89 30         <result property="collectData"    column="collect_data"    />
31         <result property="results"    column="results"    />
273d64 32         <result property="ngCollectData"    column="ng_collect_data"    />
A 33         <result property="ngResults"    column="ng_results"    />
34         <result property="ngTimes"    column="ng_times"    />
b77303 35         <result property="counts"    column="counts"    />
36
e57a89 37     </resultMap>
38
39     <sql id="selectBsFormulaChildInfoVo">
273d64 40         select id, workshop_code, line_code, ng_times,ng_results,ng_results, processes_code, product_code, operation_steps, tech_requirement, operation_type, step_sort, param_code, material_code, formula_code, picture, remarks, create_user, create_time, update_user, update_time, spare_field1, spare_field2, spare_field3, spare_field4, collect_data, results from bs_formula_child_info
e57a89 41     </sql>
42
43     <select id="selectBsFormulaChildInfoList" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
44         <include refid="selectBsFormulaChildInfoVo"/>
45         <where>  
46             <if test="workshopCode != null  and workshopCode != ''"> and workshop_code like concat('%', #{workshopCode}, '%')</if>
47             <if test="lineCode != null  and lineCode != ''"> and line_code like concat('%', #{lineCode}, '%')</if>
48             <if test="processesCode != null  and processesCode != ''"> and processes_code like concat('%', #{processesCode}, '%')</if>
49             <if test="productCode != null  and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
50             <if test="operationType != null  and operationType != ''"> and operation_type like concat('%', #{operationType}, '%')</if>
51             <if test="formulaCode != null  and formulaCode != ''"> and formula_code like concat('%', #{formulaCode}, '%')</if>
52             <if test="collectData != null  and collectData != ''"> and collect_data = #{collectData}</if>
53             <if test="results != null  and result != ''"> and result = #{results}</if>
54             <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
b77303 55             <if test="paramCode != null  and paramCode != ''"> and param_code = #{paramCode}</if>
0caf87 56             <if test="spareField4 != null  and spareField4 != ''"> and spare_field4 = #{spareField4}</if>
32483a 57
b77303 58
e57a89 59
60         </where>
61         ORDER BY step_sort ASC
62     </select>
63     
64     <select id="selectBsFormulaChildInfoById" parameterType="Long" resultMap="BsFormulaChildInfoResult">
65         <include refid="selectBsFormulaChildInfoVo"/>
66         where id = #{id}
67     </select>
68         
69     <insert id="insertBsFormulaChildInfo" parameterType="BsFormulaChildInfo" useGeneratedKeys="true" keyProperty="id">
70         insert into bs_formula_child_info
71         <trim prefix="(" suffix=")" suffixOverrides=",">
72             <if test="workshopCode != null">workshop_code,</if>
73             <if test="lineCode != null">line_code,</if>
74             <if test="processesCode != null">processes_code,</if>
75             <if test="productCode != null">product_code,</if>
76             <if test="operationSteps != null">operation_steps,</if>
77             <if test="techRequirement != null">tech_requirement,</if>
78             <if test="operationType != null">operation_type,</if>
79             <if test="stepSort != null">step_sort,</if>
80             <if test="paramCode != null">param_code,</if>
81             <if test="materialCode != null">material_code,</if>
82             <if test="formulaCode != null">formula_code,</if>
83             <if test="picture != null">picture,</if>
84             <if test="remarks != null">remarks,</if>
85             <if test="createUser != null">create_user,</if>
86             <if test="createTime != null">create_time,</if>
87             <if test="updateUser != null">update_user,</if>
88             <if test="updateTime != null">update_time,</if>
0caf87 89             <if test="spareField1 != null">spare_field1,</if>
90             <if test="spareField2 != null">spare_field2,</if>
91             <if test="spareField3 != null">spare_field3,</if>
92             <if test="spareField4 != null">spare_field4,</if>
e57a89 93             <if test="collectData != null">collect_data,</if>
94             <if test="results != null">results,</if>
273d64 95             <if test="ngCollectData != null">ng_collect_data,</if>
A 96             <if test="ngResults != null">ng_results,</if>
97             <if test="ngTimes != null">ng_times,</if>
98         </trim>
e57a89 99         <trim prefix="values (" suffix=")" suffixOverrides=",">
100             <if test="workshopCode != null">#{workshopCode},</if>
101             <if test="lineCode != null">#{lineCode},</if>
102             <if test="processesCode != null">#{processesCode},</if>
103             <if test="productCode != null">#{productCode},</if>
104             <if test="operationSteps != null">#{operationSteps},</if>
105             <if test="techRequirement != null">#{techRequirement},</if>
106             <if test="operationType != null">#{operationType},</if>
107             <if test="stepSort != null">#{stepSort},</if>
108             <if test="paramCode != null">#{paramCode},</if>
109             <if test="materialCode != null">#{materialCode},</if>
110             <if test="formulaCode != null">#{formulaCode},</if>
111             <if test="picture != null">#{picture},</if>
112             <if test="remarks != null">#{remarks},</if>
113             <if test="createUser != null">#{createUser},</if>
114             <if test="createTime != null">#{createTime},</if>
115             <if test="updateUser != null">#{updateUser},</if>
116             <if test="updateTime != null">#{updateTime},</if>
117             <if test="spareField1 != null">#{spareField1},</if>
118             <if test="spareField2 != null">#{spareField2},</if>
119             <if test="spareField3 != null">#{spareField3},</if>
120             <if test="spareField4 != null">#{spareField4},</if>
273d64 121             <if test="collectData != null">#{collectData},</if>
A 122             <if test="results != null">#{results},</if>
123             <if test="ngCollectData != null">#{ngCollectData},</if>
124             <if test="ngResults != null">#{ngResults},</if>
125             <if test="ngTimes != null">#{ngTimes},</if>
126         </trim>
e57a89 127     </insert>
128
129     <update id="updateBsFormulaChildInfo" parameterType="BsFormulaChildInfo">
130         update bs_formula_child_info
131         <trim prefix="SET" suffixOverrides=",">
132             <if test="workshopCode != null">workshop_code = #{workshopCode},</if>
133             <if test="lineCode != null">line_code = #{lineCode},</if>
134             <if test="processesCode != null">processes_code = #{processesCode},</if>
135             <if test="productCode != null">product_code = #{productCode},</if>
136             <if test="operationSteps != null">operation_steps = #{operationSteps},</if>
137             <if test="techRequirement != null">tech_requirement = #{techRequirement},</if>
138             <if test="operationType != null">operation_type = #{operationType},</if>
139             <if test="stepSort != null">step_sort = #{stepSort},</if>
140             <if test="paramCode != null">param_code = #{paramCode},</if>
141             <if test="materialCode != null">material_code = #{materialCode},</if>
142             <if test="formulaCode != null">formula_code = #{formulaCode},</if>
143             <if test="picture != null">picture = #{picture},</if>
144             <if test="remarks != null">remarks = #{remarks},</if>
145             <if test="createUser != null">create_user = #{createUser},</if>
146             <if test="createTime != null">create_time = #{createTime},</if>
147             <if test="updateUser != null">update_user = #{updateUser},</if>
148             <if test="updateTime != null">update_time = #{updateTime},</if>
0caf87 149             <if test="spareField1 != null">spare_field1 = #{spareField1},</if>
150             <if test="spareField2 != null">spare_field2 = #{spareField2},</if>
151             <if test="spareField3 != null">spare_field3 = #{spareField3},</if>
152             <if test="spareField4 != null">spare_field4 = #{spareField4},</if>
e57a89 153             <if test="collectData != null">collect_data = #{collectData},</if>
154             <if test="results != null">results = #{results},</if>
273d64 155             <if test="ngCollectData != null">ng_collect_data = #{ngCollectData},</if>
A 156             <if test="ngResults != null">ng_results = #{ngResults},</if>
157             <if test="ngTimes != null">ng_times = #{ngTimes},</if>
e57a89 158         </trim>
159         where id = #{id}
160     </update>
161
162     <delete id="deleteBsFormulaChildInfoById" parameterType="Long">
163         delete from bs_formula_child_info where id = #{id}
164     </delete>
165
166     <delete id="deleteBsFormulaChildInfoByIds" parameterType="String">
167         delete from bs_formula_child_info where id in 
168         <foreach item="id" collection="array" open="(" separator="," close=")">
169             #{id}
170         </foreach>
171     </delete>
172
173     <select id="selectBsFormulaChildInfoByTypeTopOne" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
b77c7b 174 --         SELECT
175 --             TOP 1 *
176 --         FROM
177 --             bs_formula_child_info
178 --         WHERE NOT results = 'OK'
179 --           AND product_code =  #{productCode}
180 --           AND processes_code = #{processesCode}
181 --           AND operation_type = #{operationType}
182 --         ORDER BY step_sort ASC
e57a89 183         SELECT
184             TOP 1 *
185         FROM
186             bs_formula_child_info
b77c7b 187         WHERE
188             processes_code = #{processesCode}
189           AND product_code = #{productCode}
e57a89 190           AND operation_type = #{operationType}
b77c7b 191           AND (results IS NULL OR results = '')
e57a89 192         ORDER BY step_sort ASC
193     </select>
194
b77303 195     <select id="getCount" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
196         SELECT COUNT(*) AS counts
197         FROM bs_formula_child_info
198         WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
199           AND (results IS NULL OR results = '');
200     </select>
201
202     <select id="releaseCheck" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
203         SELECT COUNT(*) AS counts
204         FROM bs_formula_child_info
205         WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
206           AND (results IS NULL OR results = '');
e57a89 207     </select>
208
209     <update id="workpieceRelease" parameterType="BsFormulaChildInfo">
210         UPDATE bs_formula_child_info
211         SET results = ''
212         WHERE
213             product_code = #{productCode}
214           AND processes_code = #{processesCode};
215     </update>
216 </mapper>