HlMetricsMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.hl.mapper.HlMetricsMapper">
  6. <resultMap type="HlMetrics" id="HlMetricsResult">
  7. <result property="hlMetricsId" column="HL_METRICS_ID"/>
  8. <result property="hlClassId" column="HL_CLASS_ID"/>
  9. <result property="metricsId" column="METRICS_ID"/>
  10. <result property="hlScore" column="HL_SCORE"/>
  11. <result property="hlStand" column="HL_STAND"/>
  12. <result property="metricsName" column="METRICS_NAME"/>
  13. <result property="metricsCode" column="METRICS_CODE"/>
  14. <result property="createBy" column="CREATE_BY"/>
  15. <result property="createTime" column="CREATE_TIME"/>
  16. <result property="updateBy" column="UPDATE_BY"/>
  17. <result property="updateTime" column="UPDATE_TIME"/>
  18. <result property="remark" column="REMARK"/>
  19. </resultMap>
  20. <sql id="selectHlMetricsVo">
  21. select *
  22. from (select a.*, b.METRICS_NAME, b.METRICS_CODE
  23. from hl_metrics a,
  24. metrics_def b
  25. where a.METRICS_ID = b.METRICS_ID) t
  26. </sql>
  27. <select id="selectHlMetricsList" parameterType="HlMetrics" resultMap="HlMetricsResult">
  28. <include refid="selectHlMetricsVo"/>
  29. <where>
  30. <if test="hlClassId != null ">
  31. and HL_CLASS_ID = #{hlClassId}
  32. </if>
  33. <if test="metricsId != null ">
  34. and METRICS_ID = #{metricsId}
  35. </if>
  36. <if test="hlScore != null and hlScore != ''">
  37. and HL_SCORE = #{hlScore}
  38. </if>
  39. <if test="hlStand != null and hlStand != ''">
  40. and HL_STAND = #{hlStand}
  41. </if>
  42. <if test="createBy != null and createBy != ''">
  43. and CREATE_BY = #{createBy}
  44. </if>
  45. <if test="createTime != null ">
  46. and CREATE_TIME = #{createTime}
  47. </if>
  48. <if test="updateBy != null and updateBy != ''">
  49. and UPDATE_BY = #{updateBy}
  50. </if>
  51. <if test="updateTime != null ">
  52. and UPDATE_TIME = #{updateTime}
  53. </if>
  54. <if test="remark != null and remark != ''">
  55. and REMARK = #{remark}
  56. </if>
  57. </where>
  58. </select>
  59. <select id="selectHlMetricsByHlMetricsId" parameterType="Long"
  60. resultMap="HlMetricsResult">
  61. <include refid="selectHlMetricsVo"/>
  62. where HL_METRICS_ID = #{hlMetricsId}
  63. </select>
  64. <select id="selectHlMetricsList4ModelId" resultType="com.jjt.hl.domain.HlMetrics">
  65. SELECT metrics_id, metrics_name, metrics_code
  66. FROM metrics_def
  67. WHERE metrics_id IN (SELECT metrics_id
  68. from biz_obj_metrics
  69. WHERE obj_id in (SELECT a.obj_id
  70. FROM biz_model_detail a,
  71. biz_obj b
  72. WHERE a.obj_id = b.obj_id
  73. AND b.obj_type = #{objType}
  74. AND a.MODEL_ID = #{modelId})
  75. group BY metrics_id)
  76. </select>
  77. <select id="hlMetricsList" resultType="com.jjt.hl.vo.HlMetricsVO">
  78. SELECT a.*, b.EVENT_ID, b.START_TIME, b.END_TIME, b.EVENT_STATUS, b.EVENT_VALUE
  79. FROM (SELECT a.*
  80. FROM biz_obj_metrics a,
  81. (SELECT a.OBJ_ID, b.METRICS_ID
  82. FROM hl_obj a,
  83. hl_metrics b
  84. WHERE a.HL_CLASS_ID = b.HL_CLASS_ID
  85. AND a.HL_CLASS_ID = #{hlClassId}) b
  86. WHERE a.obj_id = b.obj_id
  87. AND a.METRICS_ID = b.metrics_id) a
  88. LEFT JOIN
  89. (SELECT * FROM hl_event WHERE event_status = 1) b ON a.OBJ_METRICS_ID = b.obj_metrics_id
  90. </select>
  91. <insert id="insertHlMetrics" parameterType="HlMetrics" useGeneratedKeys="true"
  92. keyProperty="hlMetricsId">
  93. insert into hl_metrics
  94. <trim prefix="(" suffix=")" suffixOverrides=",">
  95. <if test="hlClassId != null">HL_CLASS_ID,
  96. </if>
  97. <if test="metricsId != null">METRICS_ID,
  98. </if>
  99. <if test="hlScore != null">HL_SCORE,
  100. </if>
  101. <if test="hlStand != null">HL_STAND,
  102. </if>
  103. <if test="createBy != null">CREATE_BY,
  104. </if>
  105. <if test="createTime != null">CREATE_TIME,
  106. </if>
  107. <if test="updateBy != null">UPDATE_BY,
  108. </if>
  109. <if test="updateTime != null">UPDATE_TIME,
  110. </if>
  111. <if test="remark != null">REMARK,
  112. </if>
  113. </trim>
  114. <trim prefix="values (" suffix=")" suffixOverrides=",">
  115. <if test="hlClassId != null">#{hlClassId},
  116. </if>
  117. <if test="metricsId != null">#{metricsId},
  118. </if>
  119. <if test="hlScore != null">#{hlScore},
  120. </if>
  121. <if test="hlStand != null">#{hlStand},
  122. </if>
  123. <if test="createBy != null">#{createBy},
  124. </if>
  125. <if test="createTime != null">#{createTime},
  126. </if>
  127. <if test="updateBy != null">#{updateBy},
  128. </if>
  129. <if test="updateTime != null">#{updateTime},
  130. </if>
  131. <if test="remark != null">#{remark},
  132. </if>
  133. </trim>
  134. </insert>
  135. <update id="updateHlMetrics" parameterType="HlMetrics">
  136. update hl_metrics
  137. <trim prefix="SET" suffixOverrides=",">
  138. <if test="hlClassId != null">HL_CLASS_ID =
  139. #{hlClassId},
  140. </if>
  141. <if test="metricsId != null">METRICS_ID =
  142. #{metricsId},
  143. </if>
  144. <if test="hlScore != null">HL_SCORE =
  145. #{hlScore},
  146. </if>
  147. <if test="hlStand != null">HL_STAND =
  148. #{hlStand},
  149. </if>
  150. <if test="createBy != null">CREATE_BY =
  151. #{createBy},
  152. </if>
  153. <if test="createTime != null">CREATE_TIME =
  154. #{createTime},
  155. </if>
  156. <if test="updateBy != null">UPDATE_BY =
  157. #{updateBy},
  158. </if>
  159. <if test="updateTime != null">UPDATE_TIME =
  160. #{updateTime},
  161. </if>
  162. <if test="remark != null">REMARK =
  163. #{remark},
  164. </if>
  165. </trim>
  166. where HL_METRICS_ID = #{hlMetricsId}
  167. </update>
  168. <delete id="deleteHlMetricsByHlMetricsId" parameterType="Long">
  169. delete
  170. from hl_metrics
  171. where HL_METRICS_ID = #{hlMetricsId}
  172. </delete>
  173. <delete id="deleteHlMetricsByHlMetricsIds" parameterType="String">
  174. delete from hl_metrics where HL_METRICS_ID in
  175. <foreach item="hlMetricsId" collection="array" open="(" separator="," close=")">
  176. #{hlMetricsId}
  177. </foreach>
  178. </delete>
  179. </mapper>