UbiInfoStateMapper.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.zy.bms.mapper.ubi.UbiInfoStateMapper">
  4. <update id="updateStatus">
  5. UPDATE
  6. ubi_info_state
  7. SET status = 0
  8. WHERE
  9. TIMESTAMPDIFF(SECOND, update_time, NOW()) > (freq + 120)
  10. </update>
  11. <select id="listPage" resultType="com.zy.bms.pojo.vo.UbiDeviceListVo">
  12. SELECT
  13. t1.open_num,
  14. t1.username,
  15. t1.password,
  16. t1.sn,
  17. t1.create_time,
  18. t1.group_id,
  19. t2.*
  20. FROM
  21. device_base t1
  22. LEFT JOIN
  23. ubi_info_state t2 ON t1.open_num = t2.open_num
  24. WHERE
  25. t1.type = "gnss"
  26. <if test="io.openNum != null and io.openNum != ''">
  27. AND t1.open_num LIKE CONCAT('%',#{io.openNum},'%')
  28. </if>
  29. <if test="io.groupId != null and io.groupId > -1">
  30. AND t1.group_id = #{io.groupId}
  31. </if>
  32. <if test="io.status != null and io.status > -1">
  33. AND t2.status = #{io.status}
  34. </if>
  35. </select>
  36. <select id="getDetail" resultType="com.zy.bms.pojo.vo.UbiDeviceDetailVo">
  37. SELECT t1.open_num,
  38. t2.*
  39. FROM
  40. device_base t1
  41. LEFT JOIN
  42. ubi_info_state t2 ON t1.open_num = t2.open_num
  43. WHERE
  44. t1.type = "gnss" AND t1.open_num = #{openNum}
  45. </select>
  46. <select id="listByGroupIdWx" resultType="com.zy.bms.pojo.vo.UbiDeviceListVo">
  47. SELECT
  48. t1.open_num,
  49. t2.freq,
  50. t2.update_time
  51. FROM
  52. device_base t1
  53. LEFT JOIN
  54. ubi_info_state t2 ON t1.open_num = t2.open_num
  55. WHERE
  56. t1.type = "gnss" AND t1.group_id = #{group}
  57. </select>
  58. </mapper>