漏提交

This commit is contained in:
dinggang 2022-12-05 15:56:27 +08:00
parent c4e43ff5ef
commit b2b21f6442
1 changed files with 105 additions and 38 deletions

View File

@ -365,6 +365,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE
1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose>
<when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' )
@ -453,6 +456,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE
1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose>
<when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' )
@ -539,6 +545,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE
1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose>
<when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' )
@ -627,6 +636,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE
1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose>
<when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' )
@ -702,7 +714,7 @@
SELECT
districtId,
districtName,
SUM(applyPrice) AS "applyPrice"
SUM( applyPrice ) AS "applyPrice"
FROM
(
SELECT
@ -715,21 +727,24 @@
FROM
( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg
LEFT JOIN sys_dept sd ON sd.district = srg.id
LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id
LEFT JOIN sys_user su ON su.dept_id = sd.id
LEFT JOIN (
SELECT
resource_id,
SUM( apply_price ) AS "apply_price"
user_id,
SUM( apply_price ) AS "apply_price",
COUNT( id ) AS "applyCount"
FROM
t_ability_application taa
WHERE
taa.del_flag = 0
AND taa.approve_status = '通过'
GROUP BY
resource_id
) taa ON taa.resource_id = tdr.id
user_id
) taa ON taa.user_id = su.id
GROUP BY
srg.id UNION ALL
srg.id
UNION ALL
SELECT
tmb.district AS "districtId",
srg.NAME AS "districtName",
@ -851,18 +866,16 @@
SELECT
sd.id AS "deptId",
sd.NAME AS "deptName",
COUNT( tdr.id ) AS "resourceCount",
sum( taa.applyCount ) AS "resourceCount",
CONVERT (
IFNULL( SUM( taa.price ), 0 ) / 10000,
DECIMAL ( 15, 1 )) AS "applyPrice"
FROM
sys_dept sd
LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id
LEFT JOIN (
(
SELECT
resource_id,
SUM( apply_price ) AS "price",
COUNT( resource_id ) AS "applyCount"
COUNT( id ) AS "applyCount"
FROM
t_ability_application taa
WHERE
@ -870,7 +883,9 @@
AND taa.approve_status = '通过'
GROUP BY
resource_id
) taa ON taa.resource_id = tdr.id
) taa
LEFT JOIN tb_data_resource tdr ON tdr.id = taa.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE
tdr.del_flag = 0
AND sd.type = 2
@ -879,16 +894,14 @@
SELECT
1067246875800000066 AS "deptId",
'青岛市大数据发展管理局' AS "deptName",
( SELECT COUNT( id ) FROM t_meetingroom ) AS "resourceCount",
COUNT( tmb.id ) AS "resourceCount",
CONVERT (
IFNULL( SUM( tmb.apply_price ), 0 ) / 10000,
DECIMAL ( 15, 1 )) AS "applyPrice"
FROM
t_meetingroom tm
LEFT JOIN t_meetingroom_book tmb ON tmb.room_id = tm.id
t_meetingroom_book tmb
WHERE
tm.del_flag = 0
AND tmb.state = 2
tmb.state = 2
) temp
GROUP BY
deptId,
@ -924,6 +937,7 @@
WHERE
taa.del_flag = 0
AND taa.approve_status = '通过'
AND ( taa.camera_list IS NULL OR camera_list = '' )
GROUP BY
user_id
) taa
@ -950,7 +964,8 @@
tmb.dept
) temp
GROUP BY
deptName, deptId
deptName,
deptId
ORDER BY
SUM( applyPrice ) DESC
LIMIT 10
@ -958,20 +973,20 @@
<select id="getProvideDistrictFundStatement" resultType="java.util.Map">
SELECT
srg.id AS "districtId ",
srg.NAME AS "districtName",
IFNULL(SUM(taa.applyCount), 0) AS "applyCount",
convert(IFNULL( SUM( taa.apply_price ), 0 ) / 10000, decimal(15,1)) AS "applyPrice",
srg.sort
srg.id AS "districtId ",
srg.NAME AS "districtName",
IFNULL(SUM(taa.applyCount), 0) AS "applyCount",
convert(IFNULL( SUM( taa.apply_price ), 0 ) / 10000, decimal(15,1)) AS "applyPrice",
srg.sort
FROM
( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg
LEFT JOIN sys_dept sd ON sd.district = srg.id
LEFT JOIN sys_user su ON su.dept_id = sd.id
LEFT JOIN (SELECT user_id, SUM(apply_price) AS "apply_price", COUNT(id) AS "applyCount" FROM t_ability_application taa WHERE
taa.del_flag = 0
AND taa.approve_status = '通过' GROUP BY user_id ) taa ON taa.user_id = su.id
( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg
LEFT JOIN sys_dept sd ON sd.district = srg.id
LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id
LEFT JOIN (SELECT resource_id, SUM(apply_price) AS "apply_price", COUNT(id) AS "applyCount" FROM t_ability_application taa WHERE
taa.del_flag = 0
AND taa.approve_status = '通过' AND (taa.camera_list IS NULL OR taa.camera_list = '') GROUP BY resource_id ) taa ON taa.resource_id = tdr.id
GROUP BY
srg.id
srg.id
ORDER BY srg.sort
</select>
@ -979,8 +994,8 @@
SELECT
districtId,
districtName,
SUM( applyCount ) AS "applyCount",
SUM( applyPrice ) AS "applyPrice"
SUM( applyCount ) AS "applyCount",
SUM( applyPrice ) AS "applyPrice"
FROM
(
SELECT
@ -994,10 +1009,10 @@
FROM
( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg
LEFT JOIN sys_dept sd ON sd.district = srg.id
LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id
LEFT JOIN sys_user su ON su.dept_id = sd.id
LEFT JOIN (
SELECT
resource_id,
user_id,
SUM( apply_price ) AS "apply_price",
COUNT( id ) AS "applyCount"
FROM
@ -1006,10 +1021,12 @@
taa.del_flag = 0
AND taa.approve_status = '通过'
GROUP BY
resource_id
) taa ON taa.resource_id = tdr.id
user_id
) taa ON taa.user_id = su.id
GROUP BY
srg.id UNION ALL
srg.id
UNION ALL
SELECT
tmb.district AS "districtId",
srg.NAME AS "districtName",
@ -1051,5 +1068,55 @@
temp.sort
</select>
<select id="getApplyPriceCount" resultType="java.lang.Long">
SELECT CONVERT
(
SUM( temp.applyPrice ) / 10000,
DECIMAL ( 15, 1 ))
FROM
(
SELECT
taa.apply_price AS "applyPrice"
FROM
t_ability_application taa
WHERE
1 = 1
AND taa.approve_status = '通过' UNION ALL
SELECT
tmb.apply_price AS "applyPrice"
FROM
t_meetingroom_book tmb
WHERE
tmb.state = 2
) temp
</select>
<select id="getResourceFundStatementTotal" resultType="java.lang.Long">
SELECT SUM(applyPrice) FROM (
SELECT
CONVERT (
taa.price / 10000,
DECIMAL ( 15, 1 )) AS "applyPrice"
FROM
(
SELECT
resource_id,
SUM( apply_price ) AS "price",
COUNT( resource_id ) AS "applyCount"
FROM
t_ability_application taa
WHERE
taa.del_flag = 0
AND taa.approve_status = '通过'
GROUP BY
resource_id
) taa
LEFT JOIN tb_data_resource tdr ON taa.resource_id = tdr.id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE
tdr.del_flag = 0
AND tdr.type = '应用资源' ) tmp
</select>
</mapper>