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

149 lines
6.9 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, '-') AS count1,
b.dict_label AS projectMiddleName,
b.dict_value AS projectMiddleType,
IFNULL(ys.count, '-') AS count2,
c.dict_label AS projectSmallName,
c.dict_value AS projectSmallType,
IFNULL(us.count, '-') AS count3,
IFNULL(ns.count, '-') 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
where status = 5
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
where status = 5
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 or project_small_type = 1 or project_small_type = 2
or project_small_type = 3 , COUNT(DISTINCT credit_code), COUNT(*)) AS count
FROM j_project
where status = 5
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 status = 5 and YEAR(
NOW()) = ns.project_year
GROUP BY ns.project_small_type) AS ns ON c.dict_value = ns.project_small_type
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 a.alert_time,
a.alert_content,
b.project_small_type
FROM j_smart_reminders a
left JOIN j_project b on a.project_id = b.id
where a.alert_type = 4 and NOW() > a.alert_time
order by a.alert_time 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(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.gdp_proportion, 2), '-') AS gdpProportion
FROM j_industry_depth a
WHERE a.years = YEAR(NOW()) - 1
UNION ALL
SELECT a.years,
a.industry_categories,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.gdp_proportion, 2), '-') AS gdpProportion
FROM j_industry_depth a
WHERE a.years = YEAR(NOW()) - 2
AND NOT EXISTS (
SELECT 1
FROM j_industry_depth b
WHERE b.years = YEAR(NOW()) - 1
)
</select>
<select id="getMiddleIndustry"
resultType="com.ruoyi.jjh.ent.entity.response.JBigMiddleIndustryResponse">
SELECT a.categories,
a.medium AS nameType,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
IFNULL(a.growth, '-') AS growth,
IFNULL(a.gdp_proportion, '-') AS gdpProportion
FROM j_medium_revenue a
WHERE a.years = YEAR( NOW()) - 1 and a.medium != ''
</select>
<select id="getBigIndustry" resultType="com.ruoyi.jjh.ent.entity.response.JAllIndustryResponse">
SELECT a.categories AS nameType,
a.categories_code,
IFNULL(ROUND(SUM(a.year_revenue/ 10000) , 1), '-') AS yearRevenue,
IFNULL(ROUND(SUM(a.add_value), 1), '-') AS addValue,
IFNULL(ROUND(AVG(a.growth), 1), '-') AS growth,
IFNULL(ROUND(SUM(a.gdp_proportion), 1), '-') AS gdpProportion
FROM j_medium_revenue a
WHERE a.years = YEAR( NOW()) - 1
GROUP BY
a.categories_code,
a.categories
</select>
</mapper>