|
|
|
<?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.device.mapper.EquPlanMapper">
|
|
|
|
|
|
|
|
<resultMap type="EquPlan" id="EquPlanResult">
|
|
|
|
<result property="planId" column="plan_id" />
|
|
|
|
<result property="planCode" column="plan_code" />
|
|
|
|
<result property="planName" column="plan_name" />
|
|
|
|
<result property="planWorkshop" column="plan_workshop" />
|
|
|
|
<result property="planProdLine" column="plan_prod_line" />
|
|
|
|
<result property="equipmentName" column="equipment_name" />
|
|
|
|
<result property="equipmentCode" column="equipment_code" />
|
|
|
|
<result property="planLoop" column="plan_loop" />
|
|
|
|
<result property="planLoopType" column="plan_loop_type" />
|
|
|
|
<result property="planLoopStart" column="plan_loop_start" />
|
|
|
|
<result property="planLoopEnd" column="plan_loop_end" />
|
|
|
|
<result property="planPerson" column="plan_person" />
|
|
|
|
<result property="planStatus" column="plan_status" />
|
|
|
|
<result property="planRestrict" column="plan_restrict" />
|
|
|
|
<result property="planType" column="plan_type" />
|
|
|
|
<result property="planOutsource" column="plan_outsource" />
|
|
|
|
<result property="workCode" column="work_code" />
|
|
|
|
<result property="factoryCode" column="factory_code" />
|
|
|
|
<result property="attr1" column="attr1" />
|
|
|
|
<result property="attr2" column="attr2" />
|
|
|
|
<result property="attr3" column="attr3" />
|
|
|
|
<result property="delFlag" column="del_flag" />
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectEquPlanVo">
|
|
|
|
select plan_id, plan_code, plan_name, plan_workshop, plan_prod_line, equipment_name, equipment_code, plan_loop, plan_loop_type, plan_loop_start, plan_loop_end, plan_person, plan_status, plan_restrict, plan_type, plan_outsource, work_code, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectEquPlanList" parameterType="EquPlan" resultMap="EquPlanResult">
|
|
|
|
<include refid="selectEquPlanVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="planCode != null and planCode != ''"> and plan_code like concat('%', #{planCode}, '%')</if>
|
|
|
|
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
|
|
|
|
<if test="planWorkshop != null and planWorkshop != ''"> and plan_workshop like concat('%', #{planWorkshop}, '%')</if>
|
|
|
|
<if test="planProdLine != null and planProdLine != ''"> and plan_prod_line like concat('%', #{planProdLine}, '%')</if>
|
|
|
|
<if test="equipmentName != null and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code like concat('%', #{equipmentCode}, '%')</if>
|
|
|
|
<if test="planLoop != null and planLoop != ''"> and plan_loop like concat('%', #{planLoop}, '%')</if>
|
|
|
|
<if test="planLoopType != null and planLoopType != ''"> and plan_loop_type = #{planLoopType}</if>
|
|
|
|
<if test="planLoopStart != null "> and plan_loop_start = #{planLoopStart}</if>
|
|
|
|
<if test="planLoopEnd != null "> and plan_loop_end = #{planLoopEnd}</if>
|
|
|
|
<if test="planPerson != null and planPerson != ''"> and plan_person like concat('%', #{planPerson}, '%')</if>
|
|
|
|
<if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if>
|
|
|
|
<if test="planRestrict != null and planRestrict != ''"> and plan_restrict = #{planRestrict}</if>
|
|
|
|
<if test="planType != null and planType != ''"> and plan_type = #{planType}</if>
|
|
|
|
<if test="planOutsource != null and planOutsource != ''"> and plan_outsource = #{planOutsource}</if>
|
|
|
|
<if test="workCode != null and workCode != ''"> and work_code like concat('%', #{workCode}, '%')</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
|
|
|
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
|
|
|
|
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
|
|
|
|
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
|
|
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
|
|
|
<if test="createTimeStart != null "> and CONVERT(date,create_time) >= #{createTimeStart}</if>
|
|
|
|
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,create_time)</if>
|
|
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
|
|
<if test="updateTimeStart != null "> and CONVERT(date,update_time) >= #{updateTimeStart}</if>
|
|
|
|
<if test="updateTimeEnd != null "> and #{updateTimeEnd} >= CONVERT(date,update_time)</if>
|
|
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEquPlanByPlanId" parameterType="String" resultMap="EquPlanResult">
|
|
|
|
<include refid="selectEquPlanVo"/>
|
|
|
|
where plan_id = #{planId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectSerialNumber" resultType="java.lang.Integer">
|
|
|
|
SELECT COUNT(plan_id)+1 AS serialNum
|
|
|
|
FROM equ_plan
|
|
|
|
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertEquPlan" parameterType="EquPlan">
|
|
|
|
insert into equ_plan
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="planId != null">plan_id,</if>
|
|
|
|
<if test="planCode != null and planCode != ''">plan_code,</if>
|
|
|
|
<if test="planName != null and planName != ''">plan_name,</if>
|
|
|
|
<if test="planWorkshop != null and planWorkshop != ''">plan_workshop,</if>
|
|
|
|
<if test="planProdLine != null and planProdLine != ''">plan_prod_line,</if>
|
|
|
|
<if test="equipmentName != null and equipmentName != ''">equipment_name,</if>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''">equipment_code,</if>
|
|
|
|
<if test="planLoop != null and planLoop != ''">plan_loop,</if>
|
|
|
|
<if test="planLoopType != null and planLoopType != ''">plan_loop_type,</if>
|
|
|
|
<if test="planLoopStart != null">plan_loop_start,</if>
|
|
|
|
<if test="planLoopEnd != null">plan_loop_end,</if>
|
|
|
|
<if test="planPerson != null and planPerson != ''">plan_person,</if>
|
|
|
|
<if test="planStatus != null and planStatus != ''">plan_status,</if>
|
|
|
|
<if test="planRestrict != null">plan_restrict,</if>
|
|
|
|
<if test="planType != null and planType != ''">plan_type,</if>
|
|
|
|
<if test="planOutsource != null and planOutsource != ''">plan_outsource,</if>
|
|
|
|
<if test="workCode != null">work_code,</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
|
|
|
|
<if test="attr1 != null">attr1,</if>
|
|
|
|
<if test="attr2 != null">attr2,</if>
|
|
|
|
<if test="attr3 != null">attr3,</if>
|
|
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="planId != null">#{planId},</if>
|
|
|
|
<if test="planCode != null and planCode != ''">#{planCode},</if>
|
|
|
|
<if test="planName != null and planName != ''">#{planName},</if>
|
|
|
|
<if test="planWorkshop != null and planWorkshop != ''">#{planWorkshop},</if>
|
|
|
|
<if test="planProdLine != null and planProdLine != ''">#{planProdLine},</if>
|
|
|
|
<if test="equipmentName != null and equipmentName != ''">#{equipmentName},</if>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
|
|
|
|
<if test="planLoop != null and planLoop != ''">#{planLoop},</if>
|
|
|
|
<if test="planLoopType != null and planLoopType != ''">#{planLoopType},</if>
|
|
|
|
<if test="planLoopStart != null">#{planLoopStart},</if>
|
|
|
|
<if test="planLoopEnd != null">#{planLoopEnd},</if>
|
|
|
|
<if test="planPerson != null and planPerson != ''">#{planPerson},</if>
|
|
|
|
<if test="planStatus != null and planStatus != ''">#{planStatus},</if>
|
|
|
|
<if test="planRestrict != null">#{planRestrict},</if>
|
|
|
|
<if test="planType != null and planType != ''">#{planType},</if>
|
|
|
|
<if test="planOutsource != null and planOutsource != ''">#{planOutsource},</if>
|
|
|
|
<if test="workCode != null">#{workCode},</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
|
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateEquPlan" parameterType="EquPlan">
|
|
|
|
update equ_plan
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
|
|
|
|
<if test="planName != null and planName != ''">plan_name = #{planName},</if>
|
|
|
|
<if test="planWorkshop != null and planWorkshop != ''">plan_workshop = #{planWorkshop},</if>
|
|
|
|
<if test="planProdLine != null and planProdLine != ''">plan_prod_line = #{planProdLine},</if>
|
|
|
|
<if test="equipmentName != null and equipmentName != ''">equipment_name = #{equipmentName},</if>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''">equipment_code = #{equipmentCode},</if>
|
|
|
|
<if test="planLoop != null and planLoop != ''">plan_loop = #{planLoop},</if>
|
|
|
|
<if test="planLoopType != null and planLoopType != ''">plan_loop_type = #{planLoopType},</if>
|
|
|
|
<if test="planLoopStart != null">plan_loop_start = #{planLoopStart},</if>
|
|
|
|
<if test="planLoopEnd != null">plan_loop_end = #{planLoopEnd},</if>
|
|
|
|
<if test="planPerson != null and planPerson != ''">plan_person = #{planPerson},</if>
|
|
|
|
<if test="planStatus != null and planStatus != ''">plan_status = #{planStatus},</if>
|
|
|
|
<if test="planRestrict != null">plan_restrict = #{planRestrict},</if>
|
|
|
|
<if test="planType != null and planType != ''">plan_type = #{planType},</if>
|
|
|
|
<if test="planOutsource != null and planOutsource != ''">plan_outsource = #{planOutsource},</if>
|
|
|
|
<if test="workCode != null">work_code = #{workCode},</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
|
|
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
|
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
|
|
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
|
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
|
|
<if test="createTimeStart != null "> and CONVERT(date,create_time) >= #{createTimeStart}</if>
|
|
|
|
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,create_time)</if>
|
|
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
|
|
<if test="updateTimeStart != null "> and CONVERT(date,update_time) >= #{updateTimeStart}</if>
|
|
|
|
<if test="updateTimeEnd != null "> and #{updateTimeEnd} >= CONVERT(date,update_time)</if>
|
|
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
|
|
and del_flag = '0'
|
|
|
|
</trim>
|
|
|
|
where plan_id = #{planId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteEquPlanByPlanId" parameterType="String">
|
|
|
|
delete from equ_plan where plan_id = #{planId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteEquPlanByPlanIds" parameterType="String">
|
|
|
|
delete from equ_plan where plan_id in
|
|
|
|
<foreach item="planId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{planId}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|