mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
46 lines
1.7 KiB
XML
46 lines
1.7 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="selectStatisticEquipmentList" 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>
|