TwinCalcHourRzMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.rz.mapper.TwinCalcHourRzMapper">
  6. <resultMap type="TwinCalcHourRz" id="TwinCalcHourRzResult">
  7. <result property="id" column="ID"/>
  8. <result property="dataDate" column="DATA_DATE"/>
  9. <result property="hour" column="HOUR"/>
  10. <result property="dataTime" column="DATA_TIME"/>
  11. <result property="deviceId" column="DEVICE_ID"/>
  12. <result property="data" column="DATA"/>
  13. <result property="online" column="ONLINE"/>
  14. <result property="createdBy" column="CREATED_BY"/>
  15. <result property="createdTime" column="CREATED_TIME"/>
  16. <result property="updatedBy" column="UPDATED_BY"/>
  17. <result property="updatedTime" column="UPDATED_TIME"/>
  18. <result property="remark" column="REMARK"/>
  19. <result property="line" column="LINE"/>
  20. <result property="deviceName" column="DEVICE_NAME"/>
  21. <result property="wsName" column="WS_NAME"/>
  22. <result property="typeId" column="TYPE_ID"/>
  23. </resultMap>
  24. <sql id="selectTwinCalcHourRzVo">
  25. select *
  26. from (select a.ID,
  27. a.DATA_DATE,
  28. a.HOUR,
  29. a.DATA_TIME,
  30. a.DEVICE_ID,
  31. a.DATA,
  32. a.ONLINE,
  33. a.CREATED_BY,
  34. a.CREATED_TIME,
  35. a.UPDATED_BY,
  36. a.UPDATED_TIME,
  37. a.REMARK,
  38. b.DEVICE_NAME,
  39. b.line,
  40. b.WS_NAME,
  41. b.TYPE_ID
  42. from TWIN_CALC_HOUR_RZ a,
  43. TWIN_DEVICE_RZ b
  44. where a.device_id = b.device_id) a
  45. </sql>
  46. <select id="selectTwinCalcHourRzList" parameterType="TwinCalcHourRz" resultMap="TwinCalcHourRzResult">
  47. <include refid="selectTwinCalcHourRzVo"/>
  48. <where>
  49. <if test="dataDate != null ">and DATA_DATE = #{dataDate}</if>
  50. <if test="hour != null ">and HOUR = #{hour}</if>
  51. <if test="dataTime != null ">and DATA_TIME = #{dataTime}</if>
  52. <if test="deviceId != null ">and DEVICE_ID = #{deviceId}</if>
  53. <if test="data != null and data != ''">and DATA = #{data}</if>
  54. <if test="online != null ">and ONLINE = #{online}</if>
  55. <if test="createdBy != null and createdBy != ''">and CREATED_BY = #{createdBy}</if>
  56. <if test="createdTime != null ">and CREATED_TIME = #{createdTime}</if>
  57. <if test="updatedBy != null and updatedBy != ''">and UPDATED_BY = #{updatedBy}</if>
  58. <if test="updatedTime != null ">and UPDATED_TIME = #{updatedTime}</if>
  59. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  60. <if test="line != null">and line = #{line}</if>
  61. </where>
  62. </select>
  63. <select id="selectTwinCalcHourRzById" parameterType="Long" resultMap="TwinCalcHourRzResult">
  64. <include refid="selectTwinCalcHourRzVo"/>
  65. where ID = #{id}
  66. </select>
  67. <select id="lastRecord" resultType="com.jjt.rz.domain.TwinCalcHourRz">
  68. select top 1 *
  69. from TWIN_CALC_HOUR_RZ
  70. order by id desc
  71. </select>
  72. <insert id="insertTwinCalcHourRz" parameterType="TwinCalcHourRz">
  73. insert into TWIN_CALC_HOUR_RZ
  74. <trim prefix="(" suffix=")" suffixOverrides=",">
  75. <if test="dataDate != null">DATA_DATE,</if>
  76. <if test="hour != null">HOUR,</if>
  77. <if test="dataTime != null">DATA_TIME,</if>
  78. <if test="deviceId != null">DEVICE_ID,</if>
  79. <if test="data != null">DATA,</if>
  80. <if test="online != null">ONLINE,</if>
  81. <if test="createdBy != null">CREATED_BY,</if>
  82. <if test="createdTime != null">CREATED_TIME,</if>
  83. <if test="updatedBy != null">UPDATED_BY,</if>
  84. <if test="updatedTime != null">UPDATED_TIME,</if>
  85. <if test="remark != null">REMARK,</if>
  86. </trim>
  87. <trim prefix="values (" suffix=")" suffixOverrides=",">
  88. <if test="dataDate != null">#{dataDate},</if>
  89. <if test="hour != null">#{hour},</if>
  90. <if test="dataTime != null">#{dataTime},</if>
  91. <if test="deviceId != null">#{deviceId},</if>
  92. <if test="data != null">#{data},</if>
  93. <if test="online != null">#{online},</if>
  94. <if test="createdBy != null">#{createdBy},</if>
  95. <if test="createdTime != null">#{createdTime},</if>
  96. <if test="updatedBy != null">#{updatedBy},</if>
  97. <if test="updatedTime != null">#{updatedTime},</if>
  98. <if test="remark != null">#{remark},</if>
  99. </trim>
  100. </insert>
  101. <update id="updateTwinCalcHourRz" parameterType="TwinCalcHourRz">
  102. update TWIN_CALC_HOUR_RZ
  103. <trim prefix="SET" suffixOverrides=",">
  104. <if test="dataDate != null">DATA_DATE = #{dataDate},</if>
  105. <if test="hour != null">HOUR = #{hour},</if>
  106. <if test="dataTime != null">DATA_TIME = #{dataTime},</if>
  107. <if test="deviceId != null">DEVICE_ID = #{deviceId},</if>
  108. <if test="data != null">DATA = #{data},</if>
  109. <if test="online != null">ONLINE = #{online},</if>
  110. <if test="createdBy != null">CREATED_BY = #{createdBy},</if>
  111. <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
  112. <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
  113. <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
  114. <if test="remark != null">REMARK = #{remark},</if>
  115. </trim>
  116. where ID = #{id}
  117. </update>
  118. <delete id="deleteTwinCalcHourRzById" parameterType="Long">
  119. delete
  120. from TWIN_CALC_HOUR_RZ
  121. where ID = #{id}
  122. </delete>
  123. <delete id="deleteTwinCalcHourRzByIds" parameterType="String">
  124. delete from TWIN_CALC_HOUR_RZ where ID in
  125. <foreach item="id" collection="array" open="(" separator="," close=")">
  126. #{id}
  127. </foreach>
  128. </delete>
  129. <delete id="deleteTwinCalcHourRz">
  130. delete
  131. from TWIN_CALC_HOUR_RZ
  132. where DATA_DATE = #{date}
  133. and HOUR = #{hour}
  134. </delete>
  135. </mapper>