DeviceChargingMapper.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.xy.mapper.DeviceChargingMapper">
  4. <resultMap id="queryPageMap" type="com.xy.dto.DeviceChargingDto$PageVo">
  5. <association property="deviceInfo" javaType="com.xy.dto.DeviceInfoDto$Vo">
  6. <id column="device_id" property="deviceId"/>
  7. <result column="device_name" property="deviceName"/>
  8. <result column="lon" property="lon"/>
  9. <result column="lat" property="lat"/>
  10. <result column="device_type" property="deviceType"/>
  11. <result column="merc_device_code" property="mercDeviceCode"/>
  12. <result column="merc_id" property="mercId"/>
  13. <result column="merc_code" property="mercCode"/>
  14. <result column="place_id" property="placeId"/>
  15. <result column="place_line_id" property="placeLineId"/>
  16. <result column="district_id" property="districtId"/>
  17. <result column="active_state" property="activeState"/>
  18. <result column="active_time" property="activeTime"/>
  19. <result column="busy_state" property="busyState"/>
  20. <result column="show_status" property="showStatus"/>
  21. <result column="freeze_status" property="freezeStatus"/>
  22. <result column="device_img" property="deviceImg"/>
  23. <result column="update_time" property="updateTime"/>
  24. <result column="merc_name" property="mercName"/>
  25. <result column="create_time" property="createTime"/>
  26. <association property="deviceStatus" javaType="com.xy.dto.DeviceStatusDto$Vo">
  27. <result column="net_state" property="netState"/>
  28. </association>
  29. </association>
  30. <association property="deviceCharging" javaType="com.xy.dto.DeviceChargingDto$Vo">
  31. <result column="charging_sum_money" property="chargingSumMoney" />
  32. <result column="charging_x" property="chargingX" />
  33. <result column="timeout" property="timeout" />
  34. <result column="last_charging_time" property="lastChargingTime" />
  35. <result column="charging_create_time" property="createTime" />
  36. </association>
  37. </resultMap>
  38. <select id="page" resultMap="queryPageMap">
  39. select di.*,
  40. ds.net_state,
  41. dc.charging_sum_money, dc.charging_x, dc.timeout, dc.last_charging_time, dc.create_time as charging_create_time
  42. from device_info di
  43. join device_status ds on (di.device_id = ds.device_id)
  44. join device_charging dc on(di.device_id = dc.device_id)
  45. where
  46. 1 = 1
  47. <if test="queryPage.mercId != null">
  48. and di.merc_id = #{queryPage.mercId}
  49. </if>
  50. <if test="queryPage.deviceId != null">
  51. and di.device_id = #{queryPage.deviceId}
  52. </if>
  53. <if test="queryPage.chargingStatus != null and queryPage.chargingStatus != ''">
  54. <!-- 即将过期 -->
  55. <if test="queryPage.chargingStatus == 1">
  56. and dc.timeout >= #{queryPage.thisTime} and dc.timeout &lt;= #{queryPage.theTime}
  57. </if>
  58. <!-- 已过期 -->
  59. <if test="queryPage.chargingStatus == 2">
  60. and dc.timeout &lt;= #{queryPage.thisTime}
  61. </if>
  62. </if>
  63. order by dc.timeout asc
  64. </select>
  65. </mapper>