123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.zhyc.xps.aqpt.mapper.AlertMapper">
- <resultMap id="AlertDtoResultMap" type="com.zhyc.xps.aqpt.dto.AlertDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--单位ID-->
- <result column="alert_id" property="alertId" jdbcType="BIGINT" /><!--预警ID-->
- <result column="alert_type_id" property="alertTypeId" jdbcType="BIGINT" />
- <result column="alert_title" property="alertTitle" jdbcType="VARCHAR" />
- <result column="alert_desc" property="alertDesc" jdbcType="VARCHAR" />
- <result column="alert_time" property="alertTime" jdbcType="TIMESTAMP"/>
- <result column="alert_source" property="alertSource" jdbcType="BIGINT" />
- <result column="alert_code" property="alertCode" jdbcType="VARCHAR" />
- <result column="alert_level" property="alertLevel" jdbcType="BIGINT" />
- <result column="risk_point_id" property="riskPointId" jdbcType="BIGINT" />
- <result column="risk_point_title" property="riskPointTitle" jdbcType="VARCHAR" />
- <result column="handle_time" property="handleTime" jdbcType="TIMESTAMP"/>
- <result column="handle_act" property="handleAct" jdbcType="BIGINT" />
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="alert_reason" property="alertReason" jdbcType="VARCHAR" />
- <result column="handle_measure" property="handleMeasure" jdbcType="VARCHAR" />
- <result column="handle_group_id" property="handleGroupId" jdbcType="BIGINT" /><!--当前责任人部门ID-->
- <result column="handle_position_id" property="handlePositionId" jdbcType="BIGINT" /><!--当前责任人岗位ID-->
- <result column="handle_account_id" property="handleAccountId" jdbcType="BIGINT" /><!--当前责任人账号ID-->
- <result column="handle_group_name" property="handleGroupName" jdbcType="VARCHAR" /><!--当前责任人部门名称-->
- <result column="handle_position_name" property="handlePositionName" jdbcType="VARCHAR" /><!--当前责任人岗位名称-->
- <result column="handle_account_name" property="handleAccountName" jdbcType="VARCHAR" /><!--当前责任人账号名称-->
- <result column="wf_def_id" property="wfDefId" jdbcType="BIGINT" />
- <result column="wf_ins_id" property="wfInsId" jdbcType="BIGINT" />
- <result column="cur_activity_ins_id" property="curActivityInsId" jdbcType="BIGINT" />
- <result column="cur_activity_code" property="curActivityCode" jdbcType="VARCHAR" />
- <result column="cur_activity_title" property="curActivityTitle" jdbcType="VARCHAR" />
- <result column="cur_activity_begin_time" property="curActivityBeginTime" jdbcType="TIMESTAMP"/>
- <result column="cur_form_code" property="curFormCode" jdbcType="VARCHAR" />
- <result column="cur_group_id" property="curGroupId" jdbcType="BIGINT" />
- <result column="cur_position_id" property="curPositionId" jdbcType="BIGINT" />
- <result column="cur_account_id" property="curAccountId" jdbcType="BIGINT" />
- <result column="cur_group_name" property="curGroupName" jdbcType="VARCHAR" />
- <result column="cur_position_name" property="curPositionName" jdbcType="VARCHAR" />
- <result column="cur_account_name" property="curAccountName" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="AlertDto_Cols">
- A.oc_id,
- A.alert_id,
- A.alert_type_id,
- A.alert_code,
- A.alert_desc,
- A.alert_title,
- A.alert_time,
- A.alert_source,
- A.alert_level,
- A.handle_time,
- A.handle_act,
- A.alert_reason,
- A.handle_measure,
- A.risk_point_id,
- G.risk_point_title,
- A.handle_account_id,
- A.handle_account_name,
- A.handle_position_id,
- A.handle_position_name,
- A.handle_group_id,
- A.handle_group_name,
- A.status,
- W.wf_def_id,
- W.wf_ins_id,
- W.cur_activity_title,
- W.cur_activity_code,
- W.cur_form_code,
- W.cur_activity_ins_id,
- W.cur_group_id,
- W.cur_activity_begin_time,
- W.cur_group_id,
- W.cur_group_name,
- W.cur_position_id,
- W.cur_position_name,
- W.cur_account_id,
- W.cur_account_name
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="AlertDtoResultMap">
- SELECT
- <include refid="AlertDto_Cols"/>
- FROM alert AS A
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.handle_group_id = B.group_id )
- LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
- LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.alert_id = W.wf_ins_id )
- WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
- AND A.alert_id = #{alertId ,jdbcType=BIGINT}
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="AlertDtoResultMap">
- SELECT
- <include refid="AlertDto_Cols"/>
- FROM alert AS A
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.handle_group_id = B.group_id )
- LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
- LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.alert_id = W.wf_ins_id )
- WHERE A.oc_id = #{ocId, jdbcType=BIGINT} AND A.deleted_flag = 0
- <if test="alertId !=null">
- AND A.alert_id = #{alertId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.alert_title like "%"#{keywords}"%"
- </if>
- <if test="alertTypeId != null">
- AND A.alert_type_id = #{alertTypeId ,jdbcType=BIGINT}
- </if>
- <if test="status != null">
- AND A.status = #{status ,jdbcType=BIGINT}
- </if>
- <if test="alertTime != null">
- AND DATE_FORMAT(A.alert_time,'%Y-%m-%d') = #{alertTime}
- </if>
- <if test="year != null">
- AND YEAR(A.alert_time) = #{year}
- </if>
- <if test="month != null">
- AND MONTH(A.alert_time) = #{month}
- </if>
- <if test="startDate != null and endDate != null">
- AND A.alert_time BETWEEN #{startDate} and #{endDate}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND B.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND B.node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- ORDER BY A.alert_time DESC
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="AlertDtoResultMap">
- SELECT
- <include refid="AlertDto_Cols"/>
- FROM alert AS A
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.handle_group_id = B.group_id )
- LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
- LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.alert_id = W.wf_ins_id )
- WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
- <if test="alertId !=null">
- AND A.alert_id = #{alertId ,jdbcType=BIGINT}
- </if>
- <if test="alertLevel != null">
- AND A.alert_level = #{alertLevel, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.alert_title like "%"#{keywords}"%"
- </if>
- <if test="alertTypeId != null">
- AND A.alert_type_id = #{alertTypeId ,jdbcType=BIGINT}
- </if>
- <if test="status != null">
- AND A.status = #{status ,jdbcType=BIGINT}
- </if>
- <if test="day != null">
- AND date_format(A.alert_time, '%Y-%m-%d') = #{day}
- </if>
- <if test="startDate != null and endDate != null">
- AND A.alert_time BETWEEN #{startDate} and #{endDate}
- </if>
- <if test="alertTime != null">
- AND DATE_FORMAT(A.alert_time,'%Y-%m-%d') = #{alertTime}
- </if>
- <if test="year != null">
- AND YEAR(A.alert_time) = #{year}
- </if>
- <if test="month != null">
- AND MONTH(A.alert_time) = #{month}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND B.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND B.node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- ORDER BY A.alert_time DESC
- </select>
- <select id="getAlertByRiskPointId" resultType="com.zhyc.xps.aqpt.dto.AlertDto">
- select A.alert_id
- FROM alert AS A
- where A.deleted_flag=0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="riskPointId !=null">
- AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- </if>
- <if test="alertSource !=null">
- AND A.alert_source = #{alertSource ,jdbcType=BIGINT}
- </if>
- LIMIT 1
- </select>
- <!--Create-->
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.Alert">
- INSERT INTO alert
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="alertId != null">
- alert_id,
- </if>
- <if test="alertTypeId != null">
- alert_type_id,
- </if>
- <if test="alertTitle != null and alertTitle!=''">
- alert_title,
- </if>
- <if test="alertDesc != null and alertDesc != ''">
- alert_desc,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="alertLevel != null">
- alert_level,
- </if>
- <if test="alertCode != null and alertCode != ''">
- alert_code,
- </if>
- <if test="alertTime != null">
- alert_time,
- </if>
- <if test="alertSource != null">
- alert_source,
- </if>
- <if test="riskPointId != null">
- risk_point_id,
- </if>
- <if test="handleTime != null">
- handle_time,
- </if>
- <if test="handleAct != null">
- handle_act,
- </if>
- <if test="alertReason != null">
- alert_reason,
- </if>
- <if test="handleMeasure != null">
- handle_measure,
- </if>
- <if test="handleGroupId != null">
- handle_group_id,
- </if>
- <if test="handlePositionId != null">
- handle_position_id,
- </if>
- <if test="handleAccountId != null">
- handle_account_id,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="alertId != null">
- #{alertId ,jdbcType=BIGINT},
- </if>
- <if test="alertTypeId != null">
- #{alertTypeId ,jdbcType=BIGINT},
- </if>
- <if test="alertTitle != null and alertTitle!=''">
- #{alertTitle ,jdbcType=VARCHAR},
- </if>
- <if test="alertDesc != null and alertDesc != ''">
- #{alertDesc ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status ,jdbcType=BIGINT},
- </if>
- <if test="alertLevel != null">
- #{alertLevel ,jdbcType=BIGINT},
- </if>
- <if test="alertCode != null and alertCode != ''">
- #{alertCode ,jdbcType=VARCHAR},
- </if>
- <if test="alertTime != null">
- #{alertTime ,jdbcType=TIMESTAMP},
- </if>
- <if test="alertSource != null">
- #{alertSource ,jdbcType=BIGINT},
- </if>
- <if test="riskPointId != null">
- #{riskPointId ,jdbcType=BIGINT},
- </if>
- <if test="handleTime != null">
- #{handleTime ,jdbcType=TIMESTAMP},
- </if>
- <if test="handleAct != null">
- #{handleAct ,jdbcType=BIGINT},
- </if>
- <if test="alertReason != null">
- #{alertReason ,jdbcType=VARCHAR},
- </if>
- <if test="handleMeasure != null">
- #{handleMeasure ,jdbcType=VARCHAR},
- </if>
- <if test="handleGroupId != null">
- #{handleGroupId ,jdbcType=BIGINT},
- </if>
- <if test="handlePositionId != null">
- #{handlePositionId ,jdbcType=BIGINT},
- </if>
- <if test="handleAccountId != null">
- #{handleAccountId ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.aqpt.entity.Alert">
- UPDATE alert
- <trim suffixOverrides=",">
- <set>
- <if test="alertTypeId != null">
- alert_type_id = #{alertTypeId ,jdbcType=BIGINT},
- </if>
- <if test="alertTitle != null">
- alert_title =#{alertTitle ,jdbcType=VARCHAR},
- </if>
- <if test="alertDesc != null and alertDesc != ''">
- alert_desc = #{alertDesc ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status ,jdbcType=BIGINT},
- </if>
- <if test="alertLevel != null">
- alert_level = #{alertLevel ,jdbcType=BIGINT},
- </if>
- <if test="alertCode != null and alertCode != ''">
- alert_code = #{alertCode ,jdbcType=VARCHAR},
- </if>
- <if test="alertTime != null">
- alert_time = #{alertTime ,jdbcType=TIMESTAMP},
- </if>
- <if test="alertSource != null">
- alert_source = #{alertSource ,jdbcType=BIGINT},
- </if>
- <if test="riskPointId != null">
- risk_point_id = #{riskPointId ,jdbcType=BIGINT},
- </if>
- <if test="handleTime != null">
- handle_time = #{handleTime ,jdbcType=TIMESTAMP},
- </if>
- <if test="handleAct != null">
- handle_act = #{handleAct ,jdbcType=BIGINT},
- </if>
- <if test="alertReason != null">
- handle_reason = #{alertReason ,jdbcType=VARCHAR},
- </if>
- <if test="handleMeasure != null">
- handle_measure = #{handleMeasure ,jdbcType=VARCHAR},
- </if>
- <if test="handleGroupId != null">
- handle_group_id = #{handleGroupId ,jdbcType=BIGINT},
- </if>
- <if test="handlePositionId != null">
- handle_position_id = #{handlePositionId ,jdbcType=BIGINT},
- </if>
- <if test="handleAccountId != null">
- handle_account_id = #{handleAccountId ,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE oc_id = #{ocId ,jdbcType=BIGINT} AND alert_id = #{alertId, jdbcType=BIGINT}
- </update>
- <!--删除 -->
- <update id="delete" parameterType="java.util.Map">
- UPDATE alert
- <trim suffixOverrides=",">
- <set>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy ,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE oc_id = #{ocId ,jdbcType=BIGINT} AND deleted_flag = 0
- <if test="alertId != null ">
- AND alert_id = #{alertId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|