<?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.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper">
|
|
<resultMap type="BsFormulaChildInfo" id="BsFormulaChildInfoResult">
|
<result property="id" column="id" />
|
<result property="workshopCode" column="workshop_code" />
|
<result property="lineCode" column="line_code" />
|
<result property="processesCode" column="processes_code" />
|
<result property="productCode" column="product_code" />
|
<result property="operationSteps" column="operation_steps" />
|
<result property="techRequirement" column="tech_requirement" />
|
<result property="operationType" column="operation_type" />
|
<result property="stepSort" column="step_sort" />
|
<result property="paramCode" column="param_code" />
|
<result property="materialCode" column="material_code" />
|
<result property="formulaCode" column="formula_code" />
|
<result property="picture" column="picture" />
|
<result property="remarks" column="remarks" />
|
<result property="createUser" column="create_user" />
|
<result property="createTime" column="create_time" />
|
<result property="updateUser" column="update_user" />
|
<result property="updateTime" column="update_time" />
|
<result property="spareField1" column="spare_field1" />
|
<result property="spareField2" column="spare_field2" />
|
<result property="spareField3" column="spare_field3" />
|
<result property="spareField4" column="spare_field4" />
|
<result property="collectData" column="collect_data" />
|
<result property="results" column="results" />
|
<result property="counts" column="counts" />
|
|
</resultMap>
|
|
<sql id="selectBsFormulaChildInfoVo">
|
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
|
</sql>
|
|
<select id="selectBsFormulaChildInfoList" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
|
<include refid="selectBsFormulaChildInfoVo"/>
|
<where>
|
<if test="workshopCode != null and workshopCode != ''"> and workshop_code like concat('%', #{workshopCode}, '%')</if>
|
<if test="lineCode != null and lineCode != ''"> and line_code like concat('%', #{lineCode}, '%')</if>
|
<if test="processesCode != null and processesCode != ''"> and processes_code like concat('%', #{processesCode}, '%')</if>
|
<if test="productCode != null and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
|
<if test="operationType != null and operationType != ''"> and operation_type like concat('%', #{operationType}, '%')</if>
|
<if test="formulaCode != null and formulaCode != ''"> and formula_code like concat('%', #{formulaCode}, '%')</if>
|
<if test="collectData != null and collectData != ''"> and collect_data = #{collectData}</if>
|
<if test="results != null and result != ''"> and result = #{results}</if>
|
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
|
<if test="paramCode != null and paramCode != ''"> and param_code = #{paramCode}</if>
|
<if test="spareField4 != null and spareField4 != ''"> and spare_field4 = #{spareField4}</if>
|
|
|
|
</where>
|
ORDER BY step_sort ASC
|
</select>
|
|
<select id="selectBsFormulaChildInfoById" parameterType="Long" resultMap="BsFormulaChildInfoResult">
|
<include refid="selectBsFormulaChildInfoVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertBsFormulaChildInfo" parameterType="BsFormulaChildInfo" useGeneratedKeys="true" keyProperty="id">
|
insert into bs_formula_child_info
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="workshopCode != null">workshop_code,</if>
|
<if test="lineCode != null">line_code,</if>
|
<if test="processesCode != null">processes_code,</if>
|
<if test="productCode != null">product_code,</if>
|
<if test="operationSteps != null">operation_steps,</if>
|
<if test="techRequirement != null">tech_requirement,</if>
|
<if test="operationType != null">operation_type,</if>
|
<if test="stepSort != null">step_sort,</if>
|
<if test="paramCode != null">param_code,</if>
|
<if test="materialCode != null">material_code,</if>
|
<if test="formulaCode != null">formula_code,</if>
|
<if test="picture != null">picture,</if>
|
<if test="remarks != null">remarks,</if>
|
<if test="createUser != null">create_user,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateUser != null">update_user,</if>
|
<if test="updateTime != null">update_time,</if>
|
<if test="spareField1 != null">spare_field1,</if>
|
<if test="spareField2 != null">spare_field2,</if>
|
<if test="spareField3 != null">spare_field3,</if>
|
<if test="spareField4 != null">spare_field4,</if>
|
<if test="collectData != null">collect_data,</if>
|
<if test="results != null">results,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="workshopCode != null">#{workshopCode},</if>
|
<if test="lineCode != null">#{lineCode},</if>
|
<if test="processesCode != null">#{processesCode},</if>
|
<if test="productCode != null">#{productCode},</if>
|
<if test="operationSteps != null">#{operationSteps},</if>
|
<if test="techRequirement != null">#{techRequirement},</if>
|
<if test="operationType != null">#{operationType},</if>
|
<if test="stepSort != null">#{stepSort},</if>
|
<if test="paramCode != null">#{paramCode},</if>
|
<if test="materialCode != null">#{materialCode},</if>
|
<if test="formulaCode != null">#{formulaCode},</if>
|
<if test="picture != null">#{picture},</if>
|
<if test="remarks != null">#{remarks},</if>
|
<if test="createUser != null">#{createUser},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateUser != null">#{updateUser},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="spareField1 != null">#{spareField1},</if>
|
<if test="spareField2 != null">#{spareField2},</if>
|
<if test="spareField3 != null">#{spareField3},</if>
|
<if test="spareField4 != null">#{spareField4},</if>
|
<if test="collectData != null">collect_data,</if>
|
<if test="results != null">results,</if>
|
</trim>
|
</insert>
|
|
<update id="updateBsFormulaChildInfo" parameterType="BsFormulaChildInfo">
|
update bs_formula_child_info
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="workshopCode != null">workshop_code = #{workshopCode},</if>
|
<if test="lineCode != null">line_code = #{lineCode},</if>
|
<if test="processesCode != null">processes_code = #{processesCode},</if>
|
<if test="productCode != null">product_code = #{productCode},</if>
|
<if test="operationSteps != null">operation_steps = #{operationSteps},</if>
|
<if test="techRequirement != null">tech_requirement = #{techRequirement},</if>
|
<if test="operationType != null">operation_type = #{operationType},</if>
|
<if test="stepSort != null">step_sort = #{stepSort},</if>
|
<if test="paramCode != null">param_code = #{paramCode},</if>
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
<if test="formulaCode != null">formula_code = #{formulaCode},</if>
|
<if test="picture != null">picture = #{picture},</if>
|
<if test="remarks != null">remarks = #{remarks},</if>
|
<if test="createUser != null">create_user = #{createUser},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="updateUser != null">update_user = #{updateUser},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="spareField1 != null">spare_field1 = #{spareField1},</if>
|
<if test="spareField2 != null">spare_field2 = #{spareField2},</if>
|
<if test="spareField3 != null">spare_field3 = #{spareField3},</if>
|
<if test="spareField4 != null">spare_field4 = #{spareField4},</if>
|
<if test="collectData != null">collect_data = #{collectData},</if>
|
<if test="results != null">results = #{results},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteBsFormulaChildInfoById" parameterType="Long">
|
delete from bs_formula_child_info where id = #{id}
|
</delete>
|
|
<delete id="deleteBsFormulaChildInfoByIds" parameterType="String">
|
delete from bs_formula_child_info where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<select id="selectBsFormulaChildInfoByTypeTopOne" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
|
-- SELECT
|
-- TOP 1 *
|
-- FROM
|
-- bs_formula_child_info
|
-- WHERE NOT results = 'OK'
|
-- AND product_code = #{productCode}
|
-- AND processes_code = #{processesCode}
|
-- AND operation_type = #{operationType}
|
-- ORDER BY step_sort ASC
|
SELECT
|
TOP 1 *
|
FROM
|
bs_formula_child_info
|
WHERE
|
processes_code = #{processesCode}
|
AND product_code = #{productCode}
|
AND operation_type = #{operationType}
|
AND (results IS NULL OR results = '')
|
ORDER BY step_sort ASC
|
</select>
|
|
<select id="getCount" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
|
SELECT COUNT(*) AS counts
|
FROM bs_formula_child_info
|
WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
|
AND (results IS NULL OR results = '');
|
</select>
|
|
<select id="releaseCheck" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
|
SELECT COUNT(*) AS counts
|
FROM bs_formula_child_info
|
WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
|
AND (results IS NULL OR results = '');
|
</select>
|
|
<update id="workpieceRelease" parameterType="BsFormulaChildInfo">
|
UPDATE bs_formula_child_info
|
SET results = ''
|
WHERE
|
product_code = #{productCode}
|
AND processes_code = #{processesCode};
|
</update>
|
</mapper>
|