Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

96 wiersze
3.3 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.iformall.mapper.KwBoxMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.KwBox">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="imei" jdbcType="BIGINT" property="imei"/>
  8. <result column="iccid" jdbcType="VARCHAR" property="iccid"/>
  9. <result column="place" jdbcType="VARCHAR" property="place"/>
  10. <result column="fw_version" jdbcType="VARCHAR" property="fwVersion"/>
  11. <result column="hd_version" jdbcType="VARCHAR" property="hdVersion"/>
  12. <result column="register_status" jdbcType="INTEGER" property="registerStatus"/>
  13. <result column="online_status" jdbcType="INTEGER" property="onlineStatus"/>
  14. <result column="register_time" jdbcType="TIMESTAMP" property="registerTime"/>
  15. <result column="last_online_time" jdbcType="TIMESTAMP" property="lastOnlineTime"/>
  16. <result column="config" jdbcType="VARCHAR" property="config"/>
  17. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  18. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  19. <result column="com_key" jdbcType="VARCHAR" property="comKey"/>
  20. <result column="status" jdbcType="INTEGER" property="status"/>
  21. <result column="max_tag_num" jdbcType="INTEGER" property="maxTagNum"/>
  22. <result column="meterCount" jdbcType="INTEGER" property="meterCount"/>
  23. </resultMap>
  24. <sql id="allColumns">
  25. `id`,`tenant_id`,`imei`,`iccid`,`place`,`fw_version`,`hd_version`,`register_status`,`online_status`,`register_time`,
  26. `last_online_time`,`config`,`create_time`,`update_time`,`com_key`,`status`,`max_tag_num`
  27. </sql>
  28. <sql id="dynamicWhereConditions">
  29. where 1 = 1
  30. <if test=" null != id ">
  31. and `id` = #{id}
  32. </if>
  33. <if test=" null != tenantId ">
  34. and `tenant_id` = #{tenantId}
  35. </if>
  36. <if test=" null != imei ">
  37. and `imei` like concat('%', #{imei},'%')
  38. </if>
  39. <if test=" null != iccid ">
  40. and `iccid` = #{iccid}
  41. </if>
  42. <if test=" null != place and '' != place ">
  43. and `place` like concat('%', #{place},'%')
  44. </if>
  45. <if test=" null != registerStatus ">
  46. and `register_status` = #{registerStatus}
  47. </if>
  48. <if test=" null != onlineStatus ">
  49. and `online_status` = #{onlineStatus}
  50. </if>
  51. <if test=" null != status ">
  52. and `status` = #{status}
  53. </if>
  54. <if test=" null != ids ">
  55. and id in
  56. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  57. #{idItem}
  58. </foreach>
  59. </if>
  60. <if test=" null != sortColumns">order by ${sortColumns}</if>
  61. </sql>
  62. <select id="findList" parameterType="com.iformall.domain.po.KwBox" resultMap="BaseResultMap">
  63. select
  64. <include refid="allColumns"/>
  65. ,IFNULL(mc,0) as meterCount
  66. from kw_box left join (
  67. select box_id, count(box_id) as mc from kw_meter
  68. where `status` = 0
  69. and `bind_status` = 0
  70. group by box_id
  71. ) meter on meter.box_id = id
  72. <include refid="dynamicWhereConditions"/>
  73. </select>
  74. <update id="offlineScan" parameterType="java.util.Date">
  75. update kw_box set `online_status` = 0
  76. where `status` = 0
  77. and `online_status` = 1
  78. and `last_online_time` &lt; #{expiredTime}
  79. </update>
  80. </mapper>