You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
16 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
1 year ago
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.device.mapper.EquPlanMapper">
1 year ago
<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="upkeep" column="upkeep"/>
<result property="calculationRule" column="calculation_rule"/>
<result property="shutDown" column="shut_down"/>
<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"/>
<result property="workPerson" column="work_person"/>
<result property="workOutsourcingUnit" column="work_outsourcing_unit"/>
<result property="workConnection" column="work_connection"/>
<result property="workReason" column="work_reason"/>
</resultMap>
1 year ago
<sql id="selectEquPlanVo">
1 year ago
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, upkeep, calculation_rule, shut_down, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time , work_person, work_outsourcing_unit, work_connection,work_reason from equ_plan
</sql>
1 year ago
<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="workPerson != null and workPerson != ''">and work_person = #{workPerson}</if>
<if test="workOutsourcingUnit != null and workOutsourcingUnit != ''">and work_outsourcing_unit =
#{workOutsourcingUnit}
</if>
<if test="workConnection != null and workConnection != ''">and work_connection = #{workConnection}</if>
<if test="workReason != null and workReason != ''">and work_reason = #{workReason}</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>
<if test="upkeep != null and upkeep != ''">and upkeep = #{upkeep}</if>
<if test="calculationRule != null and calculationRule != ''">and calculation_rule = #{calculationRule}</if>
<if test="shutDown != null and shutDown != ''">and shut_down = #{shutDown}</if>
<if test="loopStart != null ">and CONVERT(date,plan_loop_start) >= #{loopStart}</if>
<if test="loopEnd != null ">and #{loopEnd} >= CONVERT(date,plan_loop_start)</if>
<if test="loopEndArrayStart != null ">and CONVERT(date,plan_loop_end) >= #{loopEndArrayStart}</if>
<if test="getLoopEndArrayEnd != null ">and #{getLoopEndArrayEnd} >= CONVERT(date,plan_loop_end)</if>
and del_flag = '0'
</where>
order by create_time desc
</select>
1 year ago
<select id="selectEquPlanByPlanId" parameterType="String" resultMap="EquPlanResult">
<include refid="selectEquPlanVo"/>
where plan_id = #{planId} and del_flag = '0'
</select>
1 year ago
<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)
</select>
1 year ago
<select id="selectWorkCenter" resultType="com.op.device.domain.WorkCenter">
select factory_id AS 'factoryId', factory_name AS 'factoryName', factory_code AS 'factoryCode', f_type AS 'fType'
from sys_factory
where parent_id = (select factory_id from sys_factory where factory_code = #{factory}) and f_type = 'c'
</select>
1 year ago
<select id="selectEquPlanByPlanCode" parameterType="String" resultMap="EquPlanResult">
<include refid="selectEquPlanVo"/>
where plan_code = #{planCode} and del_flag = '0'
</select>
1 year ago
<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="upkeep != null">upkeep,</if>
<if test="calculationRule != null">calculation_rule,</if>
<if test="shutDown != null">shut_down,</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>
<if test="workPerson != null">work_person,</if>
<if test="workOutsourcingUnit != null">work_outsourcing_unit,</if>
<if test="workConnection != null">work_connection,</if>
<if test="workReason != null">work_reason,</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="upkeep != null">#{upkeep},</if>
<if test="calculationRule != null">#{calculationRule},</if>
<if test="shutDown != null">#{shutDown},</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>
<if test="workPerson != null">#{workPerson},</if>
<if test="workOutsourcingUnit != null">#{workOutsourcingUnit},</if>
<if test="workConnection != null">#{workConnection},</if>
<if test="workReason != null">#{workReason},</if>
</trim>
</insert>
1 year ago
<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="upkeep != null">upkeep = #{upkeep},</if>
<if test="calculationRule != null">calculation_rule = #{calculationRule},</if>
<if test="shutDown != null">shut_down = #{shutDown},</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="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="workPerson != null">work_person = #{workPerson},</if>
<if test="workOutsourcingUnit != null">work_outsourcing_unit = #{workOutsourcingUnit},</if>
<if test="workConnection != null">work_connection = #{workConnection},</if>
<if test="workReason != null">work_reason = #{workReason},</if>
</trim>
where plan_id = #{planId}
</update>
1 year ago
<delete id="deleteEquPlanByPlanId" parameterType="String">
delete from equ_plan where plan_id = #{planId}
</delete>
1 year ago
<delete id="deleteEquPlanByPlanIds" parameterType="String">
delete from equ_plan where plan_id in
<foreach item="planId" collection="array" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
1 year ago
<delete id="delEquPlanByPlanCode">
update equ_plan set del_flag = '1' where plan_code = #{planCode} and del_flag = '0'
</delete>
1 year ago
</mapper>