2024-08-26 23:58:16 +08:00
|
|
|
<?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.hcy.common.mapper.order.RepairOrderMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
2024-10-14 21:25:56 +08:00
|
|
|
|
|
|
|
<select id="dispatchItemList" resultType="com.hcy.common.dto.order.RepairOrderDto">
|
|
|
|
select ro.module_number,ro.module_code,ro.module_power,ro.repair_or_not,ro.maintenance_result,
|
|
|
|
ro.previous_maintenance_staff_id,u1.username as previousMaintenanceStaffName,
|
|
|
|
ro.receiver_id,u2.username as receiverName,
|
|
|
|
ro.order_status,ro.repair_confirmation_remark
|
|
|
|
from la_repair_order as ro
|
|
|
|
LEFT JOIN la_user as u1 on ro.previous_maintenance_staff_id = u1.id
|
|
|
|
LEFT JOIN la_user as u2 on ro.receiver_id = u2.id
|
|
|
|
where
|
|
|
|
ro.is_delete = 0
|
|
|
|
<if test="param.moduleCode != null and param.moduleCode != ''">
|
|
|
|
and ro.module_code LIKE concat('%', #{param.moduleCode}, '%')
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
2024-08-28 01:23:17 +08:00
|
|
|
<select id="list" resultType="com.hcy.common.dto.order.RepairOrderDto">
|
|
|
|
select
|
|
|
|
ro.*,
|
|
|
|
u1.username as creatorName,
|
|
|
|
u2.username as receiverName,
|
|
|
|
c.client_name as clientName,
|
|
|
|
e.province_id as equipmentProvinceId,
|
|
|
|
e.district_id as equipmentDistrictId,
|
|
|
|
e.city_id as equipmentCityId,
|
|
|
|
e.longitude,
|
|
|
|
e.latitude
|
|
|
|
from la_repair_order as ro
|
|
|
|
LEFT JOIN la_client as c on ro.client_id = c.id
|
|
|
|
LEFT JOIN la_equipment as e ON e.id = ro.equipment_id
|
|
|
|
LEFT JOIN la_user as u1 on ro.creator_id = u1.id
|
|
|
|
LEFT JOIN la_user as u2 on ro.receiver_id = u2.id
|
|
|
|
where
|
|
|
|
ro.is_delete = 0
|
2024-08-31 02:11:22 +08:00
|
|
|
and ro.repair_work_order_flow = 0
|
2024-08-28 01:23:17 +08:00
|
|
|
<if test="form.id != null">
|
|
|
|
and ro.id = #{form.id}
|
|
|
|
</if>
|
|
|
|
<if test="form.orderNo != null and form.orderNo != ''">
|
|
|
|
and ro.order_no like concat('%', #{form.orderNo}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.orderSource != null">
|
|
|
|
and ro.order_source = #{form.orderSource}
|
|
|
|
</if>
|
|
|
|
<if test="form.orderStatus != null">
|
|
|
|
and find_in_set(ro.order_status,#{form.orderStatus})
|
|
|
|
</if>
|
|
|
|
order by ro.create_time desc
|
|
|
|
</select>
|
|
|
|
|
2024-08-26 23:58:16 +08:00
|
|
|
|
|
|
|
<select id="pageList" resultType="com.hcy.common.dto.order.RepairOrderDto">
|
2024-08-29 00:46:36 +08:00
|
|
|
select ro.*,
|
|
|
|
u1.username as creatorName,
|
|
|
|
u2.username as receiverName,
|
|
|
|
c.client_name as clientName,
|
|
|
|
c.short_name
|
2024-08-26 23:58:16 +08:00
|
|
|
from la_repair_order as ro
|
|
|
|
LEFT JOIN la_client as c on ro.client_id = c.id
|
|
|
|
LEFT JOIN la_user as u1 on ro.creator_id = u1.id
|
|
|
|
LEFT JOIN la_user as u2 on ro.receiver_id = u2.id
|
|
|
|
where
|
|
|
|
ro.is_delete = 0
|
|
|
|
<if test="form.id != null">
|
|
|
|
and ro.id = #{form.id}
|
|
|
|
</if>
|
|
|
|
<if test="form.orderNo != null and form.orderNo != ''">
|
|
|
|
and ro.order_no like concat('%', #{form.orderNo}, '%')
|
|
|
|
</if>
|
2024-10-15 02:42:28 +08:00
|
|
|
<!-- <if test="form.orderSource != null">-->
|
|
|
|
<!-- and ro.order_source = #{form.orderSource}-->
|
|
|
|
<!-- </if>-->
|
2024-08-26 23:58:16 +08:00
|
|
|
<if test="form.clientName != null and form.clientName != ''">
|
|
|
|
and c.client_name LIKE concat('%', #{form.clientName}, '%')
|
|
|
|
</if>
|
2024-08-29 00:46:36 +08:00
|
|
|
<if test="form.receiverId != null">
|
|
|
|
and ro.receiver_id = #{form.receiverId}
|
|
|
|
</if>
|
|
|
|
<if test="form.clientId != null">
|
|
|
|
and ro.client_id = #{form.clientId}
|
|
|
|
</if>
|
2024-09-12 22:06:18 +08:00
|
|
|
<if test="form.creatorId != null">
|
|
|
|
and ro.creator_id = #{form.creatorId}
|
|
|
|
</if>
|
2024-09-19 22:20:32 +08:00
|
|
|
<if test="form.scrapOrNot != null">
|
|
|
|
and ro.scrap_or_not = #{form.scrapOrNot}
|
|
|
|
</if>
|
|
|
|
<if test="form.moduleNumber != null and form.moduleNumber != ''">
|
|
|
|
and ro.module_number LIKE concat('%', #{form.moduleNumber}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.moduleCode != null and form.moduleCode != ''">
|
|
|
|
and ro.module_code LIKE concat('%', #{form.moduleCode}, '%')
|
|
|
|
</if>
|
2024-08-26 23:58:16 +08:00
|
|
|
<if test="form.creatorName != null and form.creatorName != ''">
|
|
|
|
and u1.username LIKE concat('%', #{form.creatorName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.receiverName != null and form.receiverName != ''">
|
|
|
|
and u2.username LIKE concat('%', #{form.receiverName}, '%')
|
|
|
|
</if>
|
2024-08-28 01:23:17 +08:00
|
|
|
<if test="form.likeWork != null and form.likeWork != ''">
|
|
|
|
and (ro.order_no like concat('%',#{form.likeWork},'%')
|
|
|
|
or u1.username LIKE concat('%', #{form.likeWork}, '%'))
|
|
|
|
</if>
|
|
|
|
<if test="form.orderStatus != null">
|
|
|
|
and find_in_set(ro.order_status,#{form.orderStatus})
|
|
|
|
</if>
|
|
|
|
<if test="form.orderStatusIds != null and form.orderStatusIds != ''">
|
|
|
|
and find_in_set(ro.order_status,#{form.orderStatusIds})
|
|
|
|
</if>
|
|
|
|
order by ro.create_time desc
|
2024-08-26 23:58:16 +08:00
|
|
|
</select>
|
|
|
|
|
2024-08-29 00:46:36 +08:00
|
|
|
<select id="selectPendingOrderCount" resultType="Integer">
|
|
|
|
SELECT
|
|
|
|
COUNT( order_status )
|
|
|
|
FROM
|
|
|
|
la_repair_order as lro
|
|
|
|
WHERE
|
|
|
|
is_delete = 0
|
|
|
|
<if test="param.receiverId != null">
|
|
|
|
and lro.receiver_id = #{param.receiverId}
|
|
|
|
</if>
|
|
|
|
<if test="param.clientId != null">
|
|
|
|
and lro.client_id = #{param.clientId}
|
|
|
|
</if>
|
|
|
|
<if test="param.orderStatusIds != null and param.orderStatusIds != ''">
|
|
|
|
and find_in_set(lro.order_status,#{param.orderStatusIds})
|
|
|
|
</if>
|
|
|
|
</select>
|
2024-08-26 23:58:16 +08:00
|
|
|
|
2024-09-19 22:20:32 +08:00
|
|
|
<select id="getExportModuleMaintenanceExcel" resultType="com.hcy.common.dto.order.RepairOrderDto">
|
|
|
|
select ro.*,
|
|
|
|
u1.username as creatorName,
|
|
|
|
u2.username as receiverName,
|
|
|
|
c.client_name as clientName,
|
|
|
|
c.short_name
|
|
|
|
from la_repair_order as ro
|
|
|
|
LEFT JOIN la_client as c on ro.client_id = c.id
|
|
|
|
LEFT JOIN la_user as u1 on ro.creator_id = u1.id
|
|
|
|
LEFT JOIN la_user as u2 on ro.receiver_id = u2.id
|
|
|
|
where
|
|
|
|
ro.is_delete = 0
|
|
|
|
<if test="form.id != null">
|
|
|
|
and ro.id = #{form.id}
|
|
|
|
</if>
|
2024-09-24 17:00:30 +08:00
|
|
|
<if test="form.ids != null and form.ids.size > 0">
|
|
|
|
and ro.id in
|
|
|
|
<foreach item="id" collection="form.ids" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
2024-09-19 22:20:32 +08:00
|
|
|
<if test="form.orderNo != null and form.orderNo != ''">
|
|
|
|
and ro.order_no like concat('%', #{form.orderNo}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.orderSource != null">
|
|
|
|
and ro.order_source = #{form.orderSource}
|
|
|
|
</if>
|
|
|
|
<if test="form.clientName != null and form.clientName != ''">
|
|
|
|
and c.client_name LIKE concat('%', #{form.clientName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.receiverId != null">
|
|
|
|
and ro.receiver_id = #{form.receiverId}
|
|
|
|
</if>
|
|
|
|
<if test="form.clientId != null">
|
|
|
|
and ro.client_id = #{form.clientId}
|
|
|
|
</if>
|
|
|
|
<if test="form.creatorId != null">
|
|
|
|
and ro.creator_id = #{form.creatorId}
|
|
|
|
</if>
|
|
|
|
<if test="form.scrapOrNot != null">
|
|
|
|
and ro.scrap_or_not = #{form.scrapOrNot}
|
|
|
|
</if>
|
|
|
|
<if test="form.moduleNumber != null and form.moduleNumber != ''">
|
|
|
|
and ro.module_number LIKE concat('%', #{form.moduleNumber}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.moduleCode != null and form.moduleCode != ''">
|
|
|
|
and ro.module_code LIKE concat('%', #{form.moduleCode}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.creatorName != null and form.creatorName != ''">
|
|
|
|
and u1.username LIKE concat('%', #{form.creatorName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.receiverName != null and form.receiverName != ''">
|
|
|
|
and u2.username LIKE concat('%', #{form.receiverName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="form.likeWork != null and form.likeWork != ''">
|
|
|
|
and (ro.order_no like concat('%',#{form.likeWork},'%')
|
|
|
|
or u1.username LIKE concat('%', #{form.likeWork}, '%'))
|
|
|
|
</if>
|
|
|
|
<if test="form.orderStatus != null">
|
|
|
|
and find_in_set(ro.order_status,#{form.orderStatus})
|
|
|
|
</if>
|
|
|
|
<if test="form.orderStatusIds != null and form.orderStatusIds != ''">
|
|
|
|
and find_in_set(ro.order_status,#{form.orderStatusIds})
|
|
|
|
</if>
|
|
|
|
order by ro.create_time desc
|
|
|
|
</select>
|
2024-10-14 21:25:56 +08:00
|
|
|
|
|
|
|
<select id="repairModulePageList" resultType="com.hcy.common.dto.order.RepairOrderDto">
|
|
|
|
SELECT
|
|
|
|
ro.*,
|
|
|
|
saa.username AS receiverName,
|
|
|
|
c.client_name AS clientName,
|
|
|
|
c.short_name,
|
|
|
|
pro.order_no
|
|
|
|
FROM
|
|
|
|
la_repair_order AS ro
|
|
|
|
LEFT JOIN la_client AS c ON ro.client_id = c.id
|
|
|
|
LEFT JOIN la_system_auth_admin AS saa ON ro.receiver_id = saa.id
|
|
|
|
LEFT JOIN la_parent_repair_order as pro on ro.parent_repair_order_id = pro.id
|
|
|
|
where
|
|
|
|
ro.is_delete = 0
|
|
|
|
<if test="form.id != null">
|
|
|
|
and ro.id = #{form.id}
|
|
|
|
</if>
|
|
|
|
<if test="form.receiverId != null">
|
|
|
|
and ro.receiver_id = #{form.receiverId}
|
|
|
|
</if>
|
2024-10-15 02:42:28 +08:00
|
|
|
<if test="form.clientId != null">
|
|
|
|
and ro.client_id = #{form.clientId}
|
|
|
|
</if>
|
|
|
|
<if test="form.creatorId != null">
|
|
|
|
and ro.creator_id = #{form.creatorId}
|
|
|
|
</if>
|
2024-10-14 21:25:56 +08:00
|
|
|
<if test="form.likeWork != null and form.likeWork != ''">
|
|
|
|
and (pro.order_no like concat('%', #{form.likeWork}, '%')
|
|
|
|
or ro.module_code LIKE concat('%', #{form.likeWork}, '%')
|
|
|
|
or c.client_name like concat('%', #{form.likeWork}, '%'))
|
|
|
|
</if>
|
|
|
|
<if test="form.orderStatus != null">
|
|
|
|
and find_in_set(ro.order_status,#{form.orderStatus})
|
|
|
|
</if>
|
|
|
|
<if test="form.orderStatusIds != null and form.orderStatusIds != ''">
|
|
|
|
and find_in_set(ro.order_status,#{form.orderStatusIds})
|
|
|
|
</if>
|
|
|
|
order by ro.create_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="auditMattersList" resultType="com.hcy.common.dto.order.RepairOrderDto">
|
|
|
|
SELECT
|
|
|
|
ro.*,
|
|
|
|
c.client_name AS clientName,
|
|
|
|
c.short_name,
|
|
|
|
pro.order_no ,
|
|
|
|
roa.fault_phenomenon_id,
|
|
|
|
roa.fault_cause_id,
|
|
|
|
roa.review_request,
|
|
|
|
roa.source_of_damage_id,
|
|
|
|
roa.operations_suggest_id,
|
|
|
|
roa.scrap_img,
|
|
|
|
roa.scrap_mark_picture,
|
|
|
|
roa.applicant_id,
|
|
|
|
roa.apply_for_time,
|
|
|
|
roa.audit_status,
|
|
|
|
roa.audit_result,
|
|
|
|
roa.audit_opinion,
|
|
|
|
roa.audit_time,
|
|
|
|
roa.auditor_id
|
|
|
|
FROM
|
|
|
|
la_repair_order AS ro
|
|
|
|
LEFT JOIN la_client AS c ON ro.client_id = c.id
|
|
|
|
LEFT JOIN la_parent_repair_order AS pro ON ro.parent_repair_order_id = pro.id
|
|
|
|
LEFT JOIN la_repair_order_audit AS roa ON ro.id = roa.repair_order_id
|
|
|
|
WHERE
|
|
|
|
ro.is_delete = 0
|
|
|
|
<if test="param.reviewRequest != null">
|
|
|
|
AND roa.review_request = #{param.reviewRequest}
|
|
|
|
</if>
|
|
|
|
<if test="param.orderNo != null and param.orderNo != ''">
|
|
|
|
and pro.order_no like concat('%', #{param.orderNo}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="param.clientName != null and param.clientName != ''">
|
|
|
|
and c.client_name LIKE concat('%', #{param.clientName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="param.moduleCode != null and param.moduleCode != ''">
|
|
|
|
and ro.module_code LIKE concat('%', #{param.moduleCode}, '%')
|
|
|
|
</if>
|
|
|
|
order by roa.apply_for_time desc
|
|
|
|
</select>
|
2024-08-26 23:58:16 +08:00
|
|
|
</mapper>
|