RemoteOpcLogMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.platform.dao.mapper.remote.RemoteOpcLogMapper">
  4. <sql id="Base_Column_List">
  5. opc_log.id,
  6. opc_log.sb_id,
  7. opc_log.sb_name,
  8. opc_log.position_num,
  9. opc_log.type,
  10. opc_log.description,
  11. opc_log.result,
  12. opc_log.ratio,
  13. opc_log.unit,
  14. opc_log.remark,
  15. opc_log.year,
  16. opc_log.month,
  17. opc_log.day,
  18. opc_log.hour,
  19. opc_log.minute,
  20. opc_log.info,
  21. opc_log.created_user_id,
  22. opc_log.update_user_id,
  23. opc_log.created_time,
  24. opc_log.update_time
  25. </sql>
  26. <sql id="Ref_Column_List">
  27. opc_log.sb_id,
  28. opc_log.sb_name,
  29. opc_log.position_num,
  30. opc_log.type,
  31. opc_log.description,
  32. opc_log.result,
  33. opc_log.year,
  34. opc_log.month,
  35. opc_log.day,
  36. opc_log.hour,
  37. opc_log.minute,
  38. opc_log.info,
  39. opc_log.ratio,
  40. opc_log.unit,
  41. opc_log.remark,
  42. </sql>
  43. <sql id="List_Condition">
  44. <if test="id != null and id != ''">
  45. and opc_log.id = #{id}
  46. </if>
  47. <if test="sbId != null and sbId != ''">
  48. and opc_log.sb_id = #{sbId}
  49. </if>
  50. <if test="year != null">
  51. and opc_log.year = #{year}
  52. </if>
  53. <if test="month != null">
  54. and opc_log.month = #{month}
  55. </if>
  56. <if test="day != null">
  57. and opc_log.day = #{day}
  58. </if>
  59. <if test="hour != null">
  60. and opc_log.hour = #{hour}
  61. </if>
  62. <if test="minute != null">
  63. and opc_log.minute = #{minute}
  64. </if>
  65. <if test="positionNum != null">
  66. and opc_log.position_num = #{positionNum}
  67. </if>
  68. <if test="type != null">
  69. and opc_log.type = #{type}
  70. </if>
  71. <if test="description != null and description != ''">
  72. and opc_log.description = #{description}
  73. </if>
  74. <if test="result != null and result != ''">
  75. and opc_log.result = #{result}
  76. </if>
  77. <if test="ratio != null">
  78. and opc_log.ratio = #{ratio}
  79. </if>
  80. <if test="unit != null and unit != ''">
  81. and opc_log.unit = #{unit}
  82. </if>
  83. <if test="remark != null and remark != ''">
  84. and opc_log.remark = #{remark}
  85. </if>
  86. <if test="createdUserId != null and createdUserId != ''">
  87. and opc_log.created_user_id = #{createdUserId}
  88. </if>
  89. <if test="updateUserId != null and updateUserId != ''">
  90. and opc_log.update_user_id = #{updateUserId}
  91. </if>
  92. <if test="createdTimeStart != null">
  93. and opc_log.created_time <![CDATA[>=]]> #{createdTimeStart}
  94. </if>
  95. <if test="createdTimeEnd != null">
  96. and opc_log.created_time <![CDATA[<=]]> #{createdTimeEnd}
  97. </if>
  98. <if test="createdTime != null">
  99. and opc_log.created_time = #{createdTime}
  100. </if>
  101. <if test="updateTimeStart != null">
  102. and opc_log.update_time <![CDATA[>=]]> #{updateTimeStart}
  103. </if>
  104. <if test="updateTimeEnd != null">
  105. and opc_log.update_time <![CDATA[<=]]> #{updateTimeEnd}
  106. </if>
  107. <if test="updateTime != null">
  108. and opc_log.update_time = #{updateTime}
  109. </if>
  110. <if test="keyword != null and keyword != ''">
  111. and (
  112. opc.sb_name like concat(concat('%',#{keyword}),'%')
  113. or opc_log.position_num like concat(concat('%',#{keyword}),'%')
  114. )
  115. </if>
  116. <if test="sbName != null and sbName != ''">
  117. and opc.sb_name like concat(concat('%',#{sbName}),'%')
  118. </if>
  119. <if test="line != null">
  120. and opc.line = #{line}
  121. </if>
  122. </sql>
  123. <select id="selectList" parameterType="com.platform.dao.dto.remote.RemoteOpcLogDTO"
  124. resultType="com.platform.dao.vo.query.remote.RemoteOpcLogVO">
  125. select opc_log.*, opc.sb_name sbName, opc.line line, opc.type
  126. from t_remote_opc_log as opc_log
  127. left join t_remote_opc opc on opc_log.position_num = opc.position_num
  128. <where>
  129. <include refid="List_Condition"/>
  130. <if test="line != null">
  131. and opc.line = #{line}
  132. </if>
  133. </where>
  134. </select>
  135. <update id="updateBatch" parameterType="java.util.List">
  136. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  137. update t_remote_opc_log
  138. <set>
  139. remark=concat(remark,#{item.remark})
  140. </set>
  141. where position_num = #{item.positionNum}
  142. and year = #{item.year}
  143. and month = #{item.month}
  144. and day = #{item.day}
  145. </foreach>
  146. </update>
  147. <insert id="inserOrUpdateBatch" parameterType="java.util.List">
  148. INSERT INTO t_remote_opc_log
  149. (
  150. year
  151. , month
  152. , day
  153. , result
  154. , remark
  155. , created_time
  156. , position_num
  157. )
  158. VALUES
  159. <foreach collection="list" item="item" index="index" separator="," >
  160. (
  161. #{item.year}
  162. , #{item.month}
  163. , #{item.day}
  164. , #{item.result}
  165. , #{item.remark}
  166. , #{item.createdTime}
  167. , #{item.positionNum}
  168. )
  169. </foreach>
  170. ON DUPLICATE KEY UPDATE
  171. remark = concat(remark,#{item.remark})
  172. </insert>
  173. </mapper>