<?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="cn.gistack.sm.sg.mapper.SgProgressReportMapper">
|
|
<select id="queryPageList" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
|
SELECT
|
report.*,
|
de.device_name,
|
de.device_type,
|
dict."DICT_VALUE" as typeName
|
FROM
|
ywxt.SG_PROGRESS_REPORT report
|
LEFT JOIN ywxt.sg_device de ON report.gx_device_id = de.id
|
left join YWXT."BLADE_DICT_BIZ" as dict on de.device_type=dict.DICT_KEY and dict.CODE='SG_DEVICE_TYPE'
|
where 1=1
|
<if test="dto.projectName != null and dto.projectName != ''">
|
and report.PROGRAM_NAME like CONCAT(CONCAT('%',#{dto.projectName}),'%')
|
</if>
|
<if test="dto.deviceName != null and dto.deviceName != ''">
|
and de.device_name like CONCAT(CONCAT('%', #{dto.deviceName}), '%')
|
</if>
|
<if test="dto.status != null ">
|
and report.status = #{dto.status}
|
</if>
|
<if test="dto.reportPerson != null ">
|
and report.report_user = #{dto.reportPerson}
|
</if>
|
</select>
|
<select id="queryById" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
|
select * from SG_PROGRESS_REPORT report where id = #{id}
|
</select>
|
<select id="queryList" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
|
SELECT
|
report.*,
|
de.device_name,
|
de.device_type,
|
userR.approval_status,
|
dict."DICT_VALUE" as typeName
|
FROM
|
ywxt.SG_PROGRESS_REPORT report
|
LEFT JOIN ywxt.sg_device de ON report.gx_device_id = de.id
|
left join YWXT."BLADE_DICT_BIZ" as dict on de.device_type=dict.DICT_KEY and dict.CODE='SG_DEVICE_TYPE'
|
LEFT JOIN ywxt.sg_report_user userR ON report.id = userR.report_id
|
WHERE
|
1 = 1
|
AND userR.is_his = 0
|
<if test="dto.userId != null and dto.userId != ''">
|
and userR.user_id = #{dto.userId}
|
</if>
|
<if test="dto.approvalStatus != null and dto.approvalStatus != 3">
|
and userR.approval_status = #{dto.approvalStatus}
|
AND userR.approval_order != 0
|
</if>
|
<choose >
|
<when test="dto.approvalStatus != null and dto.approvalStatus == 0">
|
and report.audit_person = #{dto.userId}
|
</when>
|
<when test="dto.approvalStatus != null and dto.approvalStatus == 3">
|
and report.report_user = #{dto.userId}
|
</when>
|
</choose>
|
</select>
|
<select id="countList" resultType="java.lang.Long">
|
select count(1) from ywxt.SG_PROGRESS_REPORT report
|
left join ywxt.sg_device de on report.gx_device_id = de.id
|
left join ywxt.sg_report_user userR on report.id = userR.report_id
|
where 1=1 and userR.is_his = 0 and userR.approval_order != 0
|
<if test="dto.userId != null and dto.userId != ''">
|
and userR.user_id = #{dto.userId}
|
</if>
|
<if test="dto.approvalStatus != null ">
|
and userR.approval_status = #{dto.approvalStatus}
|
</if>
|
<choose >
|
<when test="dto.approvalStatus != null and dto.approvalStatus == 0">
|
and report.audit_person = #{dto.userId}
|
</when>
|
</choose>
|
</select>
|
<select id="selectByDeviceId" resultType="cn.gistack.sm.sg.VO.SgStepReportVO">
|
SELECT
|
step.id AS stepId,
|
step.gx_step_name AS stepName,
|
step.gx_step_num AS stepNum,
|
re.STATUS AS approvalStatus,
|
re.report_time
|
FROM
|
ywxt.sg_gx_step step
|
LEFT JOIN ywxt.sg_gx gx ON step.gx_info_id = gx.id
|
LEFT JOIN ywxt.sg_device de ON gx.gx_type = de.device_type
|
LEFT JOIN ywxt.sg_progress_report re ON re.gx_step_id = step.id and re.gx_device_id = de.id
|
WHERE
|
1 =1 and de.id = #{deviceId}
|
</select>
|
<select id="statusCount" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
|
SELECT
|
report.*,
|
de.device_name,
|
de.device_type,
|
dict."DICT_VALUE" as typeName
|
FROM
|
ywxt.SG_PROGRESS_REPORT report
|
LEFT JOIN ywxt.sg_device de ON report.gx_device_id = de.id
|
left join YWXT."BLADE_DICT_BIZ" as dict on de.device_type=dict.DICT_KEY and dict.CODE='SG_DEVICE_TYPE'
|
where 1=1
|
<if test="dto.projectName != null and dto.projectName != ''">
|
and report.PROGRAM_NAME like CONCAT(CONCAT('%',#{dto.projectName}),'%')
|
</if>
|
<if test="dto.deviceName != null and dto.deviceName != ''">
|
and de.device_name like CONCAT(CONCAT('%', #{dto.deviceName}), '%')
|
</if>
|
<if test="dto.reportPerson != null">
|
and report.reportPerson = #{dto.reportPerson}
|
</if>
|
</select>
|
<select id="getUserByIds" resultType="java.util.Map">
|
select id ,real_name from ywxt.blade_user where 1 = 1
|
<if test="ids != null and ids.size>0">
|
AND id in
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</select>
|
</mapper>
|