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.
gysl/ruoyi-admin/src/main/resources/mapper/ZwStatsMapper.xml

167 lines
7.0 KiB

1 month ago
<?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.gysl.mapper.ZwStatsMapper">
<select id="allProject" resultType="com.ruoyi.gysl.entity.stats.AllProjectResponse">
3 weeks ago
SELECT COUNT(*) AS allProject,
ROUND(IFNULL(SUM(b.zjzmj), 0) / 10000, 1) AS allGrossArea,
IFNULL(SUM(CASE WHEN a.xzfl = 1 THEN 1 ELSE 0 END), 0) AS allBuilding1,
IFNULL(SUM(CASE WHEN a.xzfl = 2 THEN 1 ELSE 0 END), 0) AS allBuilding2,
IFNULL(SUM(CASE WHEN a.xzfl = 3 THEN 1 ELSE 0 END), 0) AS allBuilding3,
<!-- 当前新开工项目数 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} THEN 1 ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN 1 ELSE 0 END
</otherwise>
</choose>
), 0) AS currentYearProject,
<!-- 当年_建筑面积 -->
ROUND(IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} THEN b.zjzmj ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN b.zjzmj ELSE 0 END
</otherwise>
</choose>
), 0)/10000,1) AS currentYearGrossArea,
<!-- 当年_已建数量 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} and a.xzfl = 1 THEN 1 ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) and a.xzfl = 1 THEN 1 ELSE 0 END
</otherwise>
</choose>
), 0) AS currentBuilding1,
3 weeks ago
<!-- 当年_在建数量 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} and a.xzfl = 2 THEN 1 ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) and a.xzfl = 2 THEN 1 ELSE 0 END
</otherwise>
</choose>
), 0) AS currentBuilding2,
<!-- 当年_拟建数量 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} and a.xzfl = 3 THEN 1 ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) and a.xzfl = 3 THEN 1 ELSE 0 END
</otherwise>
</choose>
), 0) AS currentBuilding3
1 month ago
FROM gysl_basic_information a
3 weeks ago
LEFT JOIN gysl_plan_information b ON a.id = b.xm_id
<where>
<if test="years != null and years != ''">
LEFT(a.begain_time, 4) &lt;= #{years}
</if>
</where>
1 month ago
</select>
<select id="ribbon" resultType="com.ruoyi.gysl.entity.stats.RibbonResponse">
3 weeks ago
SELECT COUNT(*) AS count, -- 统计左表实际存在的记录数
1 month ago
b.dict_label AS ssgnq
1 month ago
FROM
1 month ago
(SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'ssgnq') b -- 先获取所有字典项
LEFT JOIN
gysl_basic_information a
ON a.ssgnq = b.dict_value AND a.ssgnq IS NOT NULL -- 左连接并过滤空值
3 weeks ago
<where>
<if test="years != null and years != ''">
LEFT(a.begain_time, 4) = #{years}
</if>
</where>
1 month ago
GROUP BY
1 month ago
b.dict_label, b.dict_value -- 按字典项的标签和值分组
ORDER BY
b.dict_value; -- 按字典排序(可选)
1 month ago
</select>
<select id="investors" resultType="com.ruoyi.gysl.entity.stats.RibbonResponse">
1 month ago
SELECT
3 weeks ago
COUNT( * ) AS count,-- 统计左表实际存在的记录数
1 month ago
b.dict_label AS ssgnq
1 month ago
FROM
1 month ago
( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'xmfrdwxz' ) b -- 先获取所有字典项
LEFT JOIN gysl_basic_information a ON a.nature = b.dict_value
AND a.nature IS NOT NULL -- 左连接并过滤空值
3 weeks ago
<where>
<if test="years != null and years != ''">
LEFT(a.begain_time, 4) = #{years}
</if>
</where>
1 month ago
GROUP BY
1 month ago
b.dict_label,
b.dict_value -- 按字典项的标签和值分组
ORDER BY
b.dict_value;-- 按字典排序(可选)
1 month ago
</select>
1 month ago
<select id="zwNotice" resultType="com.ruoyi.docking.entity.SmartDeclaration">
select * from gysl_smart_declaration
4 weeks ago
where zw_id = #{userId} and is_read = 1
</select>
<select id="zwNoticeCount" resultType="java.lang.Integer">
1 month ago
select count(*) from gysl_smart_declaration
4 weeks ago
where zw_id = #{userId} and is_read = 1
1 month ago
</select>
1 month ago
<select id="xfcyfx" resultType="com.ruoyi.gysl.entity.stats.RibbonResponse">
SELECT COUNT(a.cylb) AS count,-- 统计左表实际存在的记录数
b.dict_label AS ssgnq
FROM
( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cylb' ) b -- 先获取所有字典项
LEFT JOIN gysl_xfcygl a
ON a.cylb = b.dict_value
AND a.cylb IS NOT NULL -- 左连接并过滤空值
GROUP BY
b.dict_label,
b.dict_value -- 按字典项的标签和值分组
ORDER BY
b.dict_value;-- 按字典排序(可选)`
</select>
<select id="mlfx" resultType="com.ruoyi.gysl.entity.stats.RibbonResponse">
SELECT COUNT(a.slmllb) AS count,-- 统计左表实际存在的记录数
b.dict_label AS ssgnq
FROM
( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'shangloumulu' ) b -- 先获取所有字典项
LEFT JOIN gysl_ml a
ON a.slmllb = b.dict_value
AND a.slmllb IS NOT NULL -- 左连接并过滤空值
GROUP BY
b.dict_label,
b.dict_value -- 按字典项的标签和值分组
ORDER BY
b.dict_value;-- 按字典排序(可选)`
</select>
<select id="allXfcyfx" resultType="java.lang.Integer">
SELECT COUNT(a.cylb)
FROM
( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cylb' ) b -- 先获取所有字典项
LEFT JOIN gysl_xfcygl a
ON a.cylb = b.dict_value
AND a.cylb IS NOT NULL -- 左连接并过滤空值
</select>
<select id="allMlfx" resultType="java.lang.Integer">
SELECT COUNT(a.slmllb) AS count
FROM
( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'shangloumulu' ) b -- 先获取所有字典项
LEFT JOIN gysl_ml a
ON a.slmllb = b.dict_value
AND a.slmllb IS NOT NULL -- 左连接并过滤空值
</select>
1 month ago
</mapper>