RttableMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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.steerinfo.ems.rttable.mapper.RttableMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.ems.rttable.model.Rttable">
  5. <id column="ID" jdbcType="DECIMAL" property="id" />
  6. <result column="ALTID" jdbcType="VARCHAR" property="altid" />
  7. <result column="RTVALUE" jdbcType="DECIMAL" property="rtvalue" />
  8. <result column="ALARMSTATUS" jdbcType="DECIMAL" property="alarmstatus" />
  9. <result column="COMMSTATUS" jdbcType="DECIMAL" property="commstatus" />
  10. <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
  11. <result column="NOTE" jdbcType="VARCHAR" property="note" />
  12. </resultMap>
  13. <sql id="columns">
  14. ID, ALTID, RTVALUE, ALARMSTATUS, COMMSTATUS, UPDATETIME, NOTE
  15. </sql>
  16. <sql id="columns_alias">
  17. t.ID, t.ALTID, t.RTVALUE, t.ALARMSTATUS, t.COMMSTATUS, t.UPDATETIME, t.NOTE
  18. </sql>
  19. <sql id="select">
  20. SELECT <include refid="columns"/> FROM RTTABLE
  21. </sql>
  22. <sql id="select_alias">
  23. SELECT <include refid="columns_alias"/> FROM RTTABLE t
  24. </sql>
  25. <sql id="where">
  26. <where>
  27. <if test="id != null">
  28. and ID = #{id}
  29. </if>
  30. <if test="altid != null and altid != ''">
  31. and ALTID = #{altid}
  32. </if>
  33. <if test="rtvalue != null">
  34. and RTVALUE = #{rtvalue}
  35. </if>
  36. <if test="alarmstatus != null">
  37. and ALARMSTATUS = #{alarmstatus}
  38. </if>
  39. <if test="commstatus != null">
  40. and COMMSTATUS = #{commstatus}
  41. </if>
  42. <if test="updatetime != null">
  43. and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
  44. </if>
  45. <if test="note != null and note != ''">
  46. and NOTE = #{note}
  47. </if>
  48. </where>
  49. </sql>
  50. <sql id="whereLike">
  51. <where>
  52. <if test="id != null">
  53. and ID = #{id}
  54. </if>
  55. <if test="altid != null and altid != ''">
  56. and ALTID LIKE '%${altid}%'
  57. </if>
  58. <if test="rtvalue != null">
  59. and RTVALUE = #{rtvalue}
  60. </if>
  61. <if test="alarmstatus != null">
  62. and ALARMSTATUS = #{alarmstatus}
  63. </if>
  64. <if test="commstatus != null">
  65. and COMMSTATUS = #{commstatus}
  66. </if>
  67. <if test="updatetime != null">
  68. and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
  69. </if>
  70. <if test="note != null and note != ''">
  71. and NOTE LIKE '%${note}%'
  72. </if>
  73. </where>
  74. </sql>
  75. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  76. delete from RTTABLE
  77. where ID = #{id,jdbcType=DECIMAL}
  78. </delete>
  79. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  80. delete from RTTABLE
  81. where 1!=1
  82. <if test="altid != null and altid != ''">
  83. or ALTID = #{altid}
  84. </if>
  85. <if test="rtvalue != null">
  86. or RTVALUE = #{rtvalue}
  87. </if>
  88. <if test="alarmstatus != null">
  89. or ALARMSTATUS = #{alarmstatus}
  90. </if>
  91. <if test="commstatus != null">
  92. or COMMSTATUS = #{commstatus}
  93. </if>
  94. <if test="updatetime != null">
  95. or TO_CHAR(UPDATETIME,'yyyy-MM-dd') = '#{updatetime}'
  96. </if>
  97. <if test="note != null and note != ''">
  98. or NOTE = #{note}
  99. </if>
  100. </delete>
  101. <insert id="insert" parameterType="com.steerinfo.ems.rttable.model.Rttable">
  102. insert into RTTABLE (ID, ALTID, RTVALUE,
  103. ALARMSTATUS, COMMSTATUS, UPDATETIME,
  104. NOTE)
  105. values (#{id,jdbcType=DECIMAL}, #{altid,jdbcType=VARCHAR}, #{rtvalue,jdbcType=DECIMAL},
  106. #{alarmstatus,jdbcType=DECIMAL}, #{commstatus,jdbcType=DECIMAL}, #{updatetime,jdbcType=TIMESTAMP},
  107. #{note,jdbcType=VARCHAR})
  108. </insert>
  109. <insert id="insertSelective" parameterType="com.steerinfo.ems.rttable.model.Rttable">
  110. insert into RTTABLE
  111. <trim prefix="(" suffix=")" suffixOverrides=",">
  112. <if test="id != null">
  113. ID,
  114. </if>
  115. <if test="altid != null">
  116. ALTID,
  117. </if>
  118. <if test="rtvalue != null">
  119. RTVALUE,
  120. </if>
  121. <if test="alarmstatus != null">
  122. ALARMSTATUS,
  123. </if>
  124. <if test="commstatus != null">
  125. COMMSTATUS,
  126. </if>
  127. <if test="updatetime != null">
  128. UPDATETIME,
  129. </if>
  130. <if test="note != null">
  131. NOTE,
  132. </if>
  133. </trim>
  134. <trim prefix="values (" suffix=")" suffixOverrides=",">
  135. <if test="id != null">
  136. #{id,jdbcType=DECIMAL},
  137. </if>
  138. <if test="altid != null">
  139. #{altid,jdbcType=VARCHAR},
  140. </if>
  141. <if test="rtvalue != null">
  142. #{rtvalue,jdbcType=DECIMAL},
  143. </if>
  144. <if test="alarmstatus != null">
  145. #{alarmstatus,jdbcType=DECIMAL},
  146. </if>
  147. <if test="commstatus != null">
  148. #{commstatus,jdbcType=DECIMAL},
  149. </if>
  150. <if test="updatetime != null">
  151. #{updatetime,jdbcType=TIMESTAMP},
  152. </if>
  153. <if test="note != null">
  154. #{note,jdbcType=VARCHAR},
  155. </if>
  156. </trim>
  157. </insert>
  158. <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.rttable.model.Rttable">
  159. update RTTABLE
  160. set ALTID = #{altid,jdbcType=VARCHAR},
  161. RTVALUE = #{rtvalue,jdbcType=DECIMAL},
  162. ALARMSTATUS = #{alarmstatus,jdbcType=DECIMAL},
  163. COMMSTATUS = #{commstatus,jdbcType=DECIMAL},
  164. UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
  165. NOTE = #{note,jdbcType=VARCHAR}
  166. where ID = #{id,jdbcType=DECIMAL}
  167. </update>
  168. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.rttable.model.Rttable">
  169. update RTTABLE
  170. <set>
  171. <if test="altid != null">
  172. ALTID = #{altid,jdbcType=VARCHAR},
  173. </if>
  174. <if test="rtvalue != null">
  175. RTVALUE = #{rtvalue,jdbcType=DECIMAL},
  176. </if>
  177. <if test="alarmstatus != null">
  178. ALARMSTATUS = #{alarmstatus,jdbcType=DECIMAL},
  179. </if>
  180. <if test="commstatus != null">
  181. COMMSTATUS = #{commstatus,jdbcType=DECIMAL},
  182. </if>
  183. <if test="updatetime != null">
  184. UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
  185. </if>
  186. <if test="note != null">
  187. NOTE = #{note,jdbcType=VARCHAR},
  188. </if>
  189. </set>
  190. where ID = #{id,jdbcType=DECIMAL}
  191. </update>
  192. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  193. <include refid="select"/>
  194. where ID = #{id,jdbcType=DECIMAL}
  195. </select>
  196. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  197. <include refid="select"/>
  198. <include refid="where"/>
  199. </select>
  200. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  201. <include refid="select"/>
  202. <include refid="whereLike"/>
  203. </select>
  204. <insert id="batchInsert" parameterType="java.util.List">
  205. insert into RTTABLE
  206. (ID,
  207. ALTID, RTVALUE, ALARMSTATUS,
  208. COMMSTATUS, UPDATETIME, NOTE
  209. )
  210. ( <foreach collection="list" item="item" separator="union all">
  211. select
  212. #{item.id,jdbcType=DECIMAL},
  213. #{item.altid,jdbcType=VARCHAR}, #{item.rtvalue,jdbcType=DECIMAL}, #{item.alarmstatus,jdbcType=DECIMAL},
  214. #{item.commstatus,jdbcType=DECIMAL}, #{item.updatetime,jdbcType=TIMESTAMP}, #{item.note,jdbcType=VARCHAR}
  215. from dual
  216. </foreach> )
  217. </insert>
  218. <update id="batchUpdate" parameterType="java.util.List">
  219. update RTTABLE
  220. set
  221. ID=
  222. <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
  223. when #{item.id,jdbcType=DECIMAL} then #{item.id,jdbcType=DECIMAL}
  224. </foreach>
  225. ,ALTID=
  226. <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
  227. when #{item.id,jdbcType=DECIMAL} then #{item.altid,jdbcType=VARCHAR}
  228. </foreach>
  229. ,RTVALUE=
  230. <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
  231. when #{item.id,jdbcType=DECIMAL} then #{item.rtvalue,jdbcType=DECIMAL}
  232. </foreach>
  233. ,ALARMSTATUS=
  234. <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
  235. when #{item.id,jdbcType=DECIMAL} then #{item.alarmstatus,jdbcType=DECIMAL}
  236. </foreach>
  237. ,COMMSTATUS=
  238. <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
  239. when #{item.id,jdbcType=DECIMAL} then #{item.commstatus,jdbcType=DECIMAL}
  240. </foreach>
  241. ,UPDATETIME=
  242. <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
  243. when #{item.id,jdbcType=DECIMAL} then #{item.updatetime,jdbcType=TIMESTAMP}
  244. </foreach>
  245. ,NOTE=
  246. <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
  247. when #{item.id,jdbcType=DECIMAL} then #{item.note,jdbcType=VARCHAR}
  248. </foreach>
  249. where ID in
  250. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  251. #{item.id,jdbcType=DECIMAL}
  252. </foreach>
  253. </update>
  254. <delete id="batchDelete" parameterType="java.util.List">
  255. delete from RTTABLE
  256. where ID in
  257. <foreach collection="list" item="id" open="(" close=")" separator=",">
  258. #{id}
  259. </foreach>
  260. </delete>
  261. <!-- 友情提示!!!-->
  262. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  263. <insert id="insertPowerTenMinutes" parameterType="java.util.HashMap">
  264. INSERT INTO EMS_POWER_TIMING(TMSTMP) VALUES
  265. (to_date (#{clock1,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
  266. )
  267. </insert>
  268. <update id="updatePowerTenMinutes" parameterType="java.util.HashMap">
  269. update EMS_POWER_TIMING
  270. <set>
  271. ${sql}
  272. </set>
  273. where TMSTMP =to_date (#{clock1,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
  274. </update>
  275. <update id="updatePowerMinutes" parameterType="java.util.HashMap">
  276. update ${table}
  277. <set>
  278. <if test="clock != null and clock != ''">
  279. TMSTMP = to_date (#{clock,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
  280. </if>
  281. ${sql}
  282. </set>
  283. </update>
  284. </mapper>