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/JDataScreenMapper.xml

143 lines
6.2 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.JDataScreenMapper">
<select id="getHonor" resultType="com.ruoyi.jjh.ent.entity.response.HonorResponse">
SELECT a.dict_label AS projectBigName,
a.dict_value AS projectBigType,
IFNULL(rs.count, 0) AS count1,
b.dict_label AS projectMiddleName,
b.dict_value AS projectMiddleType,
IFNULL(ys.count, 0) AS count2,
c.dict_label AS projectSmallName,
c.dict_value AS projectSmallType,
IFNULL(us.count, 0) AS count3,
IFNULL(ns.count, 0) AS currentYearAdd
FROM sys_dict_data a
JOIN sys_dict_data b ON a.remark = b.dict_type
JOIN sys_dict_data c ON b.remark = c.dict_type
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
GROUP BY project_big_type) AS rs ON a.dict_value = rs.project_big_type
LEFT JOIN (SELECT project_middle_type,
IF
(
project_middle_type = 1
OR project_middle_type = 9,
COUNT(DISTINCT credit_code),
COUNT(*)) AS count
FROM j_project
GROUP BY project_middle_type) AS ys ON b.dict_value = ys.project_middle_type
LEFT JOIN (SELECT project_small_type,
IF(project_small_type = 14, COUNT(DISTINCT credit_code), COUNT(*)) AS count
FROM j_project
GROUP BY project_small_type) AS us ON c.dict_value = us.project_small_type
LEFT JOIN (SELECT ns.project_small_type,
COUNT(*) AS count
FROM j_project ns
WHERE YEAR(
NOW()) = ns.project_year
GROUP BY ns.project_small_type) AS ns ON c.dict_value = ns.project_small_type
9 months ago
WHERE a.dict_type = 'project_categories' and a.dict_value != 11
ORDER BY CAST(c.dict_value AS UNSIGNED);
</select>
<select id="getProjectTracking" resultType="com.ruoyi.jjh.ent.entity.response.ProjectTrackingResponse">
SELECT
b.enterprise_directory,
b.start_time,
b.end_time,
COUNT(*) as count
FROM
bms_declaration_records a
INNER JOIN bms_template_record b ON a.template_record_id = b.id
WHERE
a.`status` != 0
GROUP BY
a.template_record_id
order by
count desc
</select>
<select id="servicesDevelop" resultType="com.ruoyi.jjh.ent.entity.response.JServicesDevelopResponse">
SELECT
a.develop_year,
IFNULL(a.quarterly,0) as quarterly,
IFNULL(a.value_added,0) as valueAdded,
IFNULL(a.increase_speed,0) as increaseSpeed,
IFNULL(a.gdp_proportion,0) as gdpProportion
FROM
j_services_develop a
<where>
<if test="type == 1 ">
YEAR(NOW()) > a.develop_year
</if>
<if test="type != 1 ">
YEAR(NOW()) = a.develop_year
</if>
</where>
ORDER BY
a.develop_year ASC
LIMIT 5
</select>
<select id="getIndustryDepth" resultType="com.ruoyi.jjh.ent.entity.response.JIndustryDepthResponse">
SELECT
a.years,
a.industry_categories,
IFNULL(a.year_revenue,0) as yearRevenue,
IFNULL(a.add_value,0) as addValue,
IFNULL(a.growth,0) as growth,
IFNULL(a.gdp_proportion,0) as gdpProportion
FROM
j_industry_depth a
WHERE
a.years = YEAR (NOW())-1
</select>
<select id="getMiddleIndustry"
resultType="com.ruoyi.jjh.ent.entity.response.JBigMiddleIndustryResponse">
SELECT
a.categories,
a.middle as nameType,
ROUND( SUM( IFNULL( b.year_revenue, 0 ))/ 10000, 3 ) AS yearRevenue,
ROUND( SUM( IFNULL( b.add_value, 0 ))/ 10000, 3 ) AS addValue,
IFNULL( b.growth, 0 ) AS growth,
IFNULL( b.gdp_proportion, 0 ) AS gdpProportion
FROM
j_industry_dictionary a
LEFT JOIN j_small_industry b ON a.middle_code = LEFT ( b.small_code, 2 )
WHERE
b.years = YEAR (
NOW())- 1 || b.years IS NULL
GROUP BY
a.middle,
a.categories,
b.growth,
b.gdp_proportion
</select>
<select id="getBigIndustry" resultType="com.ruoyi.jjh.ent.entity.response.JAllIndustryResponse">
SELECT
a.categories AS nameType,
ROUND( SUM( IFNULL( b.year_revenue, 0 ))/ 10000, 3 ) AS yearRevenue,
ROUND( SUM( IFNULL( b.add_value, 0 ))/ 10000, 3 ) AS addValue,
IFNULL( b.growth, 0 ) AS growth,
IFNULL( b.gdp_proportion, 0 ) AS gdpProportion
FROM
j_industry_dictionary a
LEFT JOIN j_small_industry b ON a.middle_code = LEFT ( b.small_code, 2 )
WHERE
b.years = YEAR (
NOW())- 1 || b.years IS NULL
GROUP BY
a.categories,
b.growth,
b.gdp_proportion
ORDER BY a.middle_code ASC
</select>
</mapper>