统计报表状态修改

This commit is contained in:
lizhicheng 2022-10-14 14:57:46 +08:00
parent b1376f4646
commit 64e53c3535
2 changed files with 36 additions and 29 deletions

View File

@ -18,7 +18,7 @@
</resultMap> </resultMap>
<select id="getDeviceDTOList" resultMap="deviceDTO"> <select id="getDeviceDTOList" resultMap="deviceDTO">
select td.*, IFNULL(tda.state,1) as state from tb_device td left join tb_device_apply tda on td.id=tda.device_id select td.*, IFNULL(ANY_VALUE(tda.state),1) as state from tb_device td left join tb_device_apply tda on td.id=tda.device_id
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and tda.creator = #{userId} and tda.creator = #{userId}
</if> </if>

View File

@ -1834,8 +1834,8 @@
<select id="selectCensusResourceTable" resultType="java.util.Map"> <select id="selectCensusResourceTable" resultType="java.util.Map">
SELECT sd.name AS deptName, tdr.name AS resourceName, tdr.type, tdr.create_date AS createDate, SELECT sd.name AS deptName, tdr.name AS resourceName, tdr.type, tdr.create_date AS createDate,
if(tdr.del_flag=0, '审核通过', '审核中') AS approveStatus, trma.instance_id AS applyNumber CASE WHEN (tdr.del_flag=0 OR tdr.del_flag=5) THEN '通过' WHEN tdr.del_flag=6 THEN '不通过' ELSE '审核中' END AS approveStatus, trma.instance_id AS applyNumber
FROM (SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date, FROM (SELECT IF(d.type='组件服务', a.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date,
d.name d.name
FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND
a.del_flag=0 a.del_flag=0
@ -1845,13 +1845,16 @@
WHERE 1=1 AND tdr.dept_id=sd.id WHERE 1=1 AND tdr.dept_id=sd.id
<choose> <choose>
<when test="approveStatus != null and approveStatus == '通过'"> <when test="approveStatus != null and approveStatus == '通过'">
AND tdr.del_flag = 0 AND tdr.del_flag in (0, 5)
</when> </when>
<when test="approveStatus != null and approveStatus == '审核中'"> <when test="approveStatus != null and approveStatus == '审核中'">
AND tdr.del_flag in (2, 3) AND tdr.del_flag not in (0, 1, 5, 6)
</when>
<when test="approveStatus != null and approveStatus == '不通过'">
AND tdr.del_flag=6
</when> </when>
<otherwise> <otherwise>
AND tdr.del_flag in (0, 2, 3) AND tdr.del_flag != 1
</otherwise> </otherwise>
</choose> </choose>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
@ -1904,14 +1907,6 @@
AND su.dept_id = sd.id AND su.dept_id = sd.id
AND taa.resource_id = tdr.id AND taa.resource_id = tdr.id
AND dept.id = tdr.dept_id AND dept.id = tdr.dept_id
<!--<choose>
<when test="approveStatus != null and approveStatus != ''">
AND taa.approve_status = #{approveStatus}
</when>
<otherwise>
AND taa.approve_status != '不通过'
</otherwise>
</choose> -->
<if test="approveStatus != null and approveStatus != ''"> <if test="approveStatus != null and approveStatus != ''">
AND taa.approve_status = #{approveStatus} AND taa.approve_status = #{approveStatus}
</if> </if>
@ -1925,22 +1920,34 @@
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate} AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if> </if>
<if test="type == null or type == '' or type == '会议室'">
UNION ALL
UNION ALL SELECT
tmb.dept AS 'deptName',
SELECT tm.`name` AS 'resourceName',
tmb.dept AS 'deptName', '青岛市大数据发展管理局' AS 'resourceDeptName',
tm.`name` AS 'resourceName', '会议室' AS 'type',
'青岛市大数据发展管理局' AS 'resourceDeptName', tm.create_date AS 'createDate',
'会议室' AS 'type', CASE tmb.state WHEN 1 THEN '审核中' WHEN 2 THEN '通过' WHEN 3 THEN '不通过' ELSE '审核中' END AS 'approveStatus',
tm.create_date AS 'createDate', '' AS 'applyNumber'
CASE tmb.state WHEN 1 THEN '申请中' WHEN 2 THEN '通过' WHEN 3 THEN '不通过' ELSE '申请中' END AS 'approveStatus', FROM
'' AS 'applyNumber' t_meetingroom_book tmb,
FROM t_meetingroom tm
t_meetingroom_book tmb, WHERE
t_meetingroom tm tmb.room_id = tm.id
WHERE <choose>
tmb.room_id = tm.id <when test="approveStatus != null and approveStatus == '通过'">
AND tmb.state=2
</when>
<when test="approveStatus != null and approveStatus == '不通过'">
AND tmb.state=3
</when>
<when test="approveStatus != null and approveStatus == '审核中'">
AND tmb.state not in (2, 3)
</when>
</choose>
</if>
ORDER BY createDate DESC ORDER BY createDate DESC
</select> </select>