mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
设备统计查询优化
This commit is contained in:
parent
61fccebbc6
commit
304d36e1cc
@ -5,14 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<mapper namespace="org.dromara.web.mapper.EqEquipmentMapper">
|
||||
|
||||
|
||||
<select id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
||||
<!--<select id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
||||
SELECT
|
||||
user_id,
|
||||
nick_name,
|
||||
user_name,
|
||||
COUNT(*) AS bind_num, -- 设备总数
|
||||
SUM(CASE WHEN line_status = 0 THEN 1 ELSE 0 END) AS offline_num, -- 离线个数
|
||||
SUM(CASE WHEN line_status = 1 THEN 1 ELSE 0 END) AS online_num, -- 在线个数
|
||||
COUNT(*) AS bind_num, -- 设备总数
|
||||
SUM(CASE WHEN line_status = 0 THEN 1 ELSE 0 END) AS offline_num, -- 离线个数
|
||||
SUM(CASE WHEN line_status = 1 THEN 1 ELSE 0 END) AS online_num -- 在线个数
|
||||
FROM eq_equipment
|
||||
<where>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
@ -21,6 +21,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY user_name, nick_name
|
||||
</select>-->
|
||||
|
||||
<select id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
||||
SELECT
|
||||
e.user_id,
|
||||
s.nick_name,
|
||||
e.user_name,
|
||||
COUNT(*) AS bind_num, -- 设备总数
|
||||
SUM(CASE WHEN e.line_status = 0 THEN 1 ELSE 0 END) AS offline_num, -- 离线个数
|
||||
SUM(CASE WHEN e.line_status = 1 THEN 1 ELSE 0 END) AS online_num -- 在线个数
|
||||
FROM
|
||||
eq_equipment e
|
||||
JOIN
|
||||
sys_user s ON e.user_id = s.user_id
|
||||
<where>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
AND nick_name like
|
||||
CONCAT('%', #{nickName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
e.user_name, s.nick_name;
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticEquipmentList" resultType="org.dromara.web.domain.vo.EqEquipmentStatisticsVo">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user