Browse Source

日报月报年报实体

wangyangyang 4 years ago
parent
commit
8ee0116081

+ 34 - 0
sms_water/src/main/java/com/huaxu/dao/DayReportMapper.java

@@ -0,0 +1,34 @@
+package com.huaxu.dao;
+
+import com.huaxu.entity.DayReportEntity;
+import java.io.Serializable;
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+/**
+ *
+ * sms_day_reportDAO接口
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Mapper
+public interface DayReportMapper extends BaseMapper<DayReportEntity> {
+
+	/**
+     * 自定义分页查询
+     * @param  page 
+     * @param  dayReportEntity 实体类
+     */
+     Page<DayReportEntity> findPage(IPage<DayReportEntity> page,
+                                       @Param("dayReport") DayReportEntity dayReportEntity);
+
+     DayReportEntity findDayReportById(Serializable id);
+
+
+     List<DayReportEntity> findList(DayReportEntity dayReportEntity);
+
+     /**删除相关方法  使用mybatis-plus集成的 **/
+}

+ 37 - 0
sms_water/src/main/java/com/huaxu/dao/MonthReportMapper.java

@@ -0,0 +1,37 @@
+package com.huaxu.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huaxu.entity.DayReportEntity;
+import com.huaxu.entity.MonthReportEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *
+ * sms_day_reportDAO接口
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Mapper
+public interface MonthReportMapper extends BaseMapper<MonthReportEntity> {
+
+	/**
+     * 自定义分页查询
+     * @param  page 
+     * @param  monthReportEntity 实体类
+     */
+     Page<MonthReportEntity> findPage(IPage<MonthReportEntity> page,
+                                       @Param("monthReport") MonthReportEntity monthReportEntity);
+
+    MonthReportEntity findMonthReportById(Serializable id);
+
+
+     List<MonthReportEntity> findList(MonthReportEntity monthReportEntity);
+
+     /**删除相关方法  使用mybatis-plus集成的 **/
+}

+ 37 - 0
sms_water/src/main/java/com/huaxu/dao/YearReportMapper.java

@@ -0,0 +1,37 @@
+package com.huaxu.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huaxu.entity.DayReportEntity;
+import com.huaxu.entity.YearReportEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *
+ * sms_day_reportDAO接口
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Mapper
+public interface YearReportMapper extends BaseMapper<YearReportEntity> {
+
+	/**
+     * 自定义分页查询
+     * @param  page 
+     * @param  yearReportEntity 实体类
+     */
+     Page<YearReportEntity> findPage(IPage<YearReportEntity> page,
+                                       @Param("yearReport") YearReportEntity yearReportEntity);
+
+    YearReportEntity findYearReportById(Serializable id);
+
+
+     List<YearReportEntity> findList(YearReportEntity yearReportEntity);
+
+     /**删除相关方法  使用mybatis-plus集成的 **/
+}

+ 127 - 0
sms_water/src/main/java/com/huaxu/entity/DayReportEntity.java

