懒羊羊
2024-03-15 b773030f37dc06a92bdb80e8af9a408843d5b317
提交 | 用户 | 时间
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"    />
26         <result property="spareField1"    column="spare_field_1"    />
27         <result property="spareField2"    column="spare_field_2"    />
28         <result property="spareField3"    column="spare_field_3"    />
29         <result property="spareField4"    column="spare_field_4"    />
30         <result property="collectData"    column="collect_data"    />
31         <result property="results"    column="results"    />
b77303 32         <result property="counts"    column="counts"    />
33
e57a89 34     </resultMap>
35
36     <sql id="selectBsFormulaChildInfoVo">
37         select id, workshop_code, line_code, 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_field_1, spare_field_2, spare_field_3, spare_field_4, collect_data, results from bs_formula_child_info
38     </sql>
39
40     <select id="selectBsFormulaChildInfoList" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
41         <include refid="selectBsFormulaChildInfoVo"/>
42         <where>  
43             <if test="workshopCode != null  and workshopCode != ''"> and workshop_code like concat('%', #{workshopCode}, '%')</if>
44             <if test="lineCode != null  and lineCode != ''"> and line_code like concat('%', #{lineCode}, '%')</if>
45             <if test="processesCode != null  and processesCode != ''"> and processes_code like concat('%', #{processesCode}, '%')</if>
46             <if test="productCode != null  and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
47             <if test="operationType != null  and operationType != ''"> and operation_type like concat('%', #{operationType}, '%')</if>
48             <if test="formulaCode != null  and formulaCode != ''"> and formula_code like concat('%', #{formulaCode}, '%')</if>
49             <if test="collectData != null  and collectData != ''"> and collect_data = #{collectData}</if>
50             <if test="results != null  and result != ''"> and result = #{results}</if>
51             <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
b77303 52             <if test="paramCode != null  and paramCode != ''"> and param_code = #{paramCode}</if>
53
e57a89 54
55         </where>
56         ORDER BY step_sort ASC
57     </select>
58     
59     <select id="selectBsFormulaChildInfoById" parameterType="Long" resultMap="BsFormulaChildInfoResult">
60         <include refid="selectBsFormulaChildInfoVo"/>
61         where id = #{id}
62     </select>
63         
64     <insert id="insertBsFormulaChildInfo" parameterType="BsFormulaChildInfo" useGeneratedKeys="true" keyProperty="id">
65         insert into bs_formula_child_info
66         <trim prefix="(" suffix=")" suffixOverrides=",">
67             <if test="workshopCode != null">workshop_code,</if>
68             <if test="lineCode != null">line_code,</if>
69             <if test="processesCode != null">processes_code,</if>
70             <if test="productCode != null">product_code,</if>
71             <if test="operationSteps != null">operation_steps,</if>
72             <if test="techRequirement != null">tech_requirement,</if>
73             <if test="operationType != null">operation_type,</if>
74             <if test="stepSort != null">step_sort,</if>
75             <if test="paramCode != null">param_code,</if>
76             <if test="materialCode != null">material_code,</if>
77             <if test="formulaCode != null">formula_code,</if>
78             <if test="picture != null">picture,</if>
79             <if test="remarks != null">remarks,</if>
80             <if test="createUser != null">create_user,</if>
81             <if test="createTime != null">create_time,</if>
82             <if test="updateUser != null">update_user,</if>
83             <if test="updateTime != null">update_time,</if>
84             <if test="spareField1 != null">spare_field_1,</if>
85             <if test="spareField2 != null">spare_field_2,</if>
86             <if test="spareField3 != null">spare_field_3,</if>
87             <if test="spareField4 != null">spare_field_4,</if>
88             <if test="collectData != null">collect_data,</if>
89             <if test="results != null">results,</if>
90          </trim>
91         <trim prefix="values (" suffix=")" suffixOverrides=",">
92             <if test="workshopCode != null">#{workshopCode},</if>
93             <if test="lineCode != null">#{lineCode},</if>
94             <if test="processesCode != null">#{processesCode},</if>
95             <if test="productCode != null">#{productCode},</if>
96             <if test="operationSteps != null">#{operationSteps},</if>
97             <if test="techRequirement != null">#{techRequirement},</if>
98             <if test="operationType != null">#{operationType},</if>
99             <if test="stepSort != null">#{stepSort},</if>
100             <if test="paramCode != null">#{paramCode},</if>
101             <if test="materialCode != null">#{materialCode},</if>
102             <if test="formulaCode != null">#{formulaCode},</if>
103             <if test="picture != null">#{picture},</if>
104             <if test="remarks != null">#{remarks},</if>
105             <if test="createUser != null">#{createUser},</if>
106             <if test="createTime != null">#{createTime},</if>
107             <if test="updateUser != null">#{updateUser},</if>
108             <if test="updateTime != null">#{updateTime},</if>
109             <if test="spareField1 != null">#{spareField1},</if>
110             <if test="spareField2 != null">#{spareField2},</if>
111             <if test="spareField3 != null">#{spareField3},</if>
112             <if test="spareField4 != null">#{spareField4},</if>
113             <if test="collectData != null">collect_data,</if>
114             <if test="results != null">results,</if>
115          </trim>
116     </insert>
117
118     <update id="updateBsFormulaChildInfo" parameterType="BsFormulaChildInfo">
119         update bs_formula_child_info
120         <trim prefix="SET" suffixOverrides=",">
121             <if test="workshopCode != null">workshop_code = #{workshopCode},</if>
122             <if test="lineCode != null">line_code = #{lineCode},</if>
123             <if test="processesCode != null">processes_code = #{processesCode},</if>
124             <if test="productCode != null">product_code = #{productCode},</if>
125             <if test="operationSteps != null">operation_steps = #{operationSteps},</if>
126             <if test="techRequirement != null">tech_requirement = #{techRequirement},</if>
127             <if test="operationType != null">operation_type = #{operationType},</if>
128             <if test="stepSort != null">step_sort = #{stepSort},</if>
129             <if test="paramCode != null">param_code = #{paramCode},</if>
130             <if test="materialCode != null">material_code = #{materialCode},</if>
131             <if test="formulaCode != null">formula_code = #{formulaCode},</if>
132             <if test="picture != null">picture = #{picture},</if>
133             <if test="remarks != null">remarks = #{remarks},</if>
134             <if test="createUser != null">create_user = #{createUser},</if>
135             <if test="createTime != null">create_time = #{createTime},</if>
136             <if test="updateUser != null">update_user = #{updateUser},</if>
137             <if test="updateTime != null">update_time = #{updateTime},</if>
138             <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
139             <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
140             <if test="spareField3 != null">spare_field_3 = #{spareField3},</if>
141             <if test="spareField4 != null">spare_field_4 = #{spareField4},</if>
142             <if test="collectData != null">collect_data = #{collectData},</if>
143             <if test="results != null">results = #{results},</if>
144         </trim>
145         where id = #{id}
146     </update>
147
148     <delete id="deleteBsFormulaChildInfoById" parameterType="Long">
149         delete from bs_formula_child_info where id = #{id}
150     </delete>
151
152     <delete id="deleteBsFormulaChildInfoByIds" parameterType="String">
153         delete from bs_formula_child_info where id in 
154         <foreach item="id" collection="array" open="(" separator="," close=")">
155             #{id}
156         </foreach>
157     </delete>
158
159     <select id="selectBsFormulaChildInfoByTypeTopOne" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
b77c7b 160 --         SELECT
161 --             TOP 1 *
162 --         FROM
163 --             bs_formula_child_info
164 --         WHERE NOT results = 'OK'
165 --           AND product_code =  #{productCode}
166 --           AND processes_code = #{processesCode}
167 --           AND operation_type = #{operationType}
168 --         ORDER BY step_sort ASC
e57a89 169         SELECT
170             TOP 1 *
171         FROM
172             bs_formula_child_info
b77c7b 173         WHERE
174             processes_code = #{processesCode}
175           AND product_code = #{productCode}
e57a89 176           AND operation_type = #{operationType}
b77c7b 177           AND (results IS NULL OR results = '')
e57a89 178         ORDER BY step_sort ASC
179     </select>
180
b77303 181     <select id="getCount" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
182         SELECT COUNT(*) AS counts
183         FROM bs_formula_child_info
184         WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
185           AND (results IS NULL OR results = '');
186     </select>
187
188     <select id="releaseCheck" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
189         SELECT COUNT(*) AS counts
190         FROM bs_formula_child_info
191         WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
192           AND (results IS NULL OR results = '');
e57a89 193     </select>
194
195     <update id="workpieceRelease" parameterType="BsFormulaChildInfo">
196         UPDATE bs_formula_child_info
197         SET results = ''
198         WHERE
199             product_code = #{productCode}
200           AND processes_code = #{processesCode};
201     </update>
202 </mapper>