|
|
|
<?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.EquRepairOrderMapper">
|
|
|
|
|
|
|
|
<resultMap type="EquRepairOrder" id="EquRepairOrderResult">
|
|
|
|
<result property="orderId" column="order_id" />
|
|
|
|
<result property="orderCode" column="order_code" />
|
|
|
|
<result property="equipmentCode" column="equipment_code" />
|
|
|
|
<result property="orderDesc" column="order_desc" />
|
|
|
|
<result property="orderBreakdownTime" column="order_breakdown_time" />
|
|
|
|
<result property="orderSource" column="order_source" />
|
|
|
|
<result property="orderTime" column="order_time" />
|
|
|
|
<result property="orderHandle" column="order_handle" />
|
|
|
|
<!--报修人编号、名字-->
|
|
|
|
<result property="orderRepairmanCode" column="order_repairman_code" />
|
|
|
|
<result property="orderRepairmanName" column="order_repairman_name" />
|
|
|
|
<result property="orderConnection" column="order_connection" />
|
|
|
|
<result property="orderStatus" column="order_status" />
|
|
|
|
<result property="orderRelevance" column="order_relevance" />
|
|
|
|
<result property="orderPicture" column="order_picture" />
|
|
|
|
<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="repairDestination" column="repair_destination" />
|
|
|
|
<!-- 设备 -->
|
|
|
|
<result property="equipmentTypeName" column="equipment_type_name" />
|
|
|
|
<result property="equipmentName" column="equipment_name" />
|
|
|
|
<result property="equipmentLocation" column="equipment_location" />
|
|
|
|
<result property="department" column="department" />
|
|
|
|
<result property="equipmentSpec" column="equipment_spec" />
|
|
|
|
<!-- 计划 -->
|
|
|
|
<result property="workPlanTime" column="work_plan_time" />
|
|
|
|
<result property="workDownMachine" column="work_down_machine" />
|
|
|
|
<result property="workPlanDownTime" column="work_plan_down_time" />
|
|
|
|
<result property="workTeam" column="work_team" />
|
|
|
|
<!-- 委外 -->
|
|
|
|
<result property="outSourcePerson" column="work_person" />
|
|
|
|
<result property="workOutsourcingUnit" column="work_outsourcing_unit" />
|
|
|
|
<result property="workConnection" column="work_connection" />
|
|
|
|
<result property="outSourceReason" column="work_reason" />
|
|
|
|
|
|
|
|
<!-- 检查项信息 -->
|
|
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<resultMap type="com.op.common.core.domain.BaseFileData" id="BaseFileResult">
|
|
|
|
<result property="fileId" column="file_id" />
|
|
|
|
<result property="fileName" column="file_name" />
|
|
|
|
<result property="fileAddress" column="file_address" />
|
|
|
|
<result property="sourceId" column="source_id" />
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
<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="imageType" column="image_type" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectBaseFileVo">
|
|
|
|
select file_id, file_name, file_address, source_id, remark, attr1,
|
|
|
|
attr2, attr3, attr4, create_by, create_time, update_by,
|
|
|
|
update_time,image_type from base_file
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<sql id="selectEquRepairOrderVo">
|
|
|
|
select order_id, order_code, equipment_code, order_desc, order_breakdown_time, order_source, order_time, order_handle, order_repairman_code,order_repairman_name, order_connection, order_status, order_relevance, order_picture, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,factory_code,repair_destination from equ_repair_order
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectEquRepairOrderList" parameterType="EquRepairOrder" resultMap="EquRepairOrderResult">
|
|
|
|
<include refid="selectEquRepairOrderVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="orderCode != null and orderCode != ''"> and order_code like concat('%', #{orderCode}, '%')</if>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code like concat('%', #{equipmentCode}, '%')</if>
|
|
|
|
<if test="orderDesc != null and orderDesc != ''"> and order_desc like concat('%', #{orderDesc}, '%')</if>
|
|
|
|
<!--故障开始时间 结束时间-->
|
|
|
|
<if test="orderBreakdownTimeStart != null "> and CONVERT(date,order_breakdown_time) >= #{orderBreakdownTimeStart}</if>
|
|
|
|
<if test="orderBreakdownTimeEnd != null "> and #{orderBreakdownTimeEnd} >= CONVERT(date,order_breakdown_time)</if>
|
|
|
|
<if test="orderSource != null and orderSource != ''"> and order_source like concat('%', #{orderSource}, '%')</if>
|
|
|
|
<!--报修开始时间 结束时间-->
|
|
|
|
<if test="orderTimeStart != null "> and CONVERT(date,order_time) >= #{orderTimeStart}</if>
|
|
|
|
<if test="orderTimeEnd != null "> and #{orderTimeEnd} >= CONVERT(date,order_time)</if>
|
|
|
|
<if test="orderHandle != null and orderHandle != ''"> and order_handle = #{orderHandle}</if>
|
|
|
|
<if test="orderRepairmanCode != null and orderRepairmanCode != ''"> and order_repairman_code like concat('%', #{orderRepairmanCode}, '%')</if>
|
|
|
|
<if test="orderRepairmanName != null and orderRepairmanName != ''"> and order_repairman_name like concat('%', #{orderRepairmanName}, '%')</if>
|
|
|
|
<if test="orderConnection != null and orderConnection != ''"> and order_connection like concat('%', #{orderConnection}, '%')</if>
|
|
|
|
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
|
|
|
|
<if test="orderRelevance != null and orderRelevance != ''"> and order_relevance = #{orderRelevance}</if>
|
|
|
|
<if test="orderPicture != null and orderPicture != ''"> and order_picture = #{orderPicture}</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>
|
|
|
|
<if test="repairDestination != null and repairDestination != ''"> and repair_destination = #{repairDestination}</if>
|
|
|
|
and del_flag = '0'
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEquRepairOrderByOrderId" parameterType="String" resultMap="EquRepairOrderResult">
|
|
|
|
select
|
|
|
|
ero.order_id,
|
|
|
|
ero.order_code,
|
|
|
|
ero.equipment_code,
|
|
|
|
ero.order_desc,
|
|
|
|
ero.order_breakdown_time,
|
|
|
|
ero.order_source,
|
|
|
|
ero.order_time,
|
|
|
|
ero.order_handle,
|
|
|
|
ero.order_repairman_code,
|
|
|
|
ero.order_repairman_name,
|
|
|
|
ero.order_connection,
|
|
|
|
ero.order_status,
|
|
|
|
ero.order_relevance,
|
|
|
|
ero.order_picture,
|
|
|
|
ero.create_by,
|
|
|
|
ero.create_time,
|
|
|
|
ero.update_by,
|
|
|
|
ero.update_time,
|
|
|
|
ero.factory_code,
|
|
|
|
ero.repair_destination,
|
|
|
|
be.equipment_name,
|
|
|
|
be.equipment_type_name,
|
|
|
|
be.equipment_spec,
|
|
|
|
be.department,
|
|
|
|
be.equipment_location,
|
|
|
|
rwo.work_down_machine,
|
|
|
|
rwo.work_plan_down_time,
|
|
|
|
rwo.work_plan_time,
|
|
|
|
rwo.work_team,
|
|
|
|
eow.work_person,
|
|
|
|
eow.work_outsourcing_unit,
|
|
|
|
eow.work_connection,
|
|
|
|
eow.work_reason
|
|
|
|
from equ_repair_order ero
|
|
|
|
left join base_equipment be on ero.equipment_code = be.equipment_code
|
|
|
|
left join equ_repair_work_order rwo on ero.order_code = rwo.order_code
|
|
|
|
left join equ_outsource_work eow on ero.order_code = eow.order_code
|
|
|
|
where ero.order_id = #{orderId}
|
|
|
|
and ero.del_flag = '0'
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertEquRepairOrder" parameterType="EquRepairOrder">
|
|
|
|
insert into equ_repair_order
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="orderId != null">order_id,</if>
|
|
|
|
<if test="orderCode != null">order_code,</if>
|
|
|
|
<if test="equipmentCode != null">equipment_code,</if>
|
|
|
|
<if test="orderDesc != null">order_desc,</if>
|
|
|
|
<if test="orderBreakdownTime != null">order_breakdown_time,</if>
|
|
|
|
<if test="orderSource != null">order_source,</if>
|
|
|
|
<if test="orderTime != null">order_time,</if>
|
|
|
|
<if test="orderHandle != null">order_handle,</if>
|
|
|
|
<if test="orderRepairmanCode != null">order_repairman_code,</if>
|
|
|
|
<if test="orderRepairmanName != null">order_repairman_name,</if>
|
|
|
|
<if test="orderConnection != null">order_connection,</if>
|
|
|
|
<if test="orderStatus != null">order_status,</if>
|
|
|
|
<if test="orderRelevance != null">order_relevance,</if>
|
|
|
|
<if test="orderPicture != null">order_picture,</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>
|
|
|
|
<if test="repairDestination != null">repair_destination,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="orderId != null">#{orderId},</if>
|
|
|
|
<if test="orderCode != null">#{orderCode},</if>
|
|
|
|
<if test="equipmentCode != null">#{equipmentCode},</if>
|
|
|
|
<if test="orderDesc != null">#{orderDesc},</if>
|
|
|
|
<if test="orderBreakdownTime != null">#{orderBreakdownTime},</if>
|
|
|
|
<if test="orderSource != null">#{orderSource},</if>
|
|
|
|
<if test="orderTime != null">#{orderTime},</if>
|
|
|
|
<if test="orderHandle != null">#{orderHandle},</if>
|
|
|
|
<if test="orderRepairmanCode != null">#{orderRepairmanCode},</if>
|
|
|
|
<if test="orderRepairmanName != null">#{orderRepairmanName},</if>
|
|
|
|
<if test="orderConnection != null">#{orderConnection},</if>
|
|
|
|
<if test="orderStatus != null">#{orderStatus},</if>
|
|
|
|
<if test="orderRelevance != null">#{orderRelevance},</if>
|
|
|
|
<if test="orderPicture != null">#{orderPicture},</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>
|
|
|
|
<if test="repairDestination != null">#{repairDestination},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateEquRepairOrder" parameterType="EquRepairOrder">
|
|
|
|
update equ_repair_order
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="orderCode != null">order_code = #{orderCode},</if>
|
|
|
|
<if test="equipmentCode != null">equipment_code = #{equipmentCode},</if>
|
|
|
|
<if test="orderDesc != null">order_desc = #{orderDesc},</if>
|
|
|
|
<if test="orderBreakdownTime != null">order_breakdown_time = #{orderBreakdownTime},</if>
|
|
|
|
<if test="orderSource != null">order_source = #{orderSource},</if>
|
|
|
|
<if test="orderTime != null">order_time = #{orderTime},</if>
|
|
|
|
<if test="orderHandle != null">order_handle = #{orderHandle},</if>
|
|
|
|
<if test="orderRepairmanCode != null">order_repairman_code = #{orderRepairmanCode},</if>
|
|
|
|
<if test="orderRepairmanName != null">order_repairman_name = #{orderRepairmanName},</if>
|
|
|
|
<if test="orderConnection != null">order_connection = #{orderConnection},</if>
|
|
|
|
<if test="orderStatus != null">order_status = #{orderStatus},</if>
|
|
|
|
<if test="orderRelevance != null">order_relevance = #{orderRelevance},</if>
|
|
|
|
<if test="orderPicture != null">order_picture = #{orderPicture},</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>
|
|
|
|
<if test="repairDestination != null">repair_destination = #{repairDestination},</if>
|
|
|
|
</trim>
|
|
|
|
where order_id = #{orderId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<!--物理删除改为逻辑删除-->
|
|
|
|
<delete id="deleteEquRepairOrderByOrderId" parameterType="String">
|
|
|
|
update equ_repair_order
|
|
|
|
set del_flag = '1'
|
|
|
|
where order_id = #{orderId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<!--物理删除改为逻辑删除-->
|
|
|
|
<delete id="deleteEquRepairOrderByOrderIds" parameterType="String">
|
|
|
|
update equ_repair_order
|
|
|
|
set del_flag = '1'
|
|
|
|
where order_id in
|
|
|
|
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{orderId}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteEquRepairOrderByRepairCode">
|
|
|
|
delete from equ_repair_order where order_code = #{repairCode} and del_flag = '0'
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="selectOrderCodeSerialNumber" resultType="java.lang.Integer">
|
|
|
|
SELECT COUNT(order_id)+1 AS serialNum
|
|
|
|
FROM equ_repair_order
|
|
|
|
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
|
|
|
|
and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getRepairPersonList" parameterType="EquTeamUser" resultType="com.op.device.domain.EquTeamUser">
|
|
|
|
select
|
|
|
|
user_id AS userId,
|
|
|
|
user_name AS userName,
|
|
|
|
nick_name AS nickName,
|
|
|
|
CONCAT(nick_name,user_name) AS teamUserName,
|
|
|
|
phonenumber AS phonenumber
|
|
|
|
from sys_user
|
|
|
|
<where>
|
|
|
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
|
|
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
|
|
|
|
and del_flag = '0'
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getRepairPhoneNumber" parameterType="EquTeamUser" resultType="com.op.device.domain.EquTeamUser">
|
|
|
|
select
|
|
|
|
user_id AS userId,
|
|
|
|
user_name AS userName,
|
|
|
|
nick_name AS nickName,
|
|
|
|
CONCAT(nick_name,user_name) AS teamUserName,
|
|
|
|
phonenumber AS phoneNumber
|
|
|
|
from sys_user
|
|
|
|
where user_name = #{userName}
|
|
|
|
and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEquRepairOrderByRepairCode" parameterType="String" resultMap="EquRepairOrderResult">
|
|
|
|
<include refid="selectEquRepairOrderVo"/>
|
|
|
|
where order_code = #{repairCode} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertBaseFileBatch">
|
|
|
|
INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time,image_type)
|
|
|
|
VALUES
|
|
|
|
<foreach collection="baseFiles" index="" item="baseFile" separator=",">
|
|
|
|
(
|
|
|
|
#{baseFile.fileId},
|
|
|
|
#{baseFile.fileName},
|
|
|
|
#{baseFile.fileAddress},
|
|
|
|
#{baseFile.sourceId},
|
|
|
|
#{baseFile.remark},
|
|
|
|
#{baseFile.createBy},
|
|
|
|
#{baseFile.createTime},
|
|
|
|
#{baseFile.imageType}
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<delete id="deleteBaseFileBySourceId">
|
|
|
|
delete from base_file where source_id = #{sourceId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="getBaseFileBatch" resultMap="BaseFileResult">
|
|
|
|
<include refid="selectBaseFileVo"/>
|
|
|
|
where source_id = #{sourceId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|