SolarDevMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.SolarDevDao">
  4. <select id="getSolarListByDTO" resultType="SolarDevDTO">
  5. select
  6. <choose>
  7. <when test="version == 0">
  8. gl.chinese_name as area,
  9. </when>
  10. <when test="version == 1">
  11. gl.english_name as area,
  12. </when>
  13. <otherwise>
  14. gl.ru_name as area,
  15. </otherwise>
  16. </choose>
  17. s.id,s.lamp_pole_id lampPoleId,s.number,s.netStatus,s.lighteness as lightness,s.lampvoltage as lampVoltage,
  18. s.lampcurrent as lampCurrent,s.lamppower as lampPower,s.solar_voltage solarVoltage,s.solar_current solarCurrent,
  19. s.solar_power solarPower,s.battery_voltage batteryVoltage,s.battery_current batteryCurrent,s.battery_power batteryPower,
  20. s.totalLightTime,s.address,s.logtime as logTime,s1.name as section,s1.timezone,lp.name as lampPoleName
  21. from solar_dev s
  22. left join section s1 on s.sectionid = s1.id
  23. left join global_location gl on s1.pid = gl.id
  24. left join lamp_pole lp on lp.id = s.lamp_pole_id
  25. where 1=1
  26. <if test="keyword != null and keyword != ''">
  27. and s.number like '%${keyword}%'
  28. </if>
  29. <if test="sectionList != null and !sectionList.isEmpty()">
  30. and s.sectionid in
  31. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  32. #{dto}
  33. </foreach>
  34. </if>
  35. <choose>
  36. <when test="online == 0">
  37. and s.netStatus = 0
  38. </when>
  39. <when test="online == 1">
  40. and s.netStatus = 1
  41. </when>
  42. </choose>
  43. order by s.id desc
  44. <if test="page >= 0 and count > 0">
  45. limit #{page},#{count}
  46. </if>
  47. </select>
  48. <select id="getSolarDevTotalByDTO" resultType="Integer">
  49. select count(s.id)
  50. from solar_dev s
  51. <if test="sectionList != null and !sectionList.isEmpty()">
  52. where s.sectionid in
  53. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  54. #{dto}
  55. </foreach>
  56. </if>
  57. </select>
  58. <select id="getSolarDevOnlineTotalByDTO" resultType="Integer">
  59. select count(s.id)
  60. from solar_dev s
  61. where s.netStatus = 1
  62. <if test="sectionList != null and !sectionList.isEmpty()">
  63. and s.sectionid in
  64. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  65. #{dto}
  66. </foreach>
  67. </if>
  68. </select>
  69. <select id="getSolarDevLightTotalByDTO" resultType="Integer">
  70. select count(s.id)
  71. from solar_dev s
  72. where s.netStatus = 1 and s.lighteness > 0
  73. <if test="sectionList != null and !sectionList.isEmpty()">
  74. and s.sectionid in
  75. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  76. #{dto}
  77. </foreach>
  78. </if>
  79. </select>
  80. <select id="getSolarDevDayElectricTotalByDTO" resultType="SolarDevDTO">
  81. select s.id,s.dayconsumption as dayConsumption
  82. from solar_dev s
  83. <if test="sectionList != null and !sectionList.isEmpty()">
  84. where s.sectionid in
  85. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  86. #{dto}
  87. </foreach>
  88. </if>
  89. </select>
  90. <select id="getSolarDevSumElectricTotalByDTO" resultType="SolarDevDTO">
  91. select s.id,s.totalconsumption as totalConsumption
  92. from solar_dev s
  93. <if test="sectionList != null and !sectionList.isEmpty()">
  94. where s.sectionid in
  95. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  96. #{dto}
  97. </foreach>
  98. </if>
  99. </select>
  100. <update id="updateSolarDevData" parameterType="SolarDevDTO">
  101. update
  102. solar_dev s
  103. set
  104. s.number = #{number},
  105. s.address = #{address},
  106. s.type = #{type},
  107. s.serial_port = #{serialPort},
  108. s.name = #{name}
  109. where
  110. s.id = #{id}
  111. </update>
  112. </mapper>