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