IotSensorMapper.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.xunmei.iot.mapper.IotCommonSensorMapper">
  4. <select id="selectPageData" resultType="com.xunmei.iot.vo.sensor.SensorPageVo">
  5. select s.id, org_id, org_name, device_name, device_type, infos as info,device_code, update_time,state
  6. from iot_sensor s
  7. where s.deleted=0
  8. <if test="request.orgId!= null">
  9. and s.org_id=#{request.orgId}
  10. </if>
  11. <if test="request.orgPath!= null">
  12. and s.org_path like CONCAT(#{request.orgPath}, '%')
  13. </if>
  14. <if test="request.deviceName != null and request.deviceName!= ''">
  15. and s.device_name like CONCAT('%',#{request.deviceName},'%')
  16. </if>
  17. <if test="request.state!= null">
  18. and s.state = #{request.state}
  19. </if>
  20. <if test="request.deviceType!= null">
  21. and s.device_type = #{request.deviceType}
  22. </if>
  23. <if test="request.startTime!= null">
  24. and s.state_update_time >=#{request.startTime}
  25. </if>
  26. <if test="request.endTime!= null">
  27. and s.state_update_time <![CDATA[<=]]> #{request.endTime}
  28. </if>
  29. </select>
  30. <select id="selectSensorLogDataPage" resultType="com.xunmei.iot.vo.sensor.SensorPageVo">
  31. select s.id, org_id, org_name, device_name, category_id, infos as info,device_code, update_time from
  32. iot_sensor_log s
  33. <where>
  34. <if test="request.orgId!= null">
  35. and s.org_id=#{request.orgId}
  36. </if>
  37. <if test="request.orgPath!= null">
  38. and s.org_path like CONCAT(#{request.orgPath}, '%')
  39. </if>
  40. <if test="request.deviceName != null and request.deviceName!= ''">
  41. and s.device_name like CONCAT('%',#{request.deviceName},'%')
  42. </if>
  43. <if test="request.deviceCode != null and request.deviceCode!= ''">
  44. and s.device_code =#{request.deviceCode}
  45. </if>
  46. <if test="request.startTime!= null">
  47. and s.state_update_time >=#{request.startTime}
  48. </if>
  49. <if test="request.endTime!= null">
  50. and s.state_update_time <![CDATA[<=]]> #{request.endTime}
  51. </if>
  52. </where>
  53. order by s.state_update_time desc
  54. </select>
  55. <select id="selectByIds" resultType="com.xunmei.common.core.domain.iot.domain.IotSensor">
  56. SELECT
  57. org_id,
  58. CONCAT(b.affiliated_area,'-',b.affiliated_bank,'-',b.short_name) as org_name,
  59. device_name,
  60. infos AS info,
  61. device_code
  62. FROM
  63. iot_sensor a
  64. LEFT JOIN sys_org b ON a.org_id = b.id
  65. where device_code in
  66. <foreach collection="deviceIds" index="index" item="item" open="(" separator="," close=")">
  67. #{item}
  68. </foreach>
  69. </select>
  70. </mapper>