RipaMetricsAnalyMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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.ripa.mapper.RipaMetricsAnalyMapper">
  6. <resultMap type="RipaMetricsAnaly" id="RipaMetricsAnalyResult">
  7. <result property="analyId" column="ANALY_ID"/>
  8. <result property="autoId" column="AUTO_ID"/>
  9. <result property="algoId" column="ALGO_ID"/>
  10. <result property="timeSwitch" column="TIME_SWITCH"/>
  11. <result property="scheduleCycle" column="SCHEDULE_CYCLE"/>
  12. <result property="lastTime" column="LAST_TIME"/>
  13. <result property="alarmWitch" column="ALARM_WITCH"/>
  14. <result property="alarmKey" column="ALARM_KEY"/>
  15. <result property="alarmContent" column="ALARM_CONTENT"/>
  16. <result property="createBy" column="CREATE_BY"/>
  17. <result property="createTime" column="CREATE_TIME"/>
  18. <result property="updateBy" column="UPDATE_BY"/>
  19. <result property="updateTime" column="UPDATE_TIME"/>
  20. <result property="remark" column="REMARK"/>
  21. </resultMap>
  22. <sql id="selectRipaMetricsAnalyVo">
  23. select *
  24. from (SELECT a.*, b.algo_name
  25. FROM (SELECT a.ANALY_ID,
  26. a.ALGO_ID,
  27. a.TIME_SWITCH,
  28. a.SCHEDULE_CYCLE,
  29. a.LAST_TIME,
  30. a.ALARM_WITCH,
  31. a.ALARM_KEY,
  32. a.ALARM_CONTENT,
  33. b.*
  34. FROM ripa_metrics_analy a,
  35. (SELECT a.auto_id,
  36. a.model_id,
  37. a.obj_id,
  38. a.obj_metrics_id,
  39. a.metrics_name,
  40. a.obj_type,
  41. a.obj_name,
  42. a.algo_type,
  43. a.ntr,
  44. a.hov,
  45. b.model_name
  46. FROM ripa_metrics a,
  47. ripa_model b
  48. WHERE a.MODEL_ID = b.model_id) b
  49. WHERE a.AUTO_ID = b.auto_id) a
  50. LEFT JOIN ripa_algo b ON a.ALGO_ID = b.algo_id) a
  51. </sql>
  52. <select id="selectRipaMetricsAnalyList" parameterType="com.jjt.ripa.vo.RipaMetricsAnalyVO"
  53. resultType="com.jjt.ripa.vo.RipaMetricsAnalyVO">
  54. <include refid="selectRipaMetricsAnalyVo"/>
  55. <where>
  56. <if test="autoId != null ">
  57. and AUTO_ID = #{autoId}
  58. </if>
  59. <if test="algoId != null ">
  60. and ALGO_ID = #{algoId}
  61. </if>
  62. <if test="timeSwitch != null and timeSwitch != ''">
  63. and TIME_SWITCH = #{timeSwitch}
  64. </if>
  65. <if test="scheduleCycle != null ">
  66. and SCHEDULE_CYCLE = #{scheduleCycle}
  67. </if>
  68. <if test="lastTime != null ">
  69. and LAST_TIME = #{lastTime}
  70. </if>
  71. <if test="alarmWitch != null and alarmWitch != ''">
  72. and ALARM_WITCH = #{alarmWitch}
  73. </if>
  74. <if test="alarmKey != null and alarmKey != ''">
  75. and ALARM_KEY = #{alarmKey}
  76. </if>
  77. <if test="alarmContent != null and alarmContent != ''">
  78. and ALARM_CONTENT = #{alarmContent}
  79. </if>
  80. <if test="createBy != null and createBy != ''">
  81. and CREATE_BY = #{createBy}
  82. </if>
  83. <if test="createTime != null ">
  84. and CREATE_TIME = #{createTime}
  85. </if>
  86. <if test="updateBy != null and updateBy != ''">
  87. and UPDATE_BY = #{updateBy}
  88. </if>
  89. <if test="updateTime != null ">
  90. and UPDATE_TIME = #{updateTime}
  91. </if>
  92. <if test="remark != null and remark != ''">
  93. and REMARK = #{remark}
  94. </if>
  95. </where>
  96. </select>
  97. <select id="selectRipaMetricsAnalyByAnalyId" parameterType="Long"
  98. resultType="com.jjt.ripa.vo.RipaMetricsAnalyVO">
  99. <include refid="selectRipaMetricsAnalyVo"/>
  100. where ANALY_ID = #{analyId}
  101. </select>
  102. <insert id="insertRipaMetricsAnaly" parameterType="com.jjt.ripa.vo.RipaMetricsAnalyVO">
  103. insert into ripa_metrics_analy
  104. <trim prefix="(" suffix=")" suffixOverrides=",">
  105. <if test="autoId != null">AUTO_ID,
  106. </if>
  107. <if test="algoId != null">ALGO_ID,
  108. </if>
  109. <if test="timeSwitch != null and timeSwitch != ''">TIME_SWITCH,
  110. </if>
  111. <if test="scheduleCycle != null">SCHEDULE_CYCLE,
  112. </if>
  113. <if test="lastTime != null">LAST_TIME,
  114. </if>
  115. <if test="alarmWitch != null">ALARM_WITCH,
  116. </if>
  117. <if test="alarmKey != null and alarmKey != ''">ALARM_KEY,
  118. </if>
  119. <if test="alarmContent != null and alarmContent != ''">ALARM_CONTENT,
  120. </if>
  121. <if test="createBy != null">CREATE_BY,
  122. </if>
  123. <if test="createTime != null">CREATE_TIME,
  124. </if>
  125. <if test="updateBy != null">UPDATE_BY,
  126. </if>
  127. <if test="updateTime != null">UPDATE_TIME,
  128. </if>
  129. <if test="remark != null">REMARK,
  130. </if>
  131. </trim>
  132. <trim prefix="values (" suffix=")" suffixOverrides=",">
  133. <if test="autoId != null">#{autoId},
  134. </if>
  135. <if test="algoId != null">#{algoId},
  136. </if>
  137. <if test="timeSwitch != null and timeSwitch != ''">#{timeSwitch},
  138. </if>
  139. <if test="scheduleCycle != null">#{scheduleCycle},
  140. </if>
  141. <if test="lastTime != null">#{lastTime},
  142. </if>
  143. <if test="alarmWitch != null">#{alarmWitch},
  144. </if>
  145. <if test="alarmKey != null and alarmKey != ''">#{alarmKey},
  146. </if>
  147. <if test="alarmContent != null and alarmContent != ''">#{alarmContent},
  148. </if>
  149. <if test="createBy != null">#{createBy},
  150. </if>
  151. <if test="createTime != null">#{createTime},
  152. </if>
  153. <if test="updateBy != null">#{updateBy},
  154. </if>
  155. <if test="updateTime != null">#{updateTime},
  156. </if>
  157. <if test="remark != null">#{remark},
  158. </if>
  159. </trim>
  160. </insert>
  161. <insert id="insertRipaAlarmRecord" parameterType="com.jjt.ripa.vo.AlarmRecord" useGeneratedKeys="true"
  162. keyProperty="alarmId">
  163. insert into alarm_record
  164. <trim prefix="(" suffix=")" suffixOverrides=",">
  165. <if test="objId != null">OBJ_ID,
  166. </if>
  167. <if test="objMetricsId != null">OBJ_METRICS_ID,
  168. </if>
  169. <if test="alarmType != null">ALARM_TYPE,
  170. </if>
  171. <if test="alarmLevel != null">ALARM_LEVEL,
  172. </if>
  173. <if test="alarmValue != null">ALARM_VALUE,
  174. </if>
  175. <if test="alarmTime != null">ALARM_TIME,
  176. </if>
  177. <if test="endTime != null">END_TIME,
  178. </if>
  179. <if test="alarmStatus != null">ALARM_STATUS,
  180. </if>
  181. <if test="createBy != null">CREATE_BY,
  182. </if>
  183. <if test="createTime != null">CREATE_TIME,
  184. </if>
  185. <if test="updateBy != null">UPDATE_BY,
  186. </if>
  187. <if test="updateTime != null">UPDATE_TIME,
  188. </if>
  189. <if test="remark != null">REMARK,
  190. </if>
  191. </trim>
  192. <trim prefix="values (" suffix=")" suffixOverrides=",">
  193. <if test="objId != null">#{objId},
  194. </if>
  195. <if test="objMetricsId != null">#{objMetricsId},
  196. </if>
  197. <if test="alarmType != null">#{alarmType},
  198. </if>
  199. <if test="alarmLevel != null">#{alarmLevel},
  200. </if>
  201. <if test="alarmValue != null">#{alarmValue},
  202. </if>
  203. <if test="alarmTime != null">#{alarmTime},
  204. </if>
  205. <if test="endTime != null">#{endTime},
  206. </if>
  207. <if test="alarmStatus != null">#{alarmStatus},
  208. </if>
  209. <if test="createBy != null">#{createBy},
  210. </if>
  211. <if test="createTime != null">#{createTime},
  212. </if>
  213. <if test="updateBy != null">#{updateBy},
  214. </if>
  215. <if test="updateTime != null">#{updateTime},
  216. </if>
  217. <if test="remark != null">#{remark},
  218. </if>
  219. </trim>
  220. </insert>
  221. <update id="updateRipaMetricsAnaly" parameterType="com.jjt.ripa.vo.RipaMetricsAnalyVO">
  222. update ripa_metrics_analy
  223. <trim prefix="SET" suffixOverrides=",">
  224. <if test="autoId != null">AUTO_ID =
  225. #{autoId},
  226. </if>
  227. <if test="algoId != null">ALGO_ID =
  228. #{algoId},
  229. </if>
  230. <if test="timeSwitch != null and timeSwitch != ''">TIME_SWITCH =
  231. #{timeSwitch},
  232. </if>
  233. <if test="scheduleCycle != null">SCHEDULE_CYCLE =
  234. #{scheduleCycle},
  235. </if>
  236. <if test="lastTime != null">LAST_TIME =
  237. #{lastTime},
  238. </if>
  239. <if test="alarmWitch != null">ALARM_WITCH =
  240. #{alarmWitch},
  241. </if>
  242. <if test="alarmKey != null and alarmKey != ''">ALARM_KEY =
  243. #{alarmKey},
  244. </if>
  245. <if test="alarmContent != null and alarmContent != ''">ALARM_CONTENT =
  246. #{alarmContent},
  247. </if>
  248. <if test="createBy != null">CREATE_BY =
  249. #{createBy},
  250. </if>
  251. <if test="createTime != null">CREATE_TIME =
  252. #{createTime},
  253. </if>
  254. <if test="updateBy != null">UPDATE_BY =
  255. #{updateBy},
  256. </if>
  257. <if test="updateTime != null">UPDATE_TIME =
  258. #{updateTime},
  259. </if>
  260. <if test="remark != null">REMARK =
  261. #{remark},
  262. </if>
  263. </trim>
  264. where ANALY_ID = #{analyId}
  265. </update>
  266. <delete id="deleteRipaMetricsAnalyByAnalyId" parameterType="Long">
  267. delete
  268. from ripa_metrics_analy
  269. where ANALY_ID = #{analyId}
  270. </delete>
  271. <delete id="deleteRipaMetricsAnalyByAnalyIds" parameterType="String">
  272. delete from ripa_metrics_analy where ANALY_ID in
  273. <foreach item="analyId" collection="array" open="(" separator="," close=")">
  274. #{analyId}
  275. </foreach>
  276. </delete>
  277. </mapper>