|
@@ -0,0 +1,59 @@
|
|
|
+<?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.AlarmSettingMapper">
|
|
|
+ <!-- 结果集 -->
|
|
|
+ <resultMap type="com.huaxu.dto.AlarmSettingDto" id="alarmSettingMap">
|
|
|
+ <result property="id" column="ID" jdbcType="INTEGER"/>
|
|
|
+ <result property="companyOrgId" column="company_org_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="deptOrgId" column="dept_org_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="sceneName" column="scene_name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deviceId" column="device_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="deviceType" column="device_type" jdbcType="VARCHAR"/>
|
|
|
+ <result property="attributeId" column="attribute_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="attributeName" column="attribute_name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmType" column="alarm_type" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmCondition" column="alarm_condition" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmValue" column="alarm_value" jdbcType="VARCHAR"/>
|
|
|
+ <result property="remark" column="remark" jdbcType="VARCHAR"/>
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
+ <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="dateCreate" column="date_create" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="dateUpdate" column="date_update" jdbcType="TIMESTAMP"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 基本字段 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ t1.*,t2.company_org_id,t2.dept_org_id,t2.scene_id,t3.scene_name,t2.device_name,t2.device_type_id,t5.device_type,t4.name attribute_name
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 外联表 -->
|
|
|
+ <sql id="leftJoins">
|
|
|
+ left join sms_device t2 on t1.device_id=t2.id
|
|
|
+ left join sms_scene t3 on t2.scene_id=t3.id
|
|
|
+ left join sms_device_attribute t4 on t1.attribute_id=t4.id
|
|
|
+ left join sms_device_type t5 on t2.device_type_id=t5.id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="findPage" resultMap="alarmSettingMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from sms_alarm_setting t1
|
|
|
+ <include refid="leftJoins"/>
|
|
|
+ <where>
|
|
|
+ <if test="alarm.id != null">
|
|
|
+ and t1.id = #{alarm.id}
|
|
|
+ </if>
|
|
|
+ <if test="alarm.attributeName != null and alarm.attributeName != ''">
|
|
|
+ and t4.name like CONCAT('%',#{alarm.attributeName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="alarm.sceneId != null ">
|
|
|
+ and t2.scene_id = #{alarm.sceneId}
|
|
|
+ </if>
|
|
|
+ and t1.STATUS =1
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|