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