From 7b43c04dd530bdd193e0cf02c4e19ba7c2ee2c11 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期三, 11 五月 2022 10:41:31 +0800
Subject: [PATCH] 设备归属
---
dao/src/main/resources/mapper/LightReportDataMapper.xml | 77 +++++++++++++++++++++++++++-----------
1 files changed, 55 insertions(+), 22 deletions(-)
diff --git a/dao/src/main/resources/mapper/LightReportDataMapper.xml b/dao/src/main/resources/mapper/LightReportDataMapper.xml
index 649f93f..7f035b5 100644
--- a/dao/src/main/resources/mapper/LightReportDataMapper.xml
+++ b/dao/src/main/resources/mapper/LightReportDataMapper.xml
@@ -5,22 +5,22 @@
<mapper namespace="com.sandu.ximon.dao.mapper.LightReportDataMapper">
<resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightReportData">
- <id property="lightReportDataId" column="light_report_data_id" jdbcType="BIGINT"/>
- <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
- <result property="voltage" column="voltage" jdbcType="FLOAT"/>
- <result property="electricCurrent" column="electric_current" jdbcType="FLOAT"/>
- <result property="deviceTemperature" column="device_temperature" jdbcType="FLOAT"/>
- <result property="powerFactor" column="power_factor" jdbcType="FLOAT"/>
- <result property="activePower" column="active_power" jdbcType="FLOAT"/>
- <result property="reactivePower" column="reactive_power" jdbcType="FLOAT"/>
- <result property="lightPercent" column="light_percent" jdbcType="INTEGER"/>
- <result property="light2Percent" column="light2_percent" jdbcType="INTEGER"/>
- <result property="recentlyLightSec" column="recently_light_sec" jdbcType="BIGINT"/>
- <result property="totalLightSec" column="total_light_sec" jdbcType="BIGINT"/>
- <result property="recentlyUsingPower" column="recently_using_power" jdbcType="DOUBLE"/>
- <result property="totalUsingPower" column="total_using_power" jdbcType="DOUBLE"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+ <id property="lightReportDataId" column="light_report_data_id" jdbcType="BIGINT"/>
+ <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
+ <result property="voltage" column="voltage" jdbcType="FLOAT"/>
+ <result property="electricCurrent" column="electric_current" jdbcType="FLOAT"/>
+ <result property="deviceTemperature" column="device_temperature" jdbcType="FLOAT"/>
+ <result property="powerFactor" column="power_factor" jdbcType="FLOAT"/>
+ <result property="activePower" column="active_power" jdbcType="FLOAT"/>
+ <result property="reactivePower" column="reactive_power" jdbcType="FLOAT"/>
+ <result property="lightPercent" column="light_percent" jdbcType="INTEGER"/>
+ <result property="light2Percent" column="light2_percent" jdbcType="INTEGER"/>
+ <result property="recentlyLightSec" column="recently_light_sec" jdbcType="BIGINT"/>
+ <result property="totalLightSec" column="total_light_sec" jdbcType="BIGINT"/>
+ <result property="recentlyUsingPower" column="recently_using_power" jdbcType="DOUBLE"/>
+ <result property="totalUsingPower" column="total_using_power" jdbcType="DOUBLE"/>
+ <result property="createTime1" column="create_time" jdbcType="TIMESTAMP"/>
+ <result property="updateTime1" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="listReportData" type="com.sandu.ximon.dao.bo.LightReportDataBo" extends="BaseResultMap">
@@ -46,21 +46,54 @@
</select>
<select id="listReportData" resultMap="listReportData">
SELECT
- t1.* ,t2.pole_name
+ t1.* ,t2.pole_name
FROM
- light_report_data t1
- LEFT JOIN pole t2 USING ( device_code )
+ light_report_data t1
+ LEFT JOIN pole t2 USING ( device_code )
<where>
+ 1 = 1
+
+ <if test="deviceCode != null and deviceCode != ''">
+ AND t1.device_code = #{deviceCode}
+ </if>
<if test="keyword != null and keyword != ''">
AND (
t1.device_code LIKE CONCAT('%', #{keyword},'%')
OR t2.pole_name LIKE CONCAT('%', #{keyword},'%')
)
</if>
- <if test="deviceCode != null and keyword != ''">
- AND t1.device_code = #{deviceCode}
- </if>
+
</where>
ORDER BY t1.light_report_data_id DESC
</select>
+ <select id="listReportDataByUserid" resultType="com.sandu.ximon.dao.bo.LightReportDataBo">
+ SELECT
+ t1.* ,t2.pole_name
+ FROM
+ light_report_data t1
+ LEFT JOIN pole_binding t2 ON t1.device_code = t2.device_code
+ AND t2.device_type = 0
+ LEFT JOIN pole t3 ON t3.id = t2.pole_id
+ <where>
+ 1 = 1
+
+ <if test="deviceCode != null and deviceCode != ''">
+ AND t1.device_code = #{deviceCode}
+ </if>
+ <if test="keyword != null and keyword != ''">
+ AND (
+ t1.device_code LIKE CONCAT('%', #{keyword},'%')
+ OR t2.pole_name LIKE CONCAT('%', #{keyword},'%')
+ )
+ </if>
+ <if test="userid != null">
+ AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
+ </if>
+
+ </where>
+ ORDER BY t1.light_report_data_id DESC
+ </select>
+ <select id="reportDataList" resultType="com.sandu.ximon.dao.bo.LightReportDataBo">
+
+ </select>
</mapper>
--
Gitblit v1.9.3