You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
JinJiHuJava/ruoyi-admin/src/main/resources/mapper/jjh/ent/JDevelopmentReportMapper.xml

85 lines
2.8 KiB

<?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.ruoyi.jjh.ent.mapper.JDevelopmentReportMapper">
<select id="getTemplateMetrics" resultType="com.ruoyi.jjh.ent.entity.response.JTemplateMetricsResponse">
SELECT
'服务业企业总数' AS dataName,
'-' AS years,
count(*) AS count
FROM
bms_enterprise_basic_info
where type not like concat('%','3','%')
UNION
SELECT
'规上企业总数' AS dataName,
'-' AS years,
sum( type = 1 ) AS count
FROM
bms_enterprise_basic_info UNION
SELECT
'荣誉总数' AS dataName,
#{year} AS years,
count(*) AS count
FROM
j_project
WHERE
project_year = #{year}
UNION
SELECT
CASE
services_type
WHEN '1' THEN
'生产性服务业企业数'
WHEN '2' THEN
'生活性服务业企业数'
WHEN '3' THEN
'规上服务业企业数' ELSE '限上批零住餐企业数'
END AS dataName,
#{year} AS years,
IF
(
sum(
IF
( #{year} = years, 1, '-' )) = 0,
'-',
sum(
IF
( #{year} = years, 1, '-' ))) AS count
FROM
j_services_list
GROUP BY
services_type
UNION SELECT
a.dict_label AS dataName,
#{year} AS years,
IFNULL( rs.count, '-' ) AS count
FROM
sys_dict_data a
LEFT JOIN (
SELECT
project_big_type,
IF
(
project_big_type = 1
OR project_big_type = 9,
COUNT( DISTINCT credit_code ),
COUNT(*)) AS count
FROM
j_project
WHERE
project_big_type IN ( '1', '4' )
AND project_year = #{year}
GROUP BY
project_big_type
) AS rs ON a.dict_value = rs.project_big_type
WHERE
a.dict_type = 'project_categories'
AND a.dict_value IN (
'1',
'4'
)
</select>
</mapper>