|
|
|
|
<?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.op.quality.mapper.QcGoalMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="QcGoal" id="QcGoalResult">
|
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="goalYm" column="goal_ym"/>
|
|
|
|
|
<result property="goalType" column="goal_type"/>
|
|
|
|
|
<result property="nookRate" column="noOk_rate"/>
|
|
|
|
|
<result property="nookQualityRate" column="noOk_quality_rate"/>
|
|
|
|
|
<result property="attr1" column="attr1"/>
|
|
|
|
|
<result property="attr2" column="attr2"/>
|
|
|
|
|
<result property="attr3" column="attr3"/>
|
|
|
|
|
<result property="attr4" column="attr4"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="factoryCode" column="factory_code"/>
|
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
|
<result property="checkType" column="check_type"/>
|
|
|
|
|
<result property="typeCode" column="type_code"/>
|
|
|
|
|
<result property="scope" column="scope"/>
|
|
|
|
|
<result property="parentGoal" column="parent_goal"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectQcGoalVo">
|
|
|
|
|
select id, goal_ym, goal_type, noOk_rate, noOk_quality_rate, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag, check_type, type_code, scope, parent_goal from qc_goal
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectQcGoalList" parameterType="QcGoal" resultMap="QcGoalResult">
|
|
|
|
|
<include refid="selectQcGoalVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="goalYm != null and goalYm != ''">
|
|
|
|
|
and goal_ym = #{goalYm}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="goalType != null and goalType != ''">
|
|
|
|
|
and goal_type = #{goalType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookRate != null ">
|
|
|
|
|
and noOk_rate = #{nookRate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookQualityRate != null ">
|
|
|
|
|
and noOk_quality_rate = #{nookQualityRate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">
|
|
|
|
|
and factory_code = #{factoryCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkType != null and checkType != ''">
|
|
|
|
|
and check_type = #{checkType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="typeCode != null and typeCode != ''">
|
|
|
|
|
and type_code = #{typeCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="scope != null and scope != ''">
|
|
|
|
|
and scope = #{scope}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentGoal != null and parentGoal != ''">
|
|
|
|
|
and parent_goal = #{parentGoal}
|
|
|
|
|
</if>
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
</where>
|
|
|
|
|
order by id desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectChildrenByParent" parameterType="QcGoal" resultMap="QcGoalResult">
|
|
|
|
|
<include refid="selectQcGoalVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="goalYm != null and goalYm != ''">
|
|
|
|
|
and goal_ym = #{goalYm}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="goalType != null and goalType != ''">
|
|
|
|
|
and goal_type = #{goalType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookRate != null ">
|
|
|
|
|
and noOk_rate = #{nookRate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookQualityRate != null ">
|
|
|
|
|
and noOk_quality_rate = #{nookQualityRate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">
|
|
|
|
|
and factory_code = #{factoryCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkType != null and checkType != ''">
|
|
|
|
|
and check_type = #{checkType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="typeCode != null and typeCode != ''">
|
|
|
|
|
and type_code = #{typeCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="scope != null and scope != ''">
|
|
|
|
|
and scope = #{scope}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentGoal != null and parentGoal != ''">
|
|
|
|
|
and parent_goal = #{parentGoal}
|
|
|
|
|
</if>
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
</where>
|
|
|
|
|
order by id asc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectQcGoalById" parameterType="String"
|
|
|
|
|
resultMap="QcGoalResult">
|
|
|
|
|
<include refid="selectQcGoalVo"/>
|
|
|
|
|
where del_flag= = '0' id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertQcGoal" parameterType="QcGoal">
|
|
|
|
|
insert into qc_goal
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="goalYm != null">goal_ym,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="goalType != null">goal_type,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookRate != null">noOk_rate,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookQualityRate != null">noOk_quality_rate,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">create_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">create_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">update_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">update_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">del_flag,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkType != null">check_type,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="typeCode != null">type_code,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="scope != null">scope,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentGoal != null">parent_goal,
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">#{id},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="goalYm != null">#{goalYm},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="goalType != null">#{goalType},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookRate != null">#{nookRate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookQualityRate != null">#{nookQualityRate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">#{delFlag},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkType != null">#{checkType},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="typeCode != null">#{typeCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="scope != null">#{scope},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentGoal != null">#{parentGoal},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertQcGoalList" parameterType="List">
|
|
|
|
|
insert into qc_goal(id,goal_ym,goal_type,noOk_rate,noOk_quality_rate,create_by,create_time,
|
|
|
|
|
update_by,update_time,factory_code,check_type,type_code,scope,parent_goal)values
|
|
|
|
|
<foreach collection="qcGoalList" item="item" index="index" separator=",">
|
|
|
|
|
(#{item.id},
|
|
|
|
|
#{item.goalYm},
|
|
|
|
|
#{item.goalType},
|
|
|
|
|
#{item.nookRate},
|
|
|
|
|
#{item.nookQualityRate},
|
|
|
|
|
#{item.createBy},
|
|
|
|
|
#{item.createTime},
|
|
|
|
|
#{item.updateBy},
|
|
|
|
|
#{item.updateTime},
|
|
|
|
|
#{item.factoryCode},
|
|
|
|
|
#{item.checkType},
|
|
|
|
|
#{item.typeCode},
|
|
|
|
|
#{item.scope},
|
|
|
|
|
#{item.parentGoal})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateQcGoal" parameterType="QcGoal">
|
|
|
|
|
update qc_goal
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="goalYm != null">goal_ym =
|
|
|
|
|
#{goalYm},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="goalType != null">goal_type =
|
|
|
|
|
#{goalType},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookRate != null">noOk_rate =
|
|
|
|
|
#{nookRate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nookQualityRate != null">noOk_quality_rate =
|
|
|
|
|
#{nookQualityRate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">create_by =
|
|
|
|
|
#{createBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">create_time =
|
|
|
|
|
#{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">update_by =
|
|
|
|
|
#{updateBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">update_time =
|
|
|
|
|
#{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code =
|
|
|
|
|
#{factoryCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">del_flag =
|
|
|
|
|
#{delFlag},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkType != null">check_type =
|
|
|
|
|
#{checkType},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="typeCode != null">type_code =
|
|
|
|
|
#{typeCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="scope != null">scope =
|
|
|
|
|
#{scope},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentGoal != null">parent_goal =
|
|
|
|
|
#{parentGoal},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<select id="getTodayMaxNum" resultType="java.lang.Integer">
|
|
|
|
|
select count(0)+1
|
|
|
|
|
from qc_goal
|
|
|
|
|
where CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteQcGoalById" parameterType="String">
|
|
|
|
|
update qc_goal set del_flag = '1' where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteQcGoalByIds" parameterType="String">
|
|
|
|
|
update qc_goal set del_flag = '1' where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|