@@ -0,0 +1,127 @@
+package com.huaxu.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableName;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * sms_day_report
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Data
+@TableName("sms_day_report")
+public class DayReportEntity{
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */ 
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /** 租户标识 */
+    @ApiModelProperty(value = "租户标识")
+    private String tenantId;
+
+    /** 年 */
+    @ApiModelProperty(value = "年")
+    private Integer year;
+
+    /** 月 */
+    @ApiModelProperty(value = "月")
+    private Integer month;
+
+    /** 日 */
+    @ApiModelProperty(value = "日")
+    private Integer day;
+
+    /** 时 */
+    @ApiModelProperty(value = "时")
+    private Integer hour;
+
+    /** 一级场景 */
+    @ApiModelProperty(value = "一级场景")
+    private Long parentSceneId;
+
+    /** 一级场景名称 */
+    @ApiModelProperty(value = "一级场景名称")
+    private String parentSceneName;
+
+    /** 场景信息 */
+    @ApiModelProperty(value = "场景信息")
+    private Long sceneId;
+
+    /** 场景名称 */
+    @ApiModelProperty(value = "场景名称")
+    private String sceneName;
+
+    /** 设备信息 */
+    @ApiModelProperty(value = "设备信息")
+    private Long deviceId;
+
+    /** 设备名称 */
+    @ApiModelProperty(value = "设备名称")
+    private String deviceName;
+
+    /** 设备编号 */
+    @ApiModelProperty(value = "设备编号")
+    private String deviceCode;
+
+    /** 设备属性 */
+    @ApiModelProperty(value = "设备属性")
+    private Long attributeId;
+
+    /** 设备属性名称 */
+    @ApiModelProperty(value = "设备属性名称")
+    private String attributeName;
+
+    /** 最小值 */
+    @ApiModelProperty(value = "最小值")
+    private Double minValue;
+
+    /** 最大值 */
+    @ApiModelProperty(value = "最大值")
+    private Double maxValue;
+
+    /** 平均值 */
+    @ApiModelProperty(value = "平均值")
+    private Double avgValue;
+
+    /** 合计值 */
+    @ApiModelProperty(value = "合计值")
+    private Double sumValue;
+
+    /** 最新值 */
+    @ApiModelProperty(value = "最新值")
+    private Double latestValue;
+
+    /** 采集时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @NotNull(message = "参数值不能为空")
+    @ApiModelProperty(value = "采集时间")
+    private Date collectDate;
+
+
+    @JsonIgnore
+    private Date dateCreate;
+
+    @ApiModelProperty(value = "创建人")
+    @JsonIgnore
+    private String createBy;
+
+    @JsonIgnore
+    private Date dateUpdate;
+
+    @ApiModelProperty(value = "更新人")
+    @JsonIgnore
+    private String updateBy;
+}

+ 126 - 0
sms_water/src/main/java/com/huaxu/entity/MonthReportEntity.java

@@ -0,0 +1,126 @@
+package com.huaxu.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * sms_day_report
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Data
+@TableName("sms_month_report")
+public class MonthReportEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */ 
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /** 租户标识 */
+    @ApiModelProperty(value = "租户标识")
+    private String tenantId;
+
+    /** 年 */
+    @ApiModelProperty(value = "年")
+    private Integer year;
+
+    /** 月 */
+    @ApiModelProperty(value = "月")
+    private Integer month;
+
+    /** 日 */
+    @ApiModelProperty(value = "日")
+    private Integer day;
+
+    /** 时 */
+    @ApiModelProperty(value = "时")
+    private Integer hour;
+
+    /** 一级场景 */
+    @ApiModelProperty(value = "一级场景")
+    private Long parentSceneId;
+
+    /** 一级场景名称 */
+    @ApiModelProperty(value = "一级场景名称")
+    private String parentSceneName;
+
+    /** 场景信息 */
+    @ApiModelProperty(value = "场景信息")
+    private Long sceneId;
+
+    /** 场景名称 */
+    @ApiModelProperty(value = "场景名称")
+    private String sceneName;
+
+    /** 设备信息 */
+    @ApiModelProperty(value = "设备信息")
+    private Long deviceId;
+
+    /** 设备名称 */
+    @ApiModelProperty(value = "设备名称")
+    private String deviceName;
+
+    /** 设备编号 */
+    @ApiModelProperty(value = "设备编号")
+    private String deviceCode;
+
+    /** 设备属性 */
+    @ApiModelProperty(value = "设备属性")
+    private Long attributeId;
+
+    /** 设备属性名称 */
+    @ApiModelProperty(value = "设备属性名称")
+    private String attributeName;
+
+    /** 最小值 */
+    @ApiModelProperty(value = "最小值")
+    private Double minValue;
+
+    /** 最大值 */
+    @ApiModelProperty(value = "最大值")
+    private Double maxValue;
+
+    /** 平均值 */
+    @ApiModelProperty(value = "平均值")
+    private Double avgValue;
+
+    /** 合计值 */
+    @ApiModelProperty(value = "合计值")
+    private Double sumValue;
+
+    /** 最新值 */
+    @ApiModelProperty(value = "最新值")
+    private Double latestValue;
+
+    /** 采集时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @NotNull(message = "参数值不能为空")
+    @ApiModelProperty(value = "采集时间")
+    private Date collectDate;
+
+
+    @JsonIgnore
+    private Date dateCreate;
+
+    @ApiModelProperty(value = "创建人")
+    @JsonIgnore
+    private String createBy;
+
+    @JsonIgnore
+    private Date dateUpdate;
+
+    @ApiModelProperty(value = "更新人")
+    @JsonIgnore
+    private String updateBy;
+}

+ 126 - 0
sms_water/src/main/java/com/huaxu/entity/YearReportEntity.java

@@ -0,0 +1,126 @@
+package com.huaxu.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * sms_day_report
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Data
+@TableName("sms_year_report")
+public class YearReportEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */ 
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /** 租户标识 */
+    @ApiModelProperty(value = "租户标识")
+    private String tenantId;
+
+    /** 年 */
+    @ApiModelProperty(value = "年")
+    private Integer year;
+
+    /** 月 */
+    @ApiModelProperty(value = "月")
+    private Integer month;
+
+    /** 日 */
+    @ApiModelProperty(value = "日")
+    private Integer day;
+
+    /** 时 */
+    @ApiModelProperty(value = "时")
+    private Integer hour;
+
+    /** 一级场景 */
+    @ApiModelProperty(value = "一级场景")
+    private Long parentSceneId;
+
+    /** 一级场景名称 */
+    @ApiModelProperty(value = "一级场景名称")
+    private String parentSceneName;
+
+    /** 场景信息 */
+    @ApiModelProperty(value = "场景信息")
+    private Long sceneId;
+
+    /** 场景名称 */
+    @ApiModelProperty(value = "场景名称")
+    private String sceneName;
+
+    /** 设备信息 */
+    @ApiModelProperty(value = "设备信息")
+    private Long deviceId;
+
+    /** 设备名称 */
+    @ApiModelProperty(value = "设备名称")
+    private String deviceName;
+
+    /** 设备编号 */
+    @ApiModelProperty(value = "设备编号")
+    private String deviceCode;
+
+    /** 设备属性 */
+    @ApiModelProperty(value = "设备属性")
+    private Long attributeId;
+
+    /** 设备属性名称 */
+    @ApiModelProperty(value = "设备属性名称")
+    private String attributeName;
+
+    /** 最小值 */
+    @ApiModelProperty(value = "最小值")
+    private Double minValue;
+
+    /** 最大值 */
+    @ApiModelProperty(value = "最大值")
+    private Double maxValue;
+
+    /** 平均值 */
+    @ApiModelProperty(value = "平均值")
+    private Double avgValue;
+
+    /** 合计值 */
+    @ApiModelProperty(value = "合计值")
+    private Double sumValue;
+
+    /** 最新值 */
+    @ApiModelProperty(value = "最新值")
+    private Double latestValue;
+
+    /** 采集时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @NotNull(message = "参数值不能为空")
+    @ApiModelProperty(value = "采集时间")
+    private Date collectDate;
+
+
+    @JsonIgnore
+    private Date dateCreate;
+
+    @ApiModelProperty(value = "创建人")
+    @JsonIgnore
+    private String createBy;
+
+    @JsonIgnore
+    private Date dateUpdate;
+
+    @ApiModelProperty(value = "更新人")
+    @JsonIgnore
+    private String updateBy;
+}

+ 55 - 0
sms_water/src/main/java/com/huaxu/service/DayReportService.java

@@ -0,0 +1,55 @@
+package com.huaxu.service;
+
+
+import com.huaxu.dao.DayReportMapper;
+import com.huaxu.entity.DayReportEntity;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
+import javax.annotation.Resource;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Arrays;
+
+/**
+ * 日报Service接口
+ *
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Service
+public class DayReportService extends ServiceImpl<DayReportMapper, DayReportEntity> {
+
+    @Resource
+    private DayReportMapper dayReportMapper;
+
+    /**
+     * 查列表
+     */
+    public List<DayReportEntity> findList(DayReportEntity dayReportEntity) {
+        return dayReportMapper.findList(dayReportEntity);
+    }
+
+    /**
+     * 保存
+     */
+    public boolean addDayReport(DayReportEntity dayReport) {
+        if (this.save(dayReport)) {
+            return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * 根居ID获取对象
+     */
+    public DayReportEntity findDayReportById(Long id) {
+        return dayReportMapper.findDayReportById(id);
+    }
+}

+ 54 - 0
sms_water/src/main/java/com/huaxu/service/MonthReportService.java

@@ -0,0 +1,54 @@
+package com.huaxu.service;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huaxu.dao.DayReportMapper;
+import com.huaxu.dao.MonthReportMapper;
+import com.huaxu.entity.DayReportEntity;
+import com.huaxu.entity.MonthReportEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 日报Service接口
+ *
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Service
+public class MonthReportService extends ServiceImpl<MonthReportMapper, MonthReportEntity> {
+
+    @Resource
+    private MonthReportMapper monthReportMapper;
+
+    /**
+     * 查列表
+     */
+    public List<MonthReportEntity> findList(MonthReportEntity monthReportEntity) {
+        return monthReportMapper.findList(monthReportEntity);
+    }
+
+
+
+    /**
+     * 保存
+     */
+    public boolean addMonthReport(MonthReportEntity monthReport) {
+        if (this.save(monthReport)) {
+            return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * 根居ID获取对象
+     */
+    public MonthReportEntity findMonthReportById(Long id) {
+        return monthReportMapper.findMonthReportById(id);
+    }
+}

+ 55 - 0
sms_water/src/main/java/com/huaxu/service/YearReportService.java

@@ -0,0 +1,55 @@
+package com.huaxu.service;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huaxu.dao.DayReportMapper;
+import com.huaxu.dao.MonthReportMapper;
+import com.huaxu.dao.YearReportMapper;
+import com.huaxu.entity.DayReportEntity;
+import com.huaxu.entity.MonthReportEntity;
+import com.huaxu.entity.YearReportEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 日报Service接口
+ *
+ * @author: WYY
+ * @date 2020-12-03 16:20
+ */
+@Service
+public class YearReportService extends ServiceImpl<YearReportMapper, YearReportEntity> {
+
+    @Resource
+    private YearReportMapper yearReportMapper;
+
+    /**
+     * 查列表
+     */
+    public List<YearReportEntity> findList(YearReportEntity yearReportEntity) {
+        return yearReportMapper.findList(yearReportEntity);
+    }
+
+
+    /**
+     * 保存
+     */
+    public boolean addYearReport(YearReportEntity yearReport) {
+        if (this.save(yearReport)) {
+            return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * 根居ID获取对象
+     */
+    public YearReportEntity findYearReportById(Long id) {
+        return yearReportMapper.findYearReportById(id);
+    }
+}

+ 117 - 0
sms_water/src/main/resources/mapper/DayReportMapper.xml

@@ -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.DayReportMapper">
+
+
+    <resultMap type="DayReportEntity" id="DayReportResult">
+        <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="dayReportColumns">
+         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="findDayReportById" resultType="com.huaxu.entity.DayReportEntity">
+        SELECT
+        <include refid="dayReportColumns"/>
+        FROM sms_day_report a
+        WHERE a.id = #{id}
+    </select>
+
+    <!--  根据获取实体List   -->
+    <select id="findList" resultType="com.huaxu.entity.DayReportEntity">
+        SELECT
+        <include refid="dayReportColumns"/>
+        FROM sms_day_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.DayReportEntity">
+        SELECT
+        <include refid="dayReportColumns"/>
+        FROM sms_day_report a
+        <where>
+            <if test="dayReport.tenantId != null  and dayReport.tenantId != ''">and a.tenant_id =
+                #{dayReport.tenantId}
+            </if>
+            <if test="dayReport.year != null ">and a.year = #{dayReport.year}</if>
+            <if test="dayReport.month != null ">and a.month = #{dayReport.month}</if>
+            <if test="dayReport.day != null ">and a.day = #{dayReport.day}</if>
+            <if test="dayReport.hour != null ">and a.hour = #{dayReport.hour}</if>
+            <if test="dayReport.parentSceneId != null ">and a.parent_scene_id = #{dayReport.parentSceneId}</if>
+            <if test="dayReport.sceneId != null ">and a.scene_id = #{dayReport.sceneId}</if>
+            <if test="dayReport.deviceId != null ">and a.device_id = #{dayReport.deviceId}</if>
+            <if test="dayReport.deviceCode != null  and dayReport.deviceCode != ''">and a.device_code =
+                #{dayReport.deviceCode}
+            </if>
+            <if test="dayReport.attributeId != null ">and a.attribute_id = #{dayReport.attributeId}</if>
+            <if test="dayReport.collectDate != null ">and a.collect_date = #{dayReport.collectDate}</if>
+        </where>
+    </select>
+</mapper>

+ 117 - 0
sms_water/src/main/resources/mapper/MonthReportMapper.xml

@@ -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>

+ 117 - 0
sms_water/src/main/resources/mapper/YearReportMapper.xml

@@ -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.YearReportMapper">
+
+
+    <resultMap type="YearReportEntity" id="YearReportResult">
+        <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="yearReportColumns">
+         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="findYearReportById" resultType="com.huaxu.entity.YearReportEntity">
+        SELECT
+        <include refid="yearReportColumns"/>
+        FROM sms_year_report a
+        WHERE a.id = #{id}
+    </select>
+
+    <!--  根据获取实体List   -->
+    <select id="findList" resultType="com.huaxu.entity.YearReportEntity">
+        SELECT
+        <include refid="yearReportColumns"/>
+        FROM sms_year_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.YearReportEntity">
+        SELECT
+        <include refid="yearReportColumns"/>
+        FROM sms_year_report a
+        <where>
+            <if test="yearReport.tenantId != null  and yearReport.tenantId != ''">and a.tenant_id =
+                #{yearReport.tenantId}
+            </if>
+            <if test="yearReport.year != null ">and a.year = #{yearReport.year}</if>
+            <if test="yearReport.month != null ">and a.month = #{yearReport.month}</if>
+            <if test="yearReport.day != null ">and a.day = #{yearReport.day}</if>
+            <if test="yearReport.hour != null ">and a.hour = #{yearReport.hour}</if>
+            <if test="yearReport.parentSceneId != null ">and a.parent_scene_id = #{yearReport.parentSceneId}</if>
+            <if test="yearReport.sceneId != null ">and a.scene_id = #{yearReport.sceneId}</if>
+            <if test="yearReport.deviceId != null ">and a.device_id = #{yearReport.deviceId}</if>
+            <if test="yearReport.deviceCode != null  and yearReport.deviceCode != ''">and a.device_code =
+                #{yearReport.deviceCode}
+            </if>
+            <if test="yearReport.attributeId != null ">and a.attribute_id = #{yearReport.attributeId}</if>
+            <if test="yearReport.collectDate != null ">and a.collect_date = #{yearReport.collectDate}</if>
+        </where>
+    </select>
+</mapper>