后台服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
4.1 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.WxDeviceMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxDevice">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
  9. <result column="version" jdbcType="VARCHAR" property="version"/>
  10. <result column="location" jdbcType="VARCHAR" property="location"/>
  11. <result column="name" jdbcType="VARCHAR" property="name"/>
  12. <result column="type" jdbcType="INTEGER" property="type"/>
  13. <result column="status" jdbcType="INTEGER" property="status"/>
  14. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  15. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  16. <result column="online_status" jdbcType="INTEGER" property="onlineStatus"/>
  17. <result column="first_hb_time" jdbcType="TIMESTAMP" property="firstHbTime"/>
  18. <result column="last_hb_time" jdbcType="TIMESTAMP" property="lastHbTime"/>
  19. <result column="hb_cmd" jdbcType="INTEGER" property="hbCmd"/>
  20. <result column="config" jdbcType="VARCHAR" property="config"/>
  21. </resultMap>
  22. <sql id="allColumns">
  23. `id`, `tenant_id`, `parent_tenant_id`,`device_id`, `type`, `status`, `location`, `name`, `version`, `create_date`, `update_date`, `online_status`, `first_hb_time`, `last_hb_time`, `hb_cmd`, `config`
  24. </sql>
  25. <sql id="dynamicWhereConditions">
  26. where 1 = 1
  27. <if test=" null != id ">
  28. and `id` = #{id}
  29. </if>
  30. <if test=" null != tenantId and '' != tenantId">
  31. and `tenant_id` = #{tenantId}
  32. </if>
  33. <if test=" null != parentTenantId and '' != parentTenantId">
  34. and `parent_tenant_id` = #{parentTenantId}
  35. </if>
  36. <if test=" null != deviceId ">
  37. and `device_id` = #{deviceId}
  38. </if>
  39. <if test=" null != version ">
  40. and `version` like concat('%', #{version},'%')
  41. </if>
  42. <if test=" null != location ">
  43. and `location` like concat('%', #{location},'%')
  44. </if>
  45. <if test=" null != name ">
  46. and `name` like concat('%', #{name},'%')
  47. </if>
  48. <if test=" null != type ">
  49. and `type` = #{type}
  50. </if>
  51. <if test=" null != status ">
  52. and `status` = #{status}
  53. </if>
  54. <if test=" null != createDate ">
  55. and `create_date` = #{createDate}
  56. </if>
  57. <if test=" null != updateDate ">
  58. and `update_date` = #{updateDate}
  59. </if>
  60. <if test=" null != onlineStatus ">
  61. and `online_status` = #{onlineStatus}
  62. </if>
  63. <if test=" null != firstHbTime ">
  64. and `first_hb_time` = #{firstHbTime}
  65. </if>
  66. <if test=" null != lastHbTime ">
  67. and `last_hb_time` = #{lastHbTime}
  68. </if>
  69. <if test=" null != hbCmd ">
  70. and `hb_cmd` = #{hbCmd}
  71. </if>
  72. <if test=" null != config ">
  73. and `config` = #{config}
  74. </if>
  75. <if test=" null != ids ">
  76. and id in
  77. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  78. #{idItem}
  79. </foreach>
  80. </if>
  81. <if test=" null != sortColumns">order by ${sortColumns}</if>
  82. </sql>
  83. <select id="findList" parameterType="com.iformall.domain.po.WxDevice" resultMap="BaseResultMap">
  84. select
  85. <include refid="allColumns"/>
  86. from wx_device
  87. <include refid="dynamicWhereConditions"/>
  88. </select>
  89. <update id="offlineScan" parameterType="java.util.Date">
  90. update wx_device set `online_status` = 0
  91. where `status` = 0
  92. and `online_status` = 1
  93. and `last_hb_time` &lt; #{expiredTime}
  94. </update>
  95. </mapper>