|
@@ -0,0 +1,202 @@
|
|
|
+<?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.AlarmTypeMapper">
|
|
|
+ <!-- 结果集 -->
|
|
|
+ <resultMap type="com.zcxk.rmcp.core.entity.AlarmType" id="AlarmTypeMap">
|
|
|
+ <result property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="productCategroyId" column="product_categroy_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="deviceTypeId" column="device_type_id" jdbcType="INTEGER"/>
|
|
|
+ <result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
+ <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="typeDesc" column="type_desc" jdbcType="VARCHAR"/>
|
|
|
+ <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmStatus" column="alarm_status" jdbcType="INTEGER"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 基本字段 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, product_categroy_id, device_type_id, name, status, create_date, create_by, update_date, update_by, type_desc, tenant_id, alarm_status </sql>
|
|
|
+
|
|
|
+ <!-- 查询单个 -->
|
|
|
+ <select id="selectById" resultMap="AlarmTypeMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_alarm_type
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 查询全部 -->
|
|
|
+ <select id="selectAll" resultMap="AlarmTypeMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_alarm_type
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--通过实体作为筛选条件查询-->
|
|
|
+ <select id="selectList" resultMap="AlarmTypeMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_alarm_type
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="productCategroyId != null">
|
|
|
+ and product_categroy_id = #{productCategroyId}
|
|
|
+ </if>
|
|
|
+ <if test="deviceTypeId != null">
|
|
|
+ and device_type_id = #{deviceTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and name = #{name}
|
|
|
+ </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="typeDesc != null and typeDesc != ''">
|
|
|
+ and type_desc = #{typeDesc}
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">
|
|
|
+ and tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="alarmStatus != null">
|
|
|
+ and alarm_status = #{alarmStatus}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 新增所有列 -->
|
|
|
+ <insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into rmcp_alarm_type(id, product_categroy_id, device_type_id, name, status, create_date, create_by,
|
|
|
+ update_date, update_by, type_desc, tenant_id, alarm_status)
|
|
|
+ values (#{id}, #{productCategroyId}, #{deviceTypeId}, #{name}, #{status}, #{createDate}, #{createBy},
|
|
|
+ #{updateDate}, #{updateBy}, #{typeDesc}, #{tenantId}, #{alarmStatus})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 批量新增 -->
|
|
|
+ <insert id="batchInsert">
|
|
|
+ insert into rmcp_alarm_type(id, product_categroy_id, device_type_id, name, status, create_date, create_by,
|
|
|
+ update_date, update_by, type_desc, tenant_id, alarm_status)
|
|
|
+ values
|
|
|
+ <foreach collection="alarmTypes" item="item" index="index" separator=",">
|
|
|
+ (
|
|
|
+ #{item.id}, #{item.productCategroyId}, #{item.deviceTypeId}, #{item.name}, #{item.status},
|
|
|
+ #{item.createDate}, #{item.createBy}, #{item.updateDate}, #{item.updateBy}, #{item.typeDesc},
|
|
|
+ #{item.tenantId}, #{item.alarmStatus} )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 通过主键修改数据 -->
|
|
|
+ <update id="update">
|
|
|
+ update rmcp_alarm_type
|
|
|
+ <set>
|
|
|
+ <if test="productCategroyId != null">
|
|
|
+ product_categroy_id = #{productCategroyId},
|
|
|
+ </if>
|
|
|
+ <if test="deviceTypeId != null">
|
|
|
+ device_type_id = #{deviceTypeId},
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ name = #{name},
|
|
|
+ </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="typeDesc != null and typeDesc != ''">
|
|
|
+ type_desc = #{typeDesc},
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">
|
|
|
+ tenant_id = #{tenantId},
|
|
|
+ </if>
|
|
|
+ <if test="alarmStatus != null">
|
|
|
+ alarm_status = #{alarmStatus},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--通过主键删除-->
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete
|
|
|
+ from rmcp_alarm_type
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 总数 -->
|
|
|
+ <select id="count" resultType="int">
|
|
|
+ select count(*)
|
|
|
+ from rmcp_alarm_type
|
|
|
+ </select>
|
|
|
+ <select id="selectPage" resultMap="AlarmTypeMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from rmcp_alarm_type
|
|
|
+ <where>
|
|
|
+ <if test="alarmType.id != null">
|
|
|
+ and id = #{alarmType.id}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.productCategroyId != null">
|
|
|
+ and product_categroy_id = #{alarmType.productCategroyId}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.deviceTypeId != null">
|
|
|
+ and device_type_id = #{alarmType.deviceTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.name != null and alarmType.name != ''">
|
|
|
+ and name = #{alarmType.name}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.status != null">
|
|
|
+ and status = #{alarmType.status}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.createDate != null">
|
|
|
+ and create_date = #{alarmType.createDate}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.createBy != null and alarmType.createBy != ''">
|
|
|
+ and create_by = #{alarmType.createBy}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.updateDate != null">
|
|
|
+ and update_date = #{alarmType.updateDate}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.updateBy != null and alarmType.updateBy != ''">
|
|
|
+ and update_by = #{alarmType.updateBy}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.typeDesc != null and alarmType.typeDesc != ''">
|
|
|
+ and type_desc = #{alarmType.typeDesc}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.tenantId != null and alarmType.tenantId != ''">
|
|
|
+ and tenant_id = #{alarmType.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType.alarmStatus != null">
|
|
|
+ and alarm_status = #{alarmType.alarmStatus}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+</mapper>
|