|
@@ -0,0 +1,266 @@
|
|
|
+<?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.zcxk.rmcp.core.dao.DeviceAlarmRuleMapper">
|
|
|
+ <!-- 结果集 -->
|
|
|
+ <resultMap type="com.zcxk.rmcp.core.entity.DeviceAlarmRule" id="DeviceAlarmRuleMap">
|
|
|
+ <result property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="productCategroyId" column="product_categroy_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="tenantId" column="tenant_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="deviceType" column="device_type" jdbcType="INTEGER"/>
|
|
|
+ <result property="ruleName" column="rule_name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="measuringCode" column="measuring_code" jdbcType="VARCHAR"/>
|
|
|
+ <result property="expression" column="expression" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmTypeId" column="alarm_type_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
+ <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
|
|
+ <result property="ruleDesc" column="rule_desc" jdbcType="VARCHAR"/>
|
|
|
+ <result property="value1" column="value1" jdbcType="VARCHAR"/>
|
|
|
+ <result property="value2" column="value2" jdbcType="VARCHAR"/>
|
|
|
+ <result property="measuringDataType" column="measuring_data_type" jdbcType="INTEGER"/>
|
|
|
+ <result property="specification" column="specification" jdbcType="VARCHAR"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 基本字段 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, product_categroy_id, tenant_id, device_type, rule_name, measuring_code, expression, alarm_type_id, status, create_date, create_by, update_date, update_by, rule_desc, value1, value2, measuring_data_type, specification </sql>
|
|
|
+
|
|
|
+ <!-- 查询单个 -->
|
|
|
+ <select id="selectById" resultMap="DeviceAlarmRuleMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_device_alarm_rule
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 查询全部 -->
|
|
|
+ <select id="selectAll" resultMap="DeviceAlarmRuleMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_device_alarm_rule
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--通过实体作为筛选条件查询-->
|
|
|
+ <select id="selectList" resultMap="DeviceAlarmRuleMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_device_alarm_rule
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="productCategroyId != null">
|
|
|
+ and product_categroy_id = #{productCategroyId}
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ and tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null">
|
|
|
+ and device_type = #{deviceType}
|
|
|
+ </if>
|
|
|
+ <if test="ruleName != null and ruleName != ''">
|
|
|
+ and rule_name = #{ruleName}
|
|
|
+ </if>
|
|
|
+ <if test="measuringCode != null and measuringCode != ''">
|
|
|
+ and measuring_code = #{measuringCode}
|
|
|
+ </if>
|
|
|
+ <if test="expression != null and expression != ''">
|
|
|
+ and expression = #{expression}
|
|
|
+ </if>
|
|
|
+ <if test="alarmTypeId != null">
|
|
|
+ and alarm_type_id = #{alarmTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="createDate != null">
|
|
|
+ and create_date = #{createDate}
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null and createBy != ''">
|
|
|
+ and create_by = #{createBy}
|
|
|
+ </if>
|
|
|
+ <if test="updateDate != null">
|
|
|
+ and update_date = #{updateDate}
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null and updateBy != ''">
|
|
|
+ and update_by = #{updateBy}
|
|
|
+ </if>
|
|
|
+ <if test="ruleDesc != null and ruleDesc != ''">
|
|
|
+ and rule_desc = #{ruleDesc}
|
|
|
+ </if>
|
|
|
+ <if test="value1 != null and value1 != ''">
|
|
|
+ and value1 = #{value1}
|
|
|
+ </if>
|
|
|
+ <if test="value2 != null and value2 != ''">
|
|
|
+ and value2 = #{value2}
|
|
|
+ </if>
|
|
|
+ <if test="measuringDataType != null">
|
|
|
+ and measuring_data_type = #{measuringDataType}
|
|
|
+ </if>
|
|
|
+ <if test="specification != null and specification != ''">
|
|
|
+ and specification = #{specification}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 新增所有列 -->
|
|
|
+ <insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into rmcp_device_alarm_rule(id, product_categroy_id, tenant_id, device_type, rule_name, measuring_code,
|
|
|
+ expression, alarm_type_id, status, create_date, create_by, update_date,
|
|
|
+ update_by, rule_desc, value1, value2, measuring_data_type, specification)
|
|
|
+ values (#{id}, #{productCategroyId}, #{tenantId}, #{deviceType}, #{ruleName}, #{measuringCode}, #{expression},
|
|
|
+ #{alarmTypeId}, #{status}, #{createDate}, #{createBy}, #{updateDate}, #{updateBy}, #{ruleDesc},
|
|
|
+ #{value1}, #{value2}, #{measuringDataType}, #{specification})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 批量新增 -->
|
|
|
+ <insert id="batchInsert">
|
|
|
+ insert into rmcp_device_alarm_rule(id, product_categroy_id, tenant_id, device_type, rule_name, measuring_code,
|
|
|
+ expression, alarm_type_id, status, create_date, create_by, update_date, update_by, rule_desc, value1, value2,
|
|
|
+ measuring_data_type, specification)
|
|
|
+ values
|
|
|
+ <foreach collection="deviceAlarmRules" item="item" index="index" separator=",">
|
|
|
+ (
|
|
|
+ #{item.id}, #{item.productCategroyId}, #{item.tenantId}, #{item.deviceType}, #{item.ruleName},
|
|
|
+ #{item.measuringCode}, #{item.expression}, #{item.alarmTypeId}, #{item.status}, #{item.createDate},
|
|
|
+ #{item.createBy}, #{item.updateDate}, #{item.updateBy}, #{item.ruleDesc}, #{item.value1}, #{item.value2},
|
|
|
+ #{item.measuringDataType}, #{item.specification} )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 通过主键修改数据 -->
|
|
|
+ <update id="update">
|
|
|
+ update rmcp_device_alarm_rule
|
|
|
+ <set>
|
|
|
+ <if test="productCategroyId != null">
|
|
|
+ product_categroy_id = #{productCategroyId},
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ tenant_id = #{tenantId},
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null">
|
|
|
+ device_type = #{deviceType},
|
|
|
+ </if>
|
|
|
+ <if test="ruleName != null and ruleName != ''">
|
|
|
+ rule_name = #{ruleName},
|
|
|
+ </if>
|
|
|
+ <if test="measuringCode != null and measuringCode != ''">
|
|
|
+ measuring_code = #{measuringCode},
|
|
|
+ </if>
|
|
|
+ <if test="expression != null and expression != ''">
|
|
|
+ expression = #{expression},
|
|
|
+ </if>
|
|
|
+ <if test="alarmTypeId != null">
|
|
|
+ alarm_type_id = #{alarmTypeId},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="createDate != null">
|
|
|
+ create_date = #{createDate},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null and createBy != ''">
|
|
|
+ create_by = #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateDate != null">
|
|
|
+ update_date = #{updateDate},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null and updateBy != ''">
|
|
|
+ update_by = #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="ruleDesc != null and ruleDesc != ''">
|
|
|
+ rule_desc = #{ruleDesc},
|
|
|
+ </if>
|
|
|
+ <if test="value1 != null and value1 != ''">
|
|
|
+ value1 = #{value1},
|
|
|
+ </if>
|
|
|
+ <if test="value2 != null and value2 != ''">
|
|
|
+ value2 = #{value2},
|
|
|
+ </if>
|
|
|
+ <if test="measuringDataType != null">
|
|
|
+ measuring_data_type = #{measuringDataType},
|
|
|
+ </if>
|
|
|
+ <if test="specification != null and specification != ''">
|
|
|
+ specification = #{specification},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--通过主键删除-->
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete
|
|
|
+ from rmcp_device_alarm_rule
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 总数 -->
|
|
|
+ <select id="count" resultType="int">
|
|
|
+ select count(*)
|
|
|
+ from rmcp_device_alarm_rule
|
|
|
+ </select>
|
|
|
+ <select id="selectPage" resultMap="DeviceAlarmRuleMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_device_alarm_rule
|
|
|
+ <where>
|
|
|
+ <if test="deviceAlarmRule.id != null">
|
|
|
+ and id = #{deviceAlarmRule.id}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.productCategroyId != null">
|
|
|
+ and product_categroy_id = #{deviceAlarmRule.productCategroyId}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.tenantId != null">
|
|
|
+ and tenant_id = #{deviceAlarmRule.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.deviceType != null">
|
|
|
+ and device_type = #{deviceAlarmRule.deviceType}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.ruleName != null and deviceAlarmRule.ruleName != ''">
|
|
|
+ and rule_name = #{deviceAlarmRule.ruleName}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.measuringCode != null and deviceAlarmRule.measuringCode != ''">
|
|
|
+ and measuring_code = #{deviceAlarmRule.measuringCode}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.expression != null and deviceAlarmRule.expression != ''">
|
|
|
+ and expression = #{deviceAlarmRule.expression}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.alarmTypeId != null">
|
|
|
+ and alarm_type_id = #{deviceAlarmRule.alarmTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.status != null">
|
|
|
+ and status = #{deviceAlarmRule.status}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.createDate != null">
|
|
|
+ and create_date = #{deviceAlarmRule.createDate}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.createBy != null and deviceAlarmRule.createBy != ''">
|
|
|
+ and create_by = #{deviceAlarmRule.createBy}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.updateDate != null">
|
|
|
+ and update_date = #{deviceAlarmRule.updateDate}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.updateBy != null and deviceAlarmRule.updateBy != ''">
|
|
|
+ and update_by = #{deviceAlarmRule.updateBy}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.ruleDesc != null and deviceAlarmRule.ruleDesc != ''">
|
|
|
+ and rule_desc = #{deviceAlarmRule.ruleDesc}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.value1 != null and deviceAlarmRule.value1 != ''">
|
|
|
+ and value1 = #{deviceAlarmRule.value1}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.value2 != null and deviceAlarmRule.value2 != ''">
|
|
|
+ and value2 = #{deviceAlarmRule.value2}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.measuringDataType != null">
|
|
|
+ and measuring_data_type = #{deviceAlarmRule.measuringDataType}
|
|
|
+ </if>
|
|
|
+ <if test="deviceAlarmRule.specification != null and deviceAlarmRule.specification != ''">
|
|
|
+ and specification = #{deviceAlarmRule.specification}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+</mapper>
|