mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
70 lines
2.6 KiB
XML
70 lines
2.6 KiB
XML
<?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="org.dromara.web.mapper.EqEquipmentMapper">
|
|
|
|
|
|
<!--<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 -- 在线个数
|
|
FROM eq_equipment
|
|
<where>
|
|
<if test="nickName != null and nickName != ''">
|
|
AND nick_name like
|
|
CONCAT('%', #{nickName}, '%')
|
|
</if>
|
|
</where>
|
|
GROUP BY user_name, nick_name
|
|
</select>-->
|
|
|
|
<select id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
|
SELECT
|
|
s.user_id,
|
|
s.nick_name,
|
|
s.user_name,
|
|
COUNT(e.equipment_id) 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
|
|
sys_user s
|
|
left JOIN
|
|
eq_equipment e
|
|
ON e.user_id = s.user_id
|
|
<where>
|
|
s.user_type='app_user'
|
|
<if test="nickName != null and nickName != ''">
|
|
AND s.nick_name like
|
|
CONCAT('%', #{nickName}, '%')
|
|
</if>
|
|
</where>
|
|
GROUP BY
|
|
s.user_id,s.user_name, s.nick_name
|
|
</select>
|
|
|
|
<select id="selectEquipmentStatistic" resultType="org.dromara.web.domain.vo.EqEquipmentStatisticsVo">
|
|
SELECT
|
|
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, -- 在线个数
|
|
SUM(CASE WHEN fault_status > 0 THEN 1 ELSE 0 END) AS fault_num -- 故障个数
|
|
FROM eq_equipment
|
|
<where>
|
|
<if test="type != null and type != ''">
|
|
AND 'type' like
|
|
CONCAT('%', #{type}, '%')
|
|
</if>
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
AND bind_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
</mapper>
|