|
|
|
<?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.EquOutsourceWorkMapper">
|
|
|
|
|
|
|
|
<resultMap type="EquOutsourceWork" id="EquOutsourceWorkResult">
|
|
|
|
<result property="workId" column="work_id" />
|
|
|
|
<result property="workCode" column="work_code" />
|
|
|
|
<result property="orderCode" column="order_code" />
|
|
|
|
<result property="repairCode" column="repair_code" />
|
|
|
|
<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" />
|
|
|
|
<result property="workType" column="work_type" />
|
|
|
|
<result property="equipmentCode" column="equipment_code" />
|
|
|
|
<result property="workCost" column="work_cost" />
|
|
|
|
<result property="workCostTime" column="work_cost_time" />
|
|
|
|
<result property="workStatus" column="work_status" />
|
|
|
|
<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="factoryCode" column="factory_code" />
|
|
|
|
<!--设备-->
|
|
|
|
<result property="equipmentName" column="equipment_name" />
|
|
|
|
<result property="equipmentSpec" column="equipment_spec" />
|
|
|
|
<result property="equipmentTypeName" column="equipment_type_name" />
|
|
|
|
<result property="equipmentLocation" column="equipment_location" />
|
|
|
|
<result property="department" column="department" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectEquOutsourceWorkVo">
|
|
|
|
select work_id, work_code,order_code, repair_code, work_person, work_outsourcing_unit, work_connection, work_reason, work_type, equipment_code, work_cost, work_cost_time,work_status, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time, factory_code from equ_outsource_work
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectEquOutsourceWorkList" parameterType="EquOutsourceWork" resultMap="EquOutsourceWorkResult">
|
|
|
|
select
|
|
|
|
eow.work_id,
|
|
|
|
eow.work_code,
|
|
|
|
eow.order_code,
|
|
|
|
eow.repair_code,
|
|
|
|
eow.work_person,
|
|
|
|
eow.work_outsourcing_unit,
|
|
|
|
eow.work_connection,
|
|
|
|
eow.work_reason,
|
|
|
|
eow.work_type,
|
|
|
|
eow.equipment_code,
|
|
|
|
eow.work_cost,
|
|
|
|
eow.work_cost_time,
|
|
|
|
eow.work_status,
|
|
|
|
eow.attr1,
|
|
|
|
eow.attr2,
|
|
|
|
eow.attr3,
|
|
|
|
eow.del_flag,
|
|
|
|
eow.create_by,
|
|
|
|
eow.create_time,
|
|
|
|
eow.update_by,
|
|
|
|
eow.update_time,
|
|
|
|
eow.factory_code,
|
|
|
|
be.equipment_name,
|
|
|
|
be.equipment_type_name,
|
|
|
|
be.equipment_spec,
|
|
|
|
be.department,
|
|
|
|
be.equipment_location
|
|
|
|
from equ_outsource_work eow
|
|
|
|
left join base_equipment be on eow.equipment_code = be.equipment_code
|
|
|
|
<where>
|
|
|
|
<if test="workCode != null and workCode != ''"> and work_code like concat('%', #{workCode}, '%')</if>
|
|
|
|
<if test="orderCode != null and orderCode != ''"> and order_code like concat('%', #{orderCode}, '%')</if>
|
|
|
|
<if test="repairCode != null and repairCode != ''"> and repair_code like concat('%', #{repairCode}, '%')</if>
|
|
|
|
<if test="workPerson != null and workPerson != ''"> and work_person like concat('%', #{workPerson}, '%')</if>
|
|
|
|
<if test="workOutsourcingUnit != null and workOutsourcingUnit != ''"> and work_outsourcing_unit like concat('%', #{workOutsourcingUnit}, '%')</if>
|
|
|
|
<if test="workConnection != null and workConnection != ''"> and work_connection like concat('%', #{workConnection}, '%')</if>
|
|
|
|
<if test="workReason != null and workReason != ''"> and work_reason like concat('%', #{workReason}, '%')</if>
|
|
|
|
<if test="workType != null and workType != ''"> and work_type = #{workType}</if>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code like concat('%', #{equipmentCode}, '%')</if>
|
|
|
|
<if test="workCost != null and workCost != ''"> and work_cost like concat('%', #{workCost}, '%')</if>
|
|
|
|
<if test="workCostTime != null and workCostTime != ''"> and work_cost_time like concat('%', #{workCostTime}, '%')</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="createTime != null and createTime != ''"> and create_time = #{createTime}</if>
|
|
|
|
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
|
|
|
and eow.del_flag = '0'
|
|
|
|
ORDER BY eow.create_time DESC
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEquOutsourceWorkByWorkId" parameterType="String" resultMap="EquOutsourceWorkResult">
|
|
|
|
<include refid="selectEquOutsourceWorkVo"/>
|
|
|
|
where work_id = #{workId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertEquOutsourceWork" parameterType="EquOutsourceWork">
|
|
|
|
insert into equ_outsource_work
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="workId != null">work_id,</if>
|
|
|
|
<if test="workCode != null">work_code,</if>
|
|
|
|
<if test="orderCode != null">order_code,</if>
|
|
|
|
<if test="repairCode != null">repair_code,</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>
|
|
|
|
<if test="workType != null">work_type,</if>
|
|
|
|
<if test="equipmentCode != null">equipment_code,</if>
|
|
|
|
<if test="workCost != null">work_cost,</if>
|
|
|
|
<if test="workCostTime != null">work_cost_time,</if>
|
|
|
|
<if test="workStatus != null">work_status,</if>
|
|
|
|
<if test="attr1 != null">attr1,</if>
|
|
|
|
<if test="attr2 != null">attr2,</if>
|
|
|
|
<if test="attr3 != null">attr3,</if>
|
|
|
|
<if test="delFlag != null">del_flag,</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">factory_code,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="workId != null">#{workId},</if>
|
|
|
|
<if test="workCode != null">#{workCode},</if>
|
|
|
|
<if test="orderCode != null">#{orderCode},</if>
|
|
|
|
<if test="repairCode != null">#{repairCode},</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>
|
|
|
|
<if test="workType != null">#{workType},</if>
|
|
|
|
<if test="equipmentCode != null">#{equipmentCode},</if>
|
|
|
|
<if test="workCost != null">#{workCost},</if>
|
|
|
|
<if test="workCostTime != null">#{workCostTime},</if>
|
|
|
|
<if test="workStatus != null">#{workStatus},</if>
|
|
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
|
|
<if test="delFlag != null">#{delFlag},</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">#{factoryCode},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateEquOutsourceWork" parameterType="EquOutsourceWork">
|
|
|
|
update equ_outsource_work
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="workCode != null">work_code = #{workCode},</if>
|
|
|
|
<if test="orderCode != null">order_code = #{orderCode},</if>
|
|
|
|
<if test="repairCode != null">repair_code = #{repairCode},</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>
|
|
|
|
<if test="workType != null">work_type = #{workType},</if>
|
|
|
|
<if test="equipmentCode != null">equipment_code = #{equipmentCode},</if>
|
|
|
|
<if test="workCost != null">work_cost = #{workCost},</if>
|
|
|
|
<if test="workCostTime != null">work_cost_time = #{workCostTime},</if>
|
|
|
|
<if test="workStatus != null">work_status = #{workStatus},</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">del_flag = #{delFlag},</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">factory_code = #{factoryCode},</if>
|
|
|
|
</trim>
|
|
|
|
where work_id = #{workId}
|
|
|
|
and del_flag = '0'
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteEquOutsourceWorkByWorkId" parameterType="String">
|
|
|
|
update equ_outsource_work
|
|
|
|
set del_flag = '1'
|
|
|
|
where work_id = #{workId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteEquOutsourceWorkByWorkIds" parameterType="String">
|
|
|
|
update equ_outsource_work
|
|
|
|
set del_flag = '1'
|
|
|
|
where work_id in
|
|
|
|
<foreach item="workId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{workId}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="selectWorkCodeSerialNumber" resultType="java.lang.Integer">
|
|
|
|
SELECT COUNT(work_id)+1 AS serialNum
|
|
|
|
FROM equ_outsource_work
|
|
|
|
where del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|