ChargeInfoLogMapper.xml 2.3 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.welampiot.dao.ChargeInfoLogDao">
  4. <!-- 当天的数据 -->
  5. <select id="getTodayChargeDataByLampPoleId" resultType="ChargeInfoLogDTO">
  6. SELECT
  7. c.free,
  8. c.connectorNum,
  9. c.equipmentElectricity
  10. FROM charge_info_log c
  11. LEFT JOIN charge c1
  12. ON c.chargeId = c1.id
  13. WHERE c1.lamp_pole_id = #{lampPoleId}
  14. AND DATE(c.updatetime) = DATE(NOW())
  15. </select>
  16. <!-- 当月和具体月份 -->
  17. <select id="getMonthChargeListByDTO" resultType="ChargeInfoLogDTO">
  18. SELECT
  19. c.free,
  20. c.connectorNum,
  21. c.equipmentElectricity,
  22. c.updatetime AS updateTime
  23. FROM charge_info_log c
  24. LEFT JOIN charge c1
  25. ON c.chargeId = c1.id
  26. WHERE c1.lamp_pole_id = #{lampPoleId}
  27. AND DATE(c.updatetime) <![CDATA[ >= ]]> #{startDate}
  28. AND DATE(c.updatetime) <![CDATA[ <= ]]> #{endDate}
  29. ORDER BY c.updatetime DESC
  30. </select>
  31. <!-- 当年和全部的统计图数据 -->
  32. <select id="getAllChargeDataByDTO" resultType="ChargeInfoLogDTO">
  33. SELECT
  34. c.free,
  35. c.connectorNum,
  36. c.equipmentElectricity,
  37. c.updatetime AS updateTime
  38. FROM charge_info_log c
  39. LEFT JOIN charge c1
  40. ON c.chargeId = c1.id
  41. WHERE c1.lamp_pole_id = #{lampPoleId}
  42. AND c.updatetime <![CDATA[ >= ]]> #{startDate}
  43. AND c.updatetime <![CDATA[ <= ]]> #{endDate}
  44. GROUP BY MONTH(c.updatetime)
  45. ORDER BY c.updatetime DESC
  46. </select>
  47. <!-- 当年和全部的列表数据 -->
  48. <select id="getAllChargeListByDTO" resultType="ChargeInfoLogDTO">
  49. SELECT
  50. c.free,
  51. c.connectorNum,
  52. c.equipmentElectricity,
  53. c.updatetime AS updateTime
  54. FROM charge_info_log c
  55. LEFT JOIN charge c1
  56. ON c.chargeId = c1.id
  57. WHERE c1.lamp_pole_id = #{lampPoleId}
  58. AND c.updatetime <![CDATA[ >= ]]> #{startDate}
  59. AND c.updatetime <![CDATA[ <= ]]> #{endDate}
  60. ORDER BY c.updatetime DESC
  61. </select>
  62. </mapper>