|
|
@@ -0,0 +1,142 @@
|
|
|
+<?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.jjt.biz.mapper.DeviceChannelsMapper">
|
|
|
+
|
|
|
+ <resultMap type="DeviceChannels" id="DeviceChannelsResult">
|
|
|
+ <result property="channelId" column="CHANNEL_ID"/>
|
|
|
+ <result property="channelName" column="CHANNEL_NAME"/>
|
|
|
+ <result property="houseName" column="HOUSE_NAME"/>
|
|
|
+ <result property="houseCode" column="HOUSE_CODE"/>
|
|
|
+ <result property="deviceName" column="DEVICE_NAME"/>
|
|
|
+ <result property="deviceCode" column="DEVICE_CODE"/>
|
|
|
+ <result property="manufacturer" column="MANUFACTURER"/>
|
|
|
+ <result property="model" column="MODEL"/>
|
|
|
+ <result property="status" column="STATUS"/>
|
|
|
+ <result property="createBy" column="CREATE_BY"/>
|
|
|
+ <result property="createTime" column="CREATE_TIME"/>
|
|
|
+ <result property="updateBy" column="UPDATE_BY"/>
|
|
|
+ <result property="updateTime" column="UPDATE_TIME"/>
|
|
|
+ <result property="remark" column="REMARK"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectDeviceChannelsVo">
|
|
|
+ select CHANNEL_ID,
|
|
|
+ CHANNEL_NAME,
|
|
|
+ HOUSE_NAME,
|
|
|
+ HOUSE_CODE,
|
|
|
+ DEVICE_NAME,
|
|
|
+ DEVICE_CODE,
|
|
|
+ MANUFACTURER,
|
|
|
+ MODEL,
|
|
|
+ STATUS,
|
|
|
+ CREATE_BY,
|
|
|
+ CREATE_TIME,
|
|
|
+ UPDATE_BY,
|
|
|
+ UPDATE_TIME,
|
|
|
+ REMARK
|
|
|
+ from device_channels
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectDeviceChannelsList" parameterType="DeviceChannels" resultMap="DeviceChannelsResult">
|
|
|
+ <include refid="selectDeviceChannelsVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="channelName != null and channelName != ''">and CHANNEL_NAME like concat('%', #{channelName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="houseName != null and houseName != ''">and HOUSE_NAME like concat('%', #{houseName}, '%')</if>
|
|
|
+ <if test="houseCode != null and houseCode != ''">and HOUSE_CODE = #{houseCode}</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">and DEVICE_NAME like concat('%', #{deviceName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">and DEVICE_CODE = #{deviceCode}</if>
|
|
|
+ <if test="manufacturer != null and manufacturer != ''">and MANUFACTURER = #{manufacturer}</if>
|
|
|
+ <if test="model != null and model != ''">and MODEL = #{model}</if>
|
|
|
+ <if test="status != null and status != ''">and STATUS = #{status}</if>
|
|
|
+ <if test="createBy != null and createBy != ''">and CREATE_BY = #{createBy}</if>
|
|
|
+ <if test="createTime != null ">and CREATE_TIME = #{createTime}</if>
|
|
|
+ <if test="updateBy != null and updateBy != ''">and UPDATE_BY = #{updateBy}</if>
|
|
|
+ <if test="updateTime != null ">and UPDATE_TIME = #{updateTime}</if>
|
|
|
+ <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectDeviceChannelsByChannelId" parameterType="String" resultMap="DeviceChannelsResult">
|
|
|
+ <include refid="selectDeviceChannelsVo"/>
|
|
|
+ where CHANNEL_ID = #{channelId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertDeviceChannels" parameterType="DeviceChannels">
|
|
|
+ insert into device_channels
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="channelId != null">CHANNEL_ID,</if>
|
|
|
+ <if test="channelName != null">CHANNEL_NAME,</if>
|
|
|
+ <if test="houseName != null">HOUSE_NAME,</if>
|
|
|
+ <if test="houseCode != null">HOUSE_CODE,</if>
|
|
|
+ <if test="deviceName != null">DEVICE_NAME,</if>
|
|
|
+ <if test="deviceCode != null">DEVICE_CODE,</if>
|
|
|
+ <if test="manufacturer != null">MANUFACTURER,</if>
|
|
|
+ <if test="model != null">MODEL,</if>
|
|
|
+ <if test="status != null">STATUS,</if>
|
|
|
+ <if test="createBy != null">CREATE_BY,</if>
|
|
|
+ <if test="createTime != null">CREATE_TIME,</if>
|
|
|
+ <if test="updateBy != null">UPDATE_BY,</if>
|
|
|
+ <if test="updateTime != null">UPDATE_TIME,</if>
|
|
|
+ <if test="remark != null">REMARK,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="channelId != null">#{channelId},</if>
|
|
|
+ <if test="channelName != null">#{channelName},</if>
|
|
|
+ <if test="houseName != null">#{houseName},</if>
|
|
|
+ <if test="houseCode != null">#{houseCode},</if>
|
|
|
+ <if test="deviceName != null">#{deviceName},</if>
|
|
|
+ <if test="deviceCode != null">#{deviceCode},</if>
|
|
|
+ <if test="manufacturer != null">#{manufacturer},</if>
|
|
|
+ <if test="model != null">#{model},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateDeviceChannels" parameterType="DeviceChannels">
|
|
|
+ update device_channels
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="channelName != null">CHANNEL_NAME = #{channelName},</if>
|
|
|
+ <if test="houseName != null">HOUSE_NAME = #{houseName},</if>
|
|
|
+ <if test="houseCode != null">HOUSE_CODE = #{houseCode},</if>
|
|
|
+ <if test="deviceName != null">DEVICE_NAME = #{deviceName},</if>
|
|
|
+ <if test="deviceCode != null">DEVICE_CODE = #{deviceCode},</if>
|
|
|
+ <if test="manufacturer != null">MANUFACTURER = #{manufacturer},</if>
|
|
|
+ <if test="model != null">MODEL = #{model},</if>
|
|
|
+ <if test="status != null">STATUS = #{status},</if>
|
|
|
+ <if test="createBy != null">CREATE_BY = #{createBy},</if>
|
|
|
+ <if test="createTime != null">CREATE_TIME = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
|
|
|
+ <if test="remark != null">REMARK = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where CHANNEL_ID = #{channelId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteDeviceChannelsByChannelId" parameterType="String">
|
|
|
+ delete
|
|
|
+ from device_channels
|
|
|
+ where CHANNEL_ID = #{channelId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDeviceChannelsByChannelIds" parameterType="String">
|
|
|
+ delete from device_channels where CHANNEL_ID in
|
|
|
+ <foreach item="channelId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{channelId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+ <delete id="deleteDeviceChannelsByDeviceCode">
|
|
|
+ delete
|
|
|
+ from device_channels
|
|
|
+ where DEVICE_CODE = #{deviceCode}
|
|
|
+ </delete>
|
|
|
+</mapper>
|