统计报表状态修改

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>
<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 != ''">
and tda.creator = #{userId}
</if>

View File

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