115 lines
4.3 KiB
XML
115 lines
4.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.chushang.inspection.work.mapper.WrkInfoMapper">
|
|
<select id="queryDispatchPage" resultType="com.chushang.inspection.work.vo.WrkDispatchVO">
|
|
SELECT i.wrk_id AS wrkId,
|
|
i.user_name AS userName,
|
|
i.user_id AS userId,
|
|
i.dept_id AS deptId,
|
|
i.dept_name AS deptName,
|
|
i.work_type AS workType,
|
|
i.work_no AS workNo,
|
|
i.work_sort AS workSort,
|
|
i.remark AS remark,
|
|
i.end_time AS endTime,
|
|
i.create_time AS createTime,
|
|
i.create_by AS createBy,
|
|
isr.store_id AS storeId,
|
|
isr.store_no AS storeName,
|
|
isr.store_name AS storeNo,
|
|
itr.terminal_id AS terminalId,
|
|
itr.terminal_no AS terminalNo,
|
|
itr.terminal_sn AS terminalSn,
|
|
itr.terminal_type AS terminalType,
|
|
itr.terminal_model AS terminalModel
|
|
FROM `wrk_info` i
|
|
INNER JOIN wrk_info_store_record isr ON i.wrk_id = isr.wrk_id
|
|
INNER JOIN wrk_info_terminal_record itr ON i.wrk_id = itr.wrk_id
|
|
<where>
|
|
<if test="1==1">
|
|
${query.sqlParam.get('sqlWhere')}
|
|
</if>
|
|
</where>
|
|
ORDER BY i.create_time desc
|
|
</select>
|
|
|
|
<select id="queryArchivePage" resultType="com.chushang.inspection.work.vo.WrkAuditVO">
|
|
SELECT i.wrk_id AS wrkId,
|
|
i.work_no AS workNo,
|
|
isr.store_no AS storeNo,
|
|
isr.store_id AS storeId,
|
|
i.user_id AS userId,
|
|
i.user_name AS userName,
|
|
itr.terminal_id AS terminalId,
|
|
itr.terminal_no AS terminalNo,
|
|
i.work_type AS workType,
|
|
isr.ins_fre AS insFre,
|
|
i.wrk_status AS wrkStatus,
|
|
isr.geographic_location AS geographicLocation,
|
|
isr.location_address AS locationAddress,
|
|
isr.deviation AS deviation,
|
|
i.dispose_time AS disposeTime,
|
|
i.create_by AS createBy,
|
|
i.create_time AS createTime,
|
|
i.task_id AS taskId,
|
|
i.task_name AS taskName,
|
|
i.lower_task_id AS lowerTaskId,
|
|
i.lower_task_name AS lowerTaskName
|
|
FROM wrk_info i
|
|
INNER JOIN wrk_info_store_record isr ON i.wrk_id = isr.wrk_id
|
|
INNER JOIN wrk_info_terminal_record itr ON i.wrk_id = itr.wrk_id
|
|
<where>
|
|
<if test="1==1">
|
|
${query.sqlParam.get('sqlWhere')}
|
|
</if>
|
|
</where>
|
|
ORDER BY i.create_time desc
|
|
</select>
|
|
|
|
<select id="queryAppPage" resultType="com.chushang.inspection.work.vo.WrkListAppVO">
|
|
SELECT
|
|
i.wrk_id AS wrkId,
|
|
i.work_type AS workType,
|
|
i.task_name AS taskName,
|
|
isr.store_name AS storeName,
|
|
isr.store_contact AS storeContact,
|
|
isr.store_phone AS storePhone,
|
|
isr.ins_fre AS insFre,
|
|
itr.terminal_id AS terminalId,
|
|
itr.terminal_address AS terminalAddress,
|
|
(
|
|
SELECT count(w1.wrk_id)
|
|
FROM
|
|
wrk_info w1 INNER JOIN
|
|
wrk_info_terminal_record w2 ON w1.wrk_id = w2.wrk_id
|
|
WHERE w2.terminal_id = itr.terminal_id AND w1.wrk_status = #{query.wrkStatus}
|
|
) AS numberOfPickups,
|
|
(
|
|
SELECT w1.dispose_time
|
|
FROM
|
|
wrk_info w1 INNER JOIN
|
|
wrk_info_terminal_record w2 ON w1.wrk_id = w2.wrk_id
|
|
WHERE w2.terminal_id = itr.terminal_id
|
|
AND w1.wrk_status = #{query.wrkStatus} order by w1.dispose_time desc limit 1
|
|
) AS lastDisposeTime,
|
|
(
|
|
SELECT w1.service_result
|
|
FROM
|
|
wrk_info w1 INNER JOIN
|
|
wrk_info_terminal_record w2 ON w1.wrk_id = w2.wrk_id
|
|
WHERE w2.terminal_id = itr.terminal_id
|
|
AND w1.wrk_status = #{query.wrkStatus} order by w1.dispose_time desc limit 1
|
|
) AS lastServiceResult
|
|
FROM
|
|
wrk_info i
|
|
INNER JOIN wrk_info_store_record isr ON i.wrk_id = isr.wrk_id
|
|
INNER JOIN wrk_info_terminal_record itr ON i.wrk_id = itr.wrk_id
|
|
<where>
|
|
<if test="1==1">
|
|
${query.sqlParam.get('sqlWhere')}
|
|
</if>
|
|
</where>
|
|
ORDER BY i.create_time desc
|
|
</select>
|
|
</mapper>
|