修改首页查询相关接口 增加条件机构是管理员的情况下不查询机构
This commit is contained in:
parent
ff7d6990af
commit
263f119309
@ -20,4 +20,7 @@ public class DeptSimpleRespVO {
|
||||
@Schema(description = "父部门 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
private Integer orgid;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -94,12 +94,9 @@ public interface AlertMessageMapper extends BaseMapperX<AlertMessageDO> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取预警统计数据 首页
|
||||
* 获取预警统计数据 首页 传递的oraid是0 则表示管理员
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
"COUNT(*) as alertTotal, " +
|
||||
"SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) as alertUnhandled " +
|
||||
"FROM tb_alert_message WHERE orgid = #{orgid}")
|
||||
|
||||
AlertStatisticsVO getAlertStatistics(@Param("orgid") Integer orgid);
|
||||
|
||||
}
|
||||
@ -59,22 +59,11 @@ public interface DeviceMapper extends BaseMapperX<DeviceDO> {
|
||||
/**
|
||||
* 获取设备基础统计
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
"COUNT(*) as totalCount, " +
|
||||
"SUM(CASE WHEN devicestatus = 1 THEN 1 ELSE 0 END) as onlineCount, " +
|
||||
"SUM(CASE WHEN devicestatus = 2 THEN 1 ELSE 0 END) as offlineCount " +
|
||||
"FROM tb_device WHERE orgid = #{orgid}")
|
||||
DeviceStatistics getDeviceStatistics(@Param("orgid") Integer orgid);
|
||||
|
||||
/**
|
||||
* 获取省份设备数量统计
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
"SUBSTRING_INDEX(location, '/', 1) as province, " +
|
||||
"COUNT(*) as count " +
|
||||
"FROM tb_device " +
|
||||
"WHERE orgid = #{orgid} " +
|
||||
"GROUP BY SUBSTRING_INDEX(location, '/', 1)")
|
||||
List<ProvinceDeviceCount> getProvinceDeviceCount(@Param("orgid") Integer orgid);
|
||||
|
||||
/**
|
||||
|
||||
@ -8,5 +8,16 @@
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="getAlertStatistics" resultType="cn.iocoder.yudao.module.system.controller.admin.alertmessage.vo.AlertStatisticsVO">
|
||||
SELECT
|
||||
COUNT(*) as alertTotal,
|
||||
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) as alertUnhandled
|
||||
FROM tb_alert_message
|
||||
<where>
|
||||
<!-- 如果 orgid 不等于某个特定值(例如999),才加上 orgid 条件 -->
|
||||
<if test="orgid != null and orgid != 0">
|
||||
AND orgid = #{orgid}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -14,6 +14,39 @@
|
||||
SUM(CASE WHEN devicestatus = 1 THEN 1 ELSE 0 END) AS onlineCount,
|
||||
SUM(CASE WHEN devicestatus = 2 THEN 1 ELSE 0 END) AS offlineCount
|
||||
FROM tb_device
|
||||
WHERE orgid = #{orgid}
|
||||
<where>
|
||||
<!-- 如果 orgid 不等于 0,则加上 orgid 条件 -->
|
||||
<if test="orgid != null and orgid != 0">
|
||||
AND orgid = #{orgid}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getDeviceStatistics" resultType="cn.iocoder.yudao.module.system.controller.admin.device.vo.DeviceStatistics">
|
||||
SELECT
|
||||
COUNT(*) AS totalCount,
|
||||
SUM(CASE WHEN devicestatus = 1 THEN 1 ELSE 0 END) AS onlineCount,
|
||||
SUM(CASE WHEN devicestatus = 2 THEN 1 ELSE 0 END) AS offlineCount
|
||||
FROM tb_device
|
||||
<where>
|
||||
<!-- 如果 orgid 不等于 0,则加上 orgid 条件 -->
|
||||
<if test="orgid != null and orgid != 0">
|
||||
AND orgid = #{orgid}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getProvinceDeviceCount" resultType="cn.iocoder.yudao.module.system.controller.admin.device.vo.ProvinceDeviceCount">
|
||||
SELECT
|
||||
SUBSTRING_INDEX(location, '/', 1) AS province,
|
||||
COUNT(*) AS count
|
||||
FROM tb_device
|
||||
<where>
|
||||
<!-- 如果 orgid 不等于 0,则加上 orgid 条件 -->
|
||||
<if test="orgid != null and orgid != 0">
|
||||
AND orgid = #{orgid}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY SUBSTRING_INDEX(location, '/', 1)
|
||||
</select>
|
||||
</mapper>
|
||||
@ -36,7 +36,12 @@
|
||||
COUNT(*) AS count
|
||||
FROM tb_user
|
||||
WHERE isvip = 1
|
||||
AND orgid = #{orgid}
|
||||
<where>
|
||||
<!-- 如果 orgid 不等于 0,则加上 orgid 条件 -->
|
||||
<if test="orgid != null and orgid != 0">
|
||||
AND orgid = #{orgid}
|
||||
</if>
|
||||
</where>
|
||||
AND vipstarttime >= DATE_SUB(CURDATE(), INTERVAL 6 DAY)
|
||||
AND vipstarttime < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
|
||||
GROUP BY DATE(vipstarttime)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user