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

79 lines
2.6 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,
null as years,
count(*) as count
from bms_enterprise_basic_info
UNION
SELECT
'规上企业总数' as dataName,
null as years,
sum(type = 1) as count
from bms_enterprise_basic_info
UNION
SELECT
'荣誉总数' as dataName,
project_year as years,
count(*) as count
from j_project
<where>
<if test="years!= null and years != '' ">
project_year = #{year}
</if>
</where>
UNION
SELECT
CASE services_type
WHEN '1' THEN '生产性服务业企业数'
WHEN '2' THEN '生活性服务业企业数'
WHEN '3' THEN '新兴服务业企业数'
ELSE '限上批零住餐企业数'
END as dataName,
years as years,
count(*) as count
from j_services_list
<where>
<if test="years!= null and years != '' ">
years = #{year}
</if>
</where>
GROUP BY
services_type
UNION
SELECT
a.dict_label AS dataName,
IF(#{year} is null,null,rs.project_year) AS years,
IFNULL( rs.count, 0 ) 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,
project_year
FROM
j_project
<where>
<if test="years!= null and years != '' ">
project_year = #{year}
</if>
</where>
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 != 11
</select>
</mapper>