| | |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightReportData"> |
| | | <id property="lightReportDataId" column="light_report_data_id" jdbcType="BIGINT"/> |
| | | <result property="deviceMac" column="device_mac" jdbcType="VARCHAR"/> |
| | | <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="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="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | light_report_data_id,device_mac,voltage, |
| | | electric_current,device_temperature,power_factor, |
| | | active_power,reactive_power,light_percent, |
| | | recently_light_sec,total_light_sec,recently_using_power, |
| | | total_using_power,create_time,update_time |
| | | </sql> |
| | | <resultMap id="listReportData" type="com.sandu.ximon.dao.bo.LightReportDataBo" extends="BaseResultMap"> |
| | | <result property="poleName" column="pole_name" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <select id="getNewestReportByDeviceCode" resultMap="BaseResultMap"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | light_report_data t1 |
| | | JOIN ( |
| | | SELECT |
| | | MAX( light_report_data_id ) AS light_report_data_id |
| | | FROM |
| | | light_report_data |
| | | WHERE device_code IN |
| | | <foreach collection="deviceCodeList" open="(" close=")" separator="," item="deviceCode"> |
| | | #{deviceCode} |
| | | </foreach> |
| | | GROUP BY device_code |
| | | ) AS t2 USING ( light_report_data_id ) |
| | | </select> |
| | | <select id="listReportData" resultMap="listReportData"> |
| | | SELECT |
| | | t1.* ,t2.pole_name |
| | | FROM |
| | | light_report_data t1 |
| | | LEFT JOIN pole t2 USING ( device_code ) |
| | | <where> |
| | | <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> |
| | | </mapper> |