|
@@ -5,157 +5,208 @@
|
|
|
<mapper namespace="com.jjt.biz.mapper.AlarmRecordMapper">
|
|
|
|
|
|
<resultMap type="AlarmRecord" id="AlarmRecordResult">
|
|
|
- <result property="alarmId" column="ALARM_ID"/>
|
|
|
- <result property="objId" column="OBJ_ID"/>
|
|
|
- <result property="objMetricsId" column="OBJ_METRICS_ID"/>
|
|
|
- <result property="alarmType" column="ALARM_TYPE"/>
|
|
|
- <result property="alarmLevel" column="ALARM_LEVEL"/>
|
|
|
- <result property="alarmValue" column="ALARM_VALUE"/>
|
|
|
- <result property="alarmTime" column="ALARM_TIME"/>
|
|
|
- <result property="createBy" column="CREATE_BY"/>
|
|
|
- <result property="createTime" column="CREATE_TIME"/>
|
|
|
- <result property="updateBy" column="UPDATE_BY"/>
|
|
|
- <result property="updateTime" column="UPDATE_TIME"/>
|
|
|
- <result property="remark" column="REMARK"/>
|
|
|
+ <result property="alarmId" column="ALARM_ID"/>
|
|
|
+ <result property="objId" column="OBJ_ID"/>
|
|
|
+ <result property="objMetricsId" column="OBJ_METRICS_ID"/>
|
|
|
+ <result property="alarmType" column="ALARM_TYPE"/>
|
|
|
+ <result property="alarmLevel" column="ALARM_LEVEL"/>
|
|
|
+ <result property="alarmValue" column="ALARM_VALUE"/>
|
|
|
+ <result property="alarmTime" column="ALARM_TIME"/>
|
|
|
+ <result property="createBy" column="CREATE_BY"/>
|
|
|
+ <result property="createTime" column="CREATE_TIME"/>
|
|
|
+ <result property="updateBy" column="UPDATE_BY"/>
|
|
|
+ <result property="updateTime" column="UPDATE_TIME"/>
|
|
|
+ <result property="remark" column="REMARK"/>
|
|
|
+ <association property="bizobj" javaType="BizObj">
|
|
|
+ <result property="objType" column="OBJ_TYPE"/>
|
|
|
+ <result property="appId" column="APP_ID"/>
|
|
|
+ <result property="accessTimes" column="ACCESS_TIMES"/>
|
|
|
+ <result property="objName" column="OBJ_NAME"/>
|
|
|
+ <result property="objAddr" column="OBJ_ADDR"/>
|
|
|
+ <result property="objPort" column="OBJ_PORT"/>
|
|
|
+ </association>
|
|
|
+ <association property="bizObjMetrics" javaType="BizObjMetrics">
|
|
|
+ <result property="tplId" column="TPL_ID"/>
|
|
|
+ <result property="metricsId" column="METRICS_ID"/>
|
|
|
+ <result property="metricsName" column="METRICS_NAME"/>
|
|
|
+ <result property="metricsCode" column="METRICS_CODE"/>
|
|
|
+ <result property="alarmLow" column="ALARM_LOW"/>
|
|
|
+ <result property="alarmMid" column="ALARM_MID"/>
|
|
|
+ <result property="alarmHigh" column="ALARM_HIGH"/>
|
|
|
+ <result property="dValue" column="D_VALUE"/>
|
|
|
+ <result property="dataExp" column="DATA_EXP"/>
|
|
|
+ </association>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectAlarmRecordVo">
|
|
|
- select ALARM_ID, OBJ_ID, OBJ_METRICS_ID, ALARM_TYPE, ALARM_LEVEL, ALARM_VALUE, ALARM_TIME, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK
|
|
|
- from alarm_record
|
|
|
+ select *
|
|
|
+ from (SELECT A.ALARM_ID,
|
|
|
+ A.OBJ_ID,
|
|
|
+ A.OBJ_METRICS_ID,
|
|
|
+ A.ALARM_TYPE,
|
|
|
+ A.ALARM_LEVEL,
|
|
|
+ A.ALARM_VALUE,
|
|
|
+ A.ALARM_TIME,
|
|
|
+ A.CREATE_BY,
|
|
|
+ A.CREATE_TIME,
|
|
|
+ A.UPDATE_BY,
|
|
|
+ A.UPDATE_TIME,
|
|
|
+ A.REMARK,
|
|
|
+ B.OBJ_TYPE,
|
|
|
+ B.APP_ID,
|
|
|
+ B.ACCESS_TIMES,
|
|
|
+ B.OBJ_NAME,
|
|
|
+ B.OBJ_ADDR,
|
|
|
+ B.OBJ_PORT,
|
|
|
+ c.TPL_ID,
|
|
|
+ c.METRICS_ID,
|
|
|
+ c.METRICS_NAME,
|
|
|
+ c.METRICS_CODE,
|
|
|
+ c.DATA_EXP,
|
|
|
+ c.ALARM_LOW,
|
|
|
+ c.ALARM_MID,
|
|
|
+ c.ALARM_HIGH,
|
|
|
+ c.D_VALUE
|
|
|
+ FROM alarm_record a,
|
|
|
+ biz_obj b,
|
|
|
+ biz_obj_metrics c
|
|
|
+ WHERE a.obj_id = b.obj_id
|
|
|
+ AND a.OBJ_METRICS_ID = c.OBJ_METRICS_ID) t
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectAlarmRecordList" parameterType="AlarmRecord" resultMap="AlarmRecordResult">
|
|
|
<include refid="selectAlarmRecordVo"/>
|
|
|
<where>
|
|
|
- <if test="objId != null ">
|
|
|
- and OBJ_ID = #{objId}
|
|
|
- </if>
|
|
|
- <if test="objMetricsId != null ">
|
|
|
- and OBJ_METRICS_ID = #{objMetricsId}
|
|
|
- </if>
|
|
|
- <if test="alarmType != null and alarmType != ''">
|
|
|
- and ALARM_TYPE = #{alarmType}
|
|
|
- </if>
|
|
|
- <if test="alarmLevel != null and alarmLevel != ''">
|
|
|
- and ALARM_LEVEL = #{alarmLevel}
|
|
|
- </if>
|
|
|
- <if test="alarmValue != null and alarmValue != ''">
|
|
|
- and ALARM_VALUE = #{alarmValue}
|
|
|
- </if>
|
|
|
- <if test="params.beginAlarmTime != null and params.beginAlarmTime != '' and params.endAlarmTime != null and params.endAlarmTime != ''">
|
|
|
- and ALARM_TIME between #{params.beginAlarmTime} and #{params.endAlarmTime}
|
|
|
- </if>
|
|
|
- <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
|
|
- and CREATE_TIME between #{params.beginCreateTime} and #{params.endCreateTime}
|
|
|
- </if>
|
|
|
- <if test="params.beginUpdateTime != null and params.beginUpdateTime != '' and params.endUpdateTime != null and params.endUpdateTime != ''">
|
|
|
- and UPDATE_TIME between #{params.beginUpdateTime} and #{params.endUpdateTime}
|
|
|
- </if>
|
|
|
+ <if test="objId != null ">
|
|
|
+ and OBJ_ID = #{objId}
|
|
|
+ </if>
|
|
|
+ <if test="objMetricsId != null ">
|
|
|
+ and OBJ_METRICS_ID = #{objMetricsId}
|
|
|
+ </if>
|
|
|
+ <if test="alarmType != null and alarmType != ''">
|
|
|
+ and ALARM_TYPE = #{alarmType}
|
|
|
+ </if>
|
|
|
+ <if test="alarmLevel != null and alarmLevel != ''">
|
|
|
+ and ALARM_LEVEL = #{alarmLevel}
|
|
|
+ </if>
|
|
|
+ <if test="alarmValue != null and alarmValue != ''">
|
|
|
+ and ALARM_VALUE = #{alarmValue}
|
|
|
+ </if>
|
|
|
+ <if test="params.beginAlarmTime != null and params.beginAlarmTime != '' and params.endAlarmTime != null and params.endAlarmTime != ''">
|
|
|
+ and ALARM_TIME between #{params.beginAlarmTime} and #{params.endAlarmTime}
|
|
|
+ </if>
|
|
|
+ <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
|
|
+ and CREATE_TIME between #{params.beginCreateTime} and #{params.endCreateTime}
|
|
|
+ </if>
|
|
|
+ <if test="params.beginUpdateTime != null and params.beginUpdateTime != '' and params.endUpdateTime != null and params.endUpdateTime != ''">
|
|
|
+ and UPDATE_TIME between #{params.beginUpdateTime} and #{params.endUpdateTime}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectAlarmRecordByAlarmId" parameterType="Long"
|
|
|
resultMap="AlarmRecordResult">
|
|
|
- <include refid="selectAlarmRecordVo"/>
|
|
|
- where ALARM_ID = #{alarmId}
|
|
|
+ <include refid="selectAlarmRecordVo"/>
|
|
|
+ where ALARM_ID = #{alarmId}
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertAlarmRecord" parameterType="AlarmRecord" useGeneratedKeys="true"
|
|
|
keyProperty="alarmId">
|
|
|
insert into alarm_record
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="objId != null">OBJ_ID,
|
|
|
- </if>
|
|
|
- <if test="objMetricsId != null">OBJ_METRICS_ID,
|
|
|
- </if>
|
|
|
- <if test="alarmType != null">ALARM_TYPE,
|
|
|
- </if>
|
|
|
- <if test="alarmLevel != null">ALARM_LEVEL,
|
|
|
- </if>
|
|
|
- <if test="alarmValue != null">ALARM_VALUE,
|
|
|
- </if>
|
|
|
- <if test="alarmTime != null">ALARM_TIME,
|
|
|
- </if>
|
|
|
- <if test="createBy != null">CREATE_BY,
|
|
|
- </if>
|
|
|
- <if test="createTime != null">CREATE_TIME,
|
|
|
- </if>
|
|
|
- <if test="updateBy != null">UPDATE_BY,
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">UPDATE_TIME,
|
|
|
- </if>
|
|
|
- <if test="remark != null">REMARK,
|
|
|
- </if>
|
|
|
+ <if test="objId != null">OBJ_ID,
|
|
|
+ </if>
|
|
|
+ <if test="objMetricsId != null">OBJ_METRICS_ID,
|
|
|
+ </if>
|
|
|
+ <if test="alarmType != null">ALARM_TYPE,
|
|
|
+ </if>
|
|
|
+ <if test="alarmLevel != null">ALARM_LEVEL,
|
|
|
+ </if>
|
|
|
+ <if test="alarmValue != null">ALARM_VALUE,
|
|
|
+ </if>
|
|
|
+ <if test="alarmTime != null">ALARM_TIME,
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">CREATE_BY,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">CREATE_TIME,
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">UPDATE_BY,
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">UPDATE_TIME,
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">REMARK,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="objId != null">#{objId},
|
|
|
- </if>
|
|
|
- <if test="objMetricsId != null">#{objMetricsId},
|
|
|
- </if>
|
|
|
- <if test="alarmType != null">#{alarmType},
|
|
|
- </if>
|
|
|
- <if test="alarmLevel != null">#{alarmLevel},
|
|
|
- </if>
|
|
|
- <if test="alarmValue != null">#{alarmValue},
|
|
|
- </if>
|
|
|
- <if test="alarmTime != null">#{alarmTime},
|
|
|
- </if>
|
|
|
- <if test="createBy != null">#{createBy},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">#{createTime},
|
|
|
- </if>
|
|
|
- <if test="updateBy != null">#{updateBy},
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">#{updateTime},
|
|
|
- </if>
|
|
|
- <if test="remark != null">#{remark},
|
|
|
- </if>
|
|
|
+ <if test="objId != null">#{objId},
|
|
|
+ </if>
|
|
|
+ <if test="objMetricsId != null">#{objMetricsId},
|
|
|
+ </if>
|
|
|
+ <if test="alarmType != null">#{alarmType},
|
|
|
+ </if>
|
|
|
+ <if test="alarmLevel != null">#{alarmLevel},
|
|
|
+ </if>
|
|
|
+ <if test="alarmValue != null">#{alarmValue},
|
|
|
+ </if>
|
|
|
+ <if test="alarmTime != null">#{alarmTime},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">#{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">#{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">#{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">#{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">#{remark},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateAlarmRecord" parameterType="AlarmRecord">
|
|
|
update alarm_record
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="objId != null">OBJ_ID =
|
|
|
- #{objId},
|
|
|
- </if>
|
|
|
- <if test="objMetricsId != null">OBJ_METRICS_ID =
|
|
|
- #{objMetricsId},
|
|
|
- </if>
|
|
|
- <if test="alarmType != null">ALARM_TYPE =
|
|
|
- #{alarmType},
|
|
|
- </if>
|
|
|
- <if test="alarmLevel != null">ALARM_LEVEL =
|
|
|
- #{alarmLevel},
|
|
|
- </if>
|
|
|
- <if test="alarmValue != null">ALARM_VALUE =
|
|
|
- #{alarmValue},
|
|
|
- </if>
|
|
|
- <if test="alarmTime != null">ALARM_TIME =
|
|
|
- #{alarmTime},
|
|
|
- </if>
|
|
|
- <if test="createBy != null">CREATE_BY =
|
|
|
- #{createBy},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">CREATE_TIME =
|
|
|
- #{createTime},
|
|
|
- </if>
|
|
|
- <if test="updateBy != null">UPDATE_BY =
|
|
|
- #{updateBy},
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">UPDATE_TIME =
|
|
|
- #{updateTime},
|
|
|
- </if>
|
|
|
- <if test="remark != null">REMARK =
|
|
|
- #{remark},
|
|
|
- </if>
|
|
|
+ <if test="objId != null">OBJ_ID =
|
|
|
+ #{objId},
|
|
|
+ </if>
|
|
|
+ <if test="objMetricsId != null">OBJ_METRICS_ID =
|
|
|
+ #{objMetricsId},
|
|
|
+ </if>
|
|
|
+ <if test="alarmType != null">ALARM_TYPE =
|
|
|
+ #{alarmType},
|
|
|
+ </if>
|
|
|
+ <if test="alarmLevel != null">ALARM_LEVEL =
|
|
|
+ #{alarmLevel},
|
|
|
+ </if>
|
|
|
+ <if test="alarmValue != null">ALARM_VALUE =
|
|
|
+ #{alarmValue},
|
|
|
+ </if>
|
|
|
+ <if test="alarmTime != null">ALARM_TIME =
|
|
|
+ #{alarmTime},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">CREATE_BY =
|
|
|
+ #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">CREATE_TIME =
|
|
|
+ #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">UPDATE_BY =
|
|
|
+ #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">UPDATE_TIME =
|
|
|
+ #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">REMARK =
|
|
|
+ #{remark},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
where ALARM_ID = #{alarmId}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteAlarmRecordByAlarmId" parameterType="Long">
|
|
|
delete
|
|
|
- from alarm_record where ALARM_ID = #{alarmId}
|
|
|
+ from alarm_record
|
|
|
+ where ALARM_ID = #{alarmId}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteAlarmRecordByAlarmIds" parameterType="String">
|