DbBluetoothGatewayMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zd.airbottle.mapper.DbBluetoothGatewayMapper">
  6. <resultMap type="com.zd.airbottle.domain.DbBluetoothGateway" id="DbBluetoothGatewayResult">
  7. <result property="id" column="id"/>
  8. <result property="gatewayName" column="gateway_name"/>
  9. <result property="gatewayMac" column="gateway_mac"/>
  10. <result property="gatewayOnline" column="gateway_online"/>
  11. <result property="deptId" column="dept_id"/>
  12. <result property="deptName" column="dept_name"/>
  13. <result property="subId" column="sub_id"/>
  14. <result property="subName" column="sub_name"/>
  15. <result property="userId" column="user_id"/>
  16. <result property="createBy" column="create_by"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="updateBy" column="update_by"/>
  19. <result property="updateTime" column="update_time"/>
  20. <result property="remark" column="remark"/>
  21. </resultMap>
  22. <sql id="selectDbBluetoothGatewayVo">
  23. select id, gateway_name,gateway_mac, gateway_online, dept_id, dept_name
  24. , sub_id, sub_name, user_id, create_by, create_time, update_by, update_time, remark from db_bluetooth_gateway
  25. </sql>
  26. <select id="selectDbBluetoothGatewayList" parameterType="com.zd.airbottle.domain.DbBluetoothGateway" resultMap="DbBluetoothGatewayResult">
  27. <include refid="selectDbBluetoothGatewayVo"/>
  28. <where>
  29. <if test="searchValue != null and searchValue != ''">
  30. and sub_name like concat('%', #{searchValue}, '%')
  31. </if>
  32. <if test="deptId != null and deptId!='' ">
  33. and dept_id = #{deptId}
  34. </if>
  35. <if test="gatewayOnline != null and gatewayOnline!='' ">
  36. and gateway_online = #{gatewayOnline}
  37. </if>
  38. <if test="gatewayMac != null and gatewayMac!='' ">
  39. and gateway_mac = #{gatewayMac}
  40. </if>
  41. <if test="subId != null and subId!='' ">
  42. and sub_id = #{subId}
  43. </if>
  44. </where>
  45. </select>
  46. <select id="selectDbBluetoothGatewayById" resultMap="DbBluetoothGatewayResult">
  47. <include refid="selectDbBluetoothGatewayVo"/>
  48. where id = #{id}
  49. </select>
  50. <insert id="insertDbBluetoothGateway" parameterType="com.zd.airbottle.domain.DbBluetoothGateway" useGeneratedKeys="true" keyProperty="id">
  51. insert into db_bluetooth_gateway
  52. <trim prefix="(" suffix=")" suffixOverrides=",">
  53. <if test="gatewayName != null">gateway_name,</if>
  54. <if test="gatewayMac != null">gateway_mac,</if>
  55. <if test="gatewayOnline != null">gateway_online,</if>
  56. <if test="deptId != null">dept_id,</if>
  57. <if test="deptName != null">dept_name,</if>
  58. <if test="subId != null">sub_id,</if>
  59. <if test="subName != null">sub_name,</if>
  60. <if test="userId != null">user_id,</if>
  61. <if test="createBy != null">create_by,</if>
  62. <if test="createTime != null">create_time,</if>
  63. <if test="updateBy != null">update_by,</if>
  64. <if test="updateTime != null">update_time,</if>
  65. <if test="remark != null">remark,</if>
  66. </trim>
  67. <trim prefix="values (" suffix=")" suffixOverrides=",">
  68. <if test="gatewayName != null">#{gatewayName},</if>
  69. <if test="gatewayMac != null">#{gatewayMac},</if>
  70. <if test="gatewayOnline != null">#{gatewayOnline},</if>
  71. <if test="deptId != null">#{deptId},</if>
  72. <if test="deptName != null">#{deptName},</if>
  73. <if test="subId != null">#{subId},</if>
  74. <if test="subName != null">#{subName},</if>
  75. <if test="userId != null">#{userId},</if>
  76. <if test="createBy != null">#{createBy},</if>
  77. <if test="createTime != null">#{createTime},</if>
  78. <if test="updateBy != null">#{updateBy},</if>
  79. <if test="updateTime != null">#{updateTime},</if>
  80. <if test="remark != null">#{remark},</if>
  81. </trim>
  82. </insert>
  83. <update id="updateDbBluetoothGateway" parameterType="com.zd.airbottle.domain.DbBluetoothGateway">
  84. update db_bluetooth_gateway
  85. <trim prefix="SET" suffixOverrides=",">
  86. <if test="gatewayName != null">gateway_name = #{gatewayName},</if>
  87. <if test="gatewayMac != null">gateway_mac = #{gatewayMac},</if>
  88. <if test="gatewayOnline != null">gateway_online = #{gatewayOnline},</if>
  89. <if test="deptId != null">dept_id = #{deptId},</if>
  90. <if test="deptName != null">dept_name = #{deptName},</if>
  91. <if test="subId != null">sub_id = #{subId},</if>
  92. <if test="subName != null">sub_name = #{subName},</if>
  93. <if test="userId != null">user_id = #{userId},</if>
  94. <if test="createBy != null">create_by = #{createBy},</if>
  95. <if test="createTime != null">create_time = #{createTime},</if>
  96. <if test="updateBy != null">update_by = #{updateBy},</if>
  97. <if test="updateTime != null">update_time = #{updateTime},</if>
  98. <if test="remark != null">remark = #{remark},</if>
  99. </trim>
  100. where id = #{id}
  101. </update>
  102. <delete id="deleteeDbBluetoothGatewayByIds">
  103. delete from db_bluetooth_gateway where id in
  104. <foreach item="id" collection="array" open="(" separator="," close=")">
  105. #{id}
  106. </foreach>
  107. </delete>
  108. <update id="setOnline" parameterType="com.zd.airbottle.domain.DbBluetoothGateway">
  109. update db_bluetooth_gateway
  110. <trim prefix="SET" suffixOverrides=",">
  111. <if test="gatewayOnline != null">gateway_online = #{gatewayOnline},</if>
  112. </trim>
  113. where gateway_mac = #{gatewayMac}
  114. </update>
  115. </mapper>