TwinCalcHourMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.ruoyi.biz.mapper.TwinCalcHourMapper">
  6. <resultMap type="TwinCalcHour" id="TwinCalcHourResult">
  7. <result property="id" column="ID"/>
  8. <result property="dataDate" column="DATA_DATE"/>
  9. <result property="hour" column="HOUR"/>
  10. <result property="time" column="TIME"/>
  11. <result property="deviceId" column="DEVICE_ID"/>
  12. <result property="kwh" column="KWH"/>
  13. <result property="weight" column="WEIGHT"/>
  14. <result property="length" column="LENGTH"/>
  15. <result property="openTime" column="OPEN_TIME"/>
  16. <result property="closeTime" column="CLOSE_TIME"/>
  17. <result property="createdBy" column="CREATED_BY"/>
  18. <result property="createdTime" column="CREATED_TIME"/>
  19. <result property="updatedBy" column="UPDATED_BY"/>
  20. <result property="updatedTime" column="UPDATED_TIME"/>
  21. <result property="remark" column="REMARK"/>
  22. </resultMap>
  23. <sql id="selectTwinCalcHourVo">
  24. select ID,
  25. DATA_DATE, HOUR, DEVICE_ID, KWH, WEIGHT, LENGTH, OPEN_TIME, CLOSE_TIME, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK
  26. from twin_calc_hour
  27. </sql>
  28. <select id="selectTwinCalcHourList" parameterType="TwinCalcHour" resultMap="TwinCalcHourResult">
  29. <include refid="selectTwinCalcHourVo"/>
  30. <where>
  31. <if test="dataDate != null ">and DATA_DATE = #{dataDate}</if>
  32. <if test="hour != null">and HOUR = #{hour}</if>
  33. <if test="deviceId != null ">and DEVICE_ID = #{deviceId}</if>
  34. <if test="kwh != null ">and KWH = #{kwh}</if>
  35. <if test="weight != null ">and WEIGHT = #{weight}</if>
  36. <if test="length != null ">and LENGTH = #{length}</if>
  37. <if test="openTime != null ">and OPEN_TIME = #{openTime}</if>
  38. <if test="closeTime != null ">and CLOSE_TIME = #{closeTime}</if>
  39. <if test="createdBy != null and createdBy != ''">and CREATED_BY = #{createdBy}</if>
  40. <if test="createdTime != null ">and CREATED_TIME = #{createdTime}</if>
  41. <if test="updatedBy != null and updatedBy != ''">and UPDATED_BY = #{updatedBy}</if>
  42. <if test="updatedTime != null ">and UPDATED_TIME = #{updatedTime}</if>
  43. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  44. <if test="params.sTime != null and params.eTime != null">
  45. and DATE_ADD(data_date, INTERVAL `HOUR` HOUR) between #{params.sTime} and #{params.eTime}
  46. </if>
  47. </where>
  48. </select>
  49. <select id="selectTwinCalcHourById" parameterType="Long" resultMap="TwinCalcHourResult">
  50. <include refid="selectTwinCalcHourVo"/>
  51. where ID = #{id}
  52. </select>
  53. <select id="lastHour" resultMap="TwinCalcHourResult">
  54. <include refid="selectTwinCalcHourVo"/>
  55. order by id desc limit 1
  56. </select>
  57. <insert id="insertTwinCalcHour" parameterType="TwinCalcHour" useGeneratedKeys="true" keyProperty="id">
  58. insert into twin_calc_hour
  59. <trim prefix="(" suffix=")" suffixOverrides=",">
  60. <if test="dataDate != null">DATA_DATE,</if>
  61. <if test="hour != null">HOUR,</if>
  62. <if test="deviceId != null">DEVICE_ID,</if>
  63. <if test="kwh != null">KWH,</if>
  64. <if test="weight != null">WEIGHT,</if>
  65. <if test="length != null">LENGTH,</if>
  66. <if test="openTime != null">OPEN_TIME,</if>
  67. <if test="closeTime != null">CLOSE_TIME,</if>
  68. <if test="createdBy != null">CREATED_BY,</if>
  69. <if test="createdTime != null">CREATED_TIME,</if>
  70. <if test="updatedBy != null">UPDATED_BY,</if>
  71. <if test="updatedTime != null">UPDATED_TIME,</if>
  72. <if test="remark != null">REMARK,</if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides=",">
  75. <if test="dataDate != null">#{dataDate},</if>
  76. <if test="hour != null">#{hour},</if>
  77. <if test="deviceId != null">#{deviceId},</if>
  78. <if test="kwh != null">#{kwh},</if>
  79. <if test="weight != null">#{weight},</if>
  80. <if test="length != null">#{length},</if>
  81. <if test="openTime != null">#{openTime},</if>
  82. <if test="closeTime != null">#{closeTime},</if>
  83. <if test="createdBy != null">#{createdBy},</if>
  84. <if test="createdTime != null">#{createdTime},</if>
  85. <if test="updatedBy != null">#{updatedBy},</if>
  86. <if test="updatedTime != null">#{updatedTime},</if>
  87. <if test="remark != null">#{remark},</if>
  88. </trim>
  89. </insert>
  90. <update id="updateTwinCalcHour" parameterType="TwinCalcHour">
  91. update twin_calc_hour
  92. <trim prefix="SET" suffixOverrides=",">
  93. <if test="dataDate != null">DATA_DATE = #{dataDate},</if>
  94. <if test="hour != null">HOUR = #{hour},</if>
  95. <if test="deviceId != null">DEVICE_ID = #{deviceId},</if>
  96. <if test="kwh != null">KWH = #{kwh},</if>
  97. <if test="weight != null">WEIGHT = #{weight},</if>
  98. <if test="length != null">LENGTH = #{length},</if>
  99. <if test="openTime != null">OPEN_TIME = #{openTime},</if>
  100. <if test="closeTime != null">CLOSE_TIME = #{closeTime},</if>
  101. <if test="createdBy != null">CREATED_BY = #{createdBy},</if>
  102. <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
  103. <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
  104. <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
  105. <if test="remark != null">REMARK = #{remark},</if>
  106. </trim>
  107. where ID = #{id}
  108. </update>
  109. <delete id="deleteTwinCalcHourById" parameterType="Long">
  110. delete
  111. from twin_calc_hour
  112. where ID = #{id}
  113. </delete>
  114. <delete id="deleteTwinCalcHourByIds" parameterType="String">
  115. delete from twin_calc_hour where ID in
  116. <foreach item="id" collection="array" open="(" separator="," close=")">
  117. #{id}
  118. </foreach>
  119. </delete>
  120. </mapper>