|
@@ -0,0 +1,117 @@
|
|
|
+<?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="com.huaxu.dao.MonthReportMapper">
|
|
|
+
|
|
|
+
|
|
|
+ <resultMap type="MonthReportEntity" id="MonthReportResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="tenantId" column="tenant_id"/>
|
|
|
+ <result property="year" column="year"/>
|
|
|
+ <result property="month" column="month"/>
|
|
|
+ <result property="day" column="day"/>
|
|
|
+ <result property="hour" column="hour"/>
|
|
|
+ <result property="parentSceneId" column="parent_scene_id"/>
|
|
|
+ <result property="parentSceneName" column="parent_scene_name"/>
|
|
|
+ <result property="sceneId" column="scene_id"/>
|
|
|
+ <result property="sceneName" column="scene_name"/>
|
|
|
+ <result property="deviceId" column="device_id"/>
|
|
|
+ <result property="deviceName" column="device_name"/>
|
|
|
+ <result property="deviceCode" column="device_code"/>
|
|
|
+ <result property="attributeId" column="attribute_id"/>
|
|
|
+ <result property="attributeName" column="attribute_name"/>
|
|
|
+ <result property="minValue" column="min_value"/>
|
|
|
+ <result property="maxValue" column="max_value"/>
|
|
|
+ <result property="avgValue" column="avg_value"/>
|
|
|
+ <result property="sumValue" column="sum_value"/>
|
|
|
+ <result property="latestValue" column="latest_value"/>
|
|
|
+ <result property="collectDate" column="collect_date"/>
|
|
|
+ <result property="dateCreate" column="date_create"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="dateUpdate" column="date_update"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 实体栏位 -->
|
|
|
+ <sql id="monthReportColumns">
|
|
|
+ a.id as "id" ,
|
|
|
+ a.tenant_id as "tenantId" ,
|
|
|
+ a.year as "year" ,
|
|
|
+ a.month as "month" ,
|
|
|
+ a.day as "day" ,
|
|
|
+ a.hour as "hour" ,
|
|
|
+ a.parent_scene_id as "parentSceneId" ,
|
|
|
+ a.parent_scene_name as "parentSceneName" ,
|
|
|
+ a.scene_id as "sceneId" ,
|
|
|
+ a.scene_name as "sceneName" ,
|
|
|
+ a.device_id as "deviceId" ,
|
|
|
+ a.device_name as "deviceName" ,
|
|
|
+ a.device_code as "deviceCode" ,
|
|
|
+ a.attribute_id as "attributeId" ,
|
|
|
+ a.attribute_name as "attributeName" ,
|
|
|
+ a.min_value as "minValue" ,
|
|
|
+ a.max_value as "maxValue" ,
|
|
|
+ a.avg_value as "avgValue" ,
|
|
|
+ a.sum_value as "sumValue" ,
|
|
|
+ a.latest_value as "latestValue" ,
|
|
|
+ a.collect_date as "collectDate" ,
|
|
|
+ a.date_create as "dateCreate" ,
|
|
|
+ a.create_by as "createBy" ,
|
|
|
+ a.date_update as "dateUpdate" ,
|
|
|
+ a.update_by as "updateBy"
|
|
|
+ </sql>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 根据主键获取实体 -->
|
|
|
+ <select id="findMonthReportById" resultType="com.huaxu.entity.MonthReportEntity">
|
|
|
+ SELECT
|
|
|
+ <include refid="monthReportColumns"/>
|
|
|
+ FROM sms_month_report a
|
|
|
+ WHERE a.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据获取实体List -->
|
|
|
+ <select id="findList" resultType="com.huaxu.entity.MonthReportEntity">
|
|
|
+ SELECT
|
|
|
+ <include refid="monthReportColumns"/>
|
|
|
+ FROM sms_month_report a
|
|
|
+ <where>
|
|
|
+ <if test="tenantId != null and tenantId != ''">and a.tenant_id = #{tenantId}</if>
|
|
|
+ <if test="year != null ">and a.year = #{year}</if>
|
|
|
+ <if test="month != null ">and a.month = #{month}</if>
|
|
|
+ <if test="day != null ">and a.day = #{day}</if>
|
|
|
+ <if test="hour != null ">and a.hour = #{hour}</if>
|
|
|
+ <if test="parentSceneId != null ">and a.parent_scene_id = #{parentSceneId}</if>
|
|
|
+ <if test="sceneId != null ">and a.scene_id = #{sceneId}</if>
|
|
|
+ <if test="deviceId != null ">and a.device_id = #{deviceId}</if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">and a.device_code = #{deviceCode}</if>
|
|
|
+ <if test="attributeId != null ">and a.attribute_id = #{attributeId}</if>
|
|
|
+ <if test="collectDate != null ">and a.collect_date = #{collectDate}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据获取实体 page -->
|
|
|
+ <select id="findPage" resultType="com.huaxu.entity.MonthReportEntity">
|
|
|
+ SELECT
|
|
|
+ <include refid="monthReportColumns"/>
|
|
|
+ FROM sms_month_report a
|
|
|
+ <where>
|
|
|
+ <if test="monthReport.tenantId != null and monthReport.tenantId != ''">and a.tenant_id =
|
|
|
+ #{monthReport.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="monthReport.year != null ">and a.year = #{monthReport.year}</if>
|
|
|
+ <if test="monthReport.month != null ">and a.month = #{monthReport.month}</if>
|
|
|
+ <if test="monthReport.day != null ">and a.day = #{monthReport.day}</if>
|
|
|
+ <if test="monthReport.hour != null ">and a.hour = #{monthReport.hour}</if>
|
|
|
+ <if test="monthReport.parentSceneId != null ">and a.parent_scene_id = #{monthReport.parentSceneId}</if>
|
|
|
+ <if test="monthReport.sceneId != null ">and a.scene_id = #{monthReport.sceneId}</if>
|
|
|
+ <if test="monthReport.deviceId != null ">and a.device_id = #{monthReport.deviceId}</if>
|
|
|
+ <if test="monthReport.deviceCode != null and monthReport.deviceCode != ''">and a.device_code =
|
|
|
+ #{monthReport.deviceCode}
|
|
|
+ </if>
|
|
|
+ <if test="monthReport.attributeId != null ">and a.attribute_id = #{monthReport.attributeId}</if>
|
|
|
+ <if test="monthReport.collectDate != null ">and a.collect_date = #{monthReport.collectDate}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+</mapper>
|