180 lines
7.3 KiB
XML
180 lines
7.3 KiB
XML
<?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">
|
|
<!-- 通用查询映射结果 -->
|
|
<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
|
|
and ro.repair_work_order_flow = 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>
|
|
<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>
|
|
|
|
|
|
<select id="pageList" 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>
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<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>
|
|
<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>
|
|
</mapper>
|