TwinCalcDayMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.jjt.calc.mapper.TwinCalcDayMapper">
  6. <resultMap type="TwinCalcDay" id="TwinCalcDayResult">
  7. <result property="id" column="ID"/>
  8. <result property="time" column="TIME"/>
  9. <result property="deviceId" column="DEVICE_ID"/>
  10. <result property="length" column="LENGTH"/>
  11. <result property="weight" column="WEIGHT"/>
  12. <result property="efficiency" column="EFFICIENCY"/>
  13. <result property="kwh" column="KWH"/>
  14. <result property="alarm" column="ALARM"/>
  15. <result property="lengthA" column="LENGTH_A"/>
  16. <result property="weightA" column="WEIGHT_A"/>
  17. <result property="efficiencyA" column="EFFICIENCY_A"/>
  18. <result property="openTimeA" column="OPEN_TIME_A"/>
  19. <result property="closeTimeA" column="CLOSE_TIME_A"/>
  20. <result property="kwhA" column="KWH_A"/>
  21. <result property="stop1A" column="STOP1_A"/>
  22. <result property="stop2A" column="STOP2_A"/>
  23. <result property="stop3A" column="STOP3_A"/>
  24. <result property="lengthB" column="LENGTH_B"/>
  25. <result property="weightB" column="WEIGHT_B"/>
  26. <result property="efficiencyB" column="EFFICIENCY_B"/>
  27. <result property="openTimeB" column="OPEN_TIME_B"/>
  28. <result property="closeTimeB" column="CLOSE_TIME_B"/>
  29. <result property="kwhB" column="KWH_B"/>
  30. <result property="stop1B" column="STOP1_B"/>
  31. <result property="stop2B" column="STOP2_B"/>
  32. <result property="stop3B" column="STOP3_B"/>
  33. <result property="createdBy" column="CREATED_BY"/>
  34. <result property="createdTime" column="CREATED_TIME"/>
  35. <result property="updatedBy" column="UPDATED_BY"/>
  36. <result property="updatedTime" column="UPDATED_TIME"/>
  37. <result property="remark" column="REMARK"/>
  38. </resultMap>
  39. <sql id="selectTwinCalcDayVo">
  40. select *
  41. from (select A.ID,
  42. A.TIME,
  43. A.DEVICE_ID,
  44. A.LENGTH,
  45. A.WEIGHT,
  46. A.EFFICIENCY,
  47. A.KWH,
  48. A.ALARM,
  49. A.LENGTH_A,
  50. A.WEIGHT_A,
  51. A.EFFICIENCY_A,
  52. A.OPEN_TIME_A,
  53. A.CLOSE_TIME_A,
  54. A.KWH_A,
  55. A.STOP1_A,
  56. A.STOP2_A,
  57. A.STOP3_A,
  58. A.LENGTH_B,
  59. A.WEIGHT_B,
  60. A.EFFICIENCY_B,
  61. A.OPEN_TIME_B,
  62. A.CLOSE_TIME_B,
  63. A.KWH_B,
  64. A.STOP1_B,
  65. A.STOP2_B,
  66. A.STOP3_B,
  67. A.CREATED_BY,
  68. A.CREATED_TIME,
  69. A.UPDATED_BY,
  70. A.UPDATED_TIME,
  71. B.device_name REMARK
  72. from twin_calc_day a,
  73. twin_device b
  74. where a.device_id = b.device_id) a
  75. </sql>
  76. <select id="selectTwinCalcDayList" parameterType="TwinCalcDay" resultMap="TwinCalcDayResult">
  77. <include refid="selectTwinCalcDayVo"/>
  78. <where>
  79. <if test="time != null ">and TIME = #{time}</if>
  80. <if test="deviceId != null ">and DEVICE_ID = #{deviceId}</if>
  81. <if test="length != null ">and LENGTH = #{length}</if>
  82. <if test="weight != null ">and WEIGHT = #{weight}</if>
  83. <if test="efficiency != null ">and EFFICIENCY = #{efficiency}</if>
  84. <if test="kwh != null ">and KWH = #{kwh}</if>
  85. <if test="alarm != null ">and ALARM = #{alarm}</if>
  86. <if test="lengthA != null ">and LENGTH_A = #{lengthA}</if>
  87. <if test="weightA != null ">and WEIGHT_A = #{weightA}</if>
  88. <if test="efficiencyA != null ">and EFFICIENCY_A = #{efficiencyA}</if>
  89. <if test="openTimeA != null ">and OPEN_TIME_A = #{openTimeA}</if>
  90. <if test="closeTimeA != null ">and CLOSE_TIME_A = #{closeTimeA}</if>
  91. <if test="kwhA != null ">and KWH_A = #{kwhA}</if>
  92. <if test="stop1A != null ">and STOP1_A = #{stop1A}</if>
  93. <if test="stop2A != null ">and STOP2_A = #{stop2A}</if>
  94. <if test="stop3A != null ">and STOP3_A = #{stop3A}</if>
  95. <if test="lengthB != null ">and LENGTH_B = #{lengthB}</if>
  96. <if test="weightB != null ">and WEIGHT_B = #{weightB}</if>
  97. <if test="efficiencyB != null ">and EFFICIENCY_B = #{efficiencyB}</if>
  98. <if test="openTimeB != null ">and OPEN_TIME_B = #{openTimeB}</if>
  99. <if test="closeTimeB != null ">and CLOSE_TIME_B = #{closeTimeB}</if>
  100. <if test="kwhB != null ">and KWH_B = #{kwhB}</if>
  101. <if test="stop1B != null ">and STOP1_B = #{stop1B}</if>
  102. <if test="stop2B != null ">and STOP2_B = #{stop2B}</if>
  103. <if test="stop3B != null ">and STOP3_B = #{stop3B}</if>
  104. <if test="createdBy != null and createdBy != ''">and CREATED_BY = #{createdBy}</if>
  105. <if test="createdTime != null ">and CREATED_TIME = #{createdTime}</if>
  106. <if test="updatedBy != null and updatedBy != ''">and UPDATED_BY = #{updatedBy}</if>
  107. <if test="updatedTime != null ">and UPDATED_TIME = #{updatedTime}</if>
  108. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  109. </where>
  110. </select>
  111. <select id="selectTwinCalcDayById" parameterType="Long" resultMap="TwinCalcDayResult">
  112. <include refid="selectTwinCalcDayVo"/>
  113. where ID = #{id}
  114. </select>
  115. <insert id="insertTwinCalcDay" parameterType="TwinCalcDay">
  116. insert into TWIN_CALC_DAY
  117. <trim prefix="(" suffix=")" suffixOverrides=",">
  118. <if test="time != null">TIME,</if>
  119. <if test="deviceId != null">DEVICE_ID,</if>
  120. <if test="length != null">LENGTH,</if>
  121. <if test="weight != null">WEIGHT,</if>
  122. <if test="efficiency != null">EFFICIENCY,</if>
  123. <if test="kwh != null">KWH,</if>
  124. <if test="alarm != null">ALARM,</if>
  125. <if test="lengthA != null">LENGTH_A,</if>
  126. <if test="weightA != null">WEIGHT_A,</if>
  127. <if test="efficiencyA != null">EFFICIENCY_A,</if>
  128. <if test="openTimeA != null">OPEN_TIME_A,</if>
  129. <if test="closeTimeA != null">CLOSE_TIME_A,</if>
  130. <if test="kwhA != null">KWH_A,</if>
  131. <if test="stop1A != null">STOP1_A,</if>
  132. <if test="stop2A != null">STOP2_A,</if>
  133. <if test="stop3A != null">STOP3_A,</if>
  134. <if test="lengthB != null">LENGTH_B,</if>
  135. <if test="weightB != null">WEIGHT_B,</if>
  136. <if test="efficiencyB != null">EFFICIENCY_B,</if>
  137. <if test="openTimeB != null">OPEN_TIME_B,</if>
  138. <if test="closeTimeB != null">CLOSE_TIME_B,</if>
  139. <if test="kwhB != null">KWH_B,</if>
  140. <if test="stop1B != null">STOP1_B,</if>
  141. <if test="stop2B != null">STOP2_B,</if>
  142. <if test="stop3B != null">STOP3_B,</if>
  143. <if test="createdBy != null">CREATED_BY,</if>
  144. <if test="createdTime != null">CREATED_TIME,</if>
  145. <if test="updatedBy != null">UPDATED_BY,</if>
  146. <if test="updatedTime != null">UPDATED_TIME,</if>
  147. <if test="remark != null">REMARK,</if>
  148. </trim>
  149. <trim prefix="values (" suffix=")" suffixOverrides=",">
  150. <if test="time != null">#{time},</if>
  151. <if test="deviceId != null">#{deviceId},</if>
  152. <if test="length != null">#{length},</if>
  153. <if test="weight != null">#{weight},</if>
  154. <if test="efficiency != null">#{efficiency},</if>
  155. <if test="kwh != null">#{kwh},</if>
  156. <if test="alarm != null">#{alarm},</if>
  157. <if test="lengthA != null">#{lengthA},</if>
  158. <if test="weightA != null">#{weightA},</if>
  159. <if test="efficiencyA != null">#{efficiencyA},</if>
  160. <if test="openTimeA != null">#{openTimeA},</if>
  161. <if test="closeTimeA != null">#{closeTimeA},</if>
  162. <if test="kwhA != null">#{kwhA},</if>
  163. <if test="stop1A != null">#{stop1A},</if>
  164. <if test="stop2A != null">#{stop2A},</if>
  165. <if test="stop3A != null">#{stop3A},</if>
  166. <if test="lengthB != null">#{lengthB},</if>
  167. <if test="weightB != null">#{weightB},</if>
  168. <if test="efficiencyB != null">#{efficiencyB},</if>
  169. <if test="openTimeB != null">#{openTimeB},</if>
  170. <if test="closeTimeB != null">#{closeTimeB},</if>
  171. <if test="kwhB != null">#{kwhB},</if>
  172. <if test="stop1B != null">#{stop1B},</if>
  173. <if test="stop2B != null">#{stop2B},</if>
  174. <if test="stop3B != null">#{stop3B},</if>
  175. <if test="createdBy != null">#{createdBy},</if>
  176. <if test="createdTime != null">#{createdTime},</if>
  177. <if test="updatedBy != null">#{updatedBy},</if>
  178. <if test="updatedTime != null">#{updatedTime},</if>
  179. <if test="remark != null">#{remark},</if>
  180. </trim>
  181. </insert>
  182. <update id="updateTwinCalcDay" parameterType="TwinCalcDay">
  183. update TWIN_CALC_DAY
  184. <trim prefix="SET" suffixOverrides=",">
  185. <if test="time != null">TIME = #{time},</if>
  186. <if test="deviceId != null">DEVICE_ID = #{deviceId},</if>
  187. <if test="length != null">LENGTH = #{length},</if>
  188. <if test="weight != null">WEIGHT = #{weight},</if>
  189. <if test="efficiency != null">EFFICIENCY = #{efficiency},</if>
  190. <if test="kwh != null">KWH = #{kwh},</if>
  191. <if test="alarm != null">ALARM = #{alarm},</if>
  192. <if test="lengthA != null">LENGTH_A = #{lengthA},</if>
  193. <if test="weightA != null">WEIGHT_A = #{weightA},</if>
  194. <if test="efficiencyA != null">EFFICIENCY_A = #{efficiencyA},</if>
  195. <if test="openTimeA != null">OPEN_TIME_A = #{openTimeA},</if>
  196. <if test="closeTimeA != null">CLOSE_TIME_A = #{closeTimeA},</if>
  197. <if test="kwhA != null">KWH_A = #{kwhA},</if>
  198. <if test="stop1A != null">STOP1_A = #{stop1A},</if>
  199. <if test="stop2A != null">STOP2_A = #{stop2A},</if>
  200. <if test="stop3A != null">STOP3_A = #{stop3A},</if>
  201. <if test="lengthB != null">LENGTH_B = #{lengthB},</if>
  202. <if test="weightB != null">WEIGHT_B = #{weightB},</if>
  203. <if test="efficiencyB != null">EFFICIENCY_B = #{efficiencyB},</if>
  204. <if test="openTimeB != null">OPEN_TIME_B = #{openTimeB},</if>
  205. <if test="closeTimeB != null">CLOSE_TIME_B = #{closeTimeB},</if>
  206. <if test="kwhB != null">KWH_B = #{kwhB},</if>
  207. <if test="stop1B != null">STOP1_B = #{stop1B},</if>
  208. <if test="stop2B != null">STOP2_B = #{stop2B},</if>
  209. <if test="stop3B != null">STOP3_B = #{stop3B},</if>
  210. <if test="createdBy != null">CREATED_BY = #{createdBy},</if>
  211. <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
  212. <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
  213. <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
  214. <if test="remark != null">REMARK = #{remark},</if>
  215. </trim>
  216. where ID = #{id}
  217. </update>
  218. <delete id="deleteTwinCalcDayById" parameterType="Long">
  219. delete
  220. from TWIN_CALC_DAY
  221. where ID = #{id}
  222. </delete>
  223. <delete id="deleteTwinCalcDayByIds" parameterType="String">
  224. delete from TWIN_CALC_DAY where ID in
  225. <foreach item="id" collection="array" open="(" separator="," close=")">
  226. #{id}
  227. </foreach>
  228. </delete>
  229. <delete id="delete4date" parameterType="Date">
  230. DELETE
  231. FROM TWIN_CALC_DAY
  232. WHERE TIME = #{date}
  233. </delete>
  234. <select id="selectTwinCalcDayListByMonth" resultMap="TwinCalcDayResult">
  235. <include refid="selectTwinCalcDayVo"/>
  236. where FORMAT(time, 'yyyy-MM') = #{month}
  237. order by time
  238. </select>
  239. <select id="selectTwinCalcDayListByTime" resultMap="TwinCalcDayResult">
  240. <include refid="selectTwinCalcDayVo"/>
  241. where time>=#{sd}
  242. <if test="ed != null ">and time&lt;=#{ed}</if>
  243. order by time
  244. </select>
  245. </mapper>