|
@@ -0,0 +1,125 @@
|
|
|
|
|
+<?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.zd.airbottle.mapper.DbBluetoothGatewayMapper">
|
|
|
|
|
+
|
|
|
|
|
+ <resultMap type="com.zd.airbottle.domain.DbBluetoothGateway" id="DbBluetoothGatewayResult">
|
|
|
|
|
+ <result property="id" column="id"/>
|
|
|
|
|
+ <result property="gatewayName" column="gateway_name"/>
|
|
|
|
|
+ <result property="gatewayMac" column="gateway_mac"/>
|
|
|
|
|
+ <result property="gatewayOnline" column="gateway_online"/>
|
|
|
|
|
+ <result property="deptId" column="dept_id"/>
|
|
|
|
|
+ <result property="deptName" column="dept_name"/>
|
|
|
|
|
+ <result property="subId" column="sub_id"/>
|
|
|
|
|
+ <result property="subName" column="sub_name"/>
|
|
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
|
|
+ <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="selectDbBluetoothGatewayVo">
|
|
|
|
|
+ select id, gateway_name,gateway_mac, gateway_online, dept_id, dept_name
|
|
|
|
|
+ , sub_id, sub_name, user_id, create_by, create_time, update_by, update_time, remark from db_bluetooth_gateway
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectDbBluetoothGatewayList" parameterType="com.zd.airbottle.domain.DbBluetoothGateway" resultMap="DbBluetoothGatewayResult">
|
|
|
|
|
+ <include refid="selectDbBluetoothGatewayVo"/>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="searchValue != null and searchValue != ''">
|
|
|
|
|
+ and sub_name like concat('%', #{searchValue}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="deptId != null and deptId!='' ">
|
|
|
|
|
+ and dept_id = #{deptId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="gatewayOnline != null and gatewayOnline!='' ">
|
|
|
|
|
+ and gateway_online = #{gatewayOnline}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="gatewayMac != null and gatewayMac!='' ">
|
|
|
|
|
+ and gateway_mac = #{gatewayMac}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="subId != null and subId!='' ">
|
|
|
|
|
+ and sub_id = #{subId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectDbBluetoothGatewayById" resultMap="DbBluetoothGatewayResult">
|
|
|
|
|
+ <include refid="selectDbBluetoothGatewayVo"/>
|
|
|
|
|
+ where id = #{id}
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <insert id="insertDbBluetoothGateway" parameterType="com.zd.airbottle.domain.DbBluetoothGateway" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
+ insert into db_bluetooth_gateway
|
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
+ <if test="gatewayName != null">gateway_name,</if>
|
|
|
|
|
+ <if test="gatewayMac != null">gateway_mac,</if>
|
|
|
|
|
+ <if test="gatewayOnline != null">gateway_online,</if>
|
|
|
|
|
+ <if test="deptId != null">dept_id,</if>
|
|
|
|
|
+ <if test="deptName != null">dept_name,</if>
|
|
|
|
|
+ <if test="subId != null">sub_id,</if>
|
|
|
|
|
+ <if test="subName != null">sub_name,</if>
|
|
|
|
|
+ <if test="userId != null">user_id,</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="gatewayName != null">#{gatewayName},</if>
|
|
|
|
|
+ <if test="gatewayMac != null">#{gatewayMac},</if>
|
|
|
|
|
+ <if test="gatewayOnline != null">#{gatewayOnline},</if>
|
|
|
|
|
+ <if test="deptId != null">#{deptId},</if>
|
|
|
|
|
+ <if test="deptName != null">#{deptName},</if>
|
|
|
|
|
+ <if test="subId != null">#{subId},</if>
|
|
|
|
|
+ <if test="subName != null">#{subName},</if>
|
|
|
|
|
+ <if test="userId != null">#{userId},</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="updateDbBluetoothGateway" parameterType="com.zd.airbottle.domain.DbBluetoothGateway">
|
|
|
|
|
+ update db_bluetooth_gateway
|
|
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
+ <if test="gatewayName != null">gateway_name = #{gatewayName},</if>
|
|
|
|
|
+ <if test="gatewayMac != null">gateway_mac = #{gatewayMac},</if>
|
|
|
|
|
+ <if test="gatewayOnline != null">gateway_online = #{gatewayOnline},</if>
|
|
|
|
|
+ <if test="deptId != null">dept_id = #{deptId},</if>
|
|
|
|
|
+ <if test="deptName != null">dept_name = #{deptName},</if>
|
|
|
|
|
+ <if test="subId != null">sub_id = #{subId},</if>
|
|
|
|
|
+ <if test="subName != null">sub_name = #{subName},</if>
|
|
|
|
|
+ <if test="userId != null">user_id = #{userId},</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 id = #{id}
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteeDbBluetoothGatewayByIds">
|
|
|
|
|
+ delete from db_bluetooth_gateway where id in
|
|
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
+ #{id}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <update id="setOnline" parameterType="com.zd.airbottle.domain.DbBluetoothGateway">
|
|
|
|
|
+ update db_bluetooth_gateway
|
|
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
+ <if test="gatewayOnline != null">gateway_online = #{gatewayOnline},</if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ where gateway_mac = #{gatewayMac}
|
|
|
|
|
+ </update>
|
|
|
|
|
+</mapper>
|