songhuangfeng123
2022-08-18 233fb69fa9d1694e97337d74fa3da72cacda04c1
emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanInfoMapper.xml
@@ -11,12 +11,25 @@
        <result column="type" property="type"/>
        <result column="level" property="level"/>
        <result column="release_date" property="releaseDate"/>
        <result column="author_name" property="authorName"/>
    </resultMap>
    <select id="selectEmergencyPlanList" resultMap="emergencyPlanInfoPageDOResult">
        select id,`name`,`status`,`type`,`level`,release_date from emergency_plan where del_flag = 0
        <if test="query.name != null  and query.name != ''">and `name` like concat('%', #{query.name}, '%')</if>
        <if test="query.type != null  and query.type != ''">and `type` = #{query.type}</if>
        SELECT
        a.id,
        a.`name`,
        a.`status`,
        a.`type`,
        a.`level`,
        a.release_date,
        a.author_name
        FROM
        emergency_plan a
        WHERE
        a.del_flag = 0
        AND a.abolish_status = #{query.abolishStatus}
        <if test="query.name != null  and query.name != ''">and a.name like concat('%', #{query.name}, '%')</if>
        <if test="query.type != null  and query.type != ''">and a.type = #{query.type}</if>
    </select>
    <insert id="addEmergencyPlan" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanInfo"
@@ -30,8 +43,10 @@
            <if test="createUid != null ">create_uid,</if>
            <if test="updateUid != null ">update_uid,</if>
            <if test="status != null ">status,</if>
            <if test="abolishStatus != null ">abolish_status,</if>
            <if test="releaseDate != null ">release_date,</if>
            <if test="authorUid != null ">author_uid,</if>
            <if test="authorName != null and authorName != ''">`author_name`,</if>
            <if test="authorDeptId != null ">author_dept_id,</if>
            <if test="associatedDanger != null ">associated_danger,</if>
            <if test="type != null and type != ''">`type`,</if>
@@ -46,8 +61,10 @@
            <if test="createUid != null ">#{createUid},</if>
            <if test="updateUid != null ">#{updateUid},</if>
            <if test="status != null ">#{status},</if>
            <if test="abolishStatus != null ">#{abolishStatus},</if>
            <if test="releaseDate != null ">#{releaseDate},</if>
            <if test="authorUid != null ">#{authorUid},</if>
            <if test="authorName != null and authorName != ''">#{authorName},</if>
            <if test="authorDeptId != null ">#{authorDeptId},</if>
            <if test="associatedDanger!= null ">#{associatedDanger},</if>
            <if test="type != null and type != ''">#{type},</if>
@@ -65,25 +82,26 @@
        <result column="level" property="level"/>
        <result column="release_date" property="releaseDate"/>
        <result column="author_uid" property="authorUid"/>
        <result column="author_name" property="authorName"/>
        <result column="author_dept_id" property="authorDeptId"/>
        <result column="associated_danger" property="associatedDanger"/>
    </resultMap>
    <select id="selectEmergencyPlanById" resultMap="emergencyPlanInfoDetailDOResult">
        select id ,`name`,`status`,`type`,`level`,release_date ,author_uid ,author_dept_id ,associated_danger from emergency_plan
        select id ,`name`,`status`,`type`,`level`,release_date ,author_uid ,author_dept_id ,associated_danger,author_name from emergency_plan
        where del_flag = 0 and id = #{id}
    </select>
    <update id="updateEmergencyPlan" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanInfo">
        update emergency_plan
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtCreate != null ">gmt_create = #{gmtCreate},</if>
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
            <if test="createUid != null ">create_uid = #{createUid},</if>
            <if test="updateUid != null ">update_uid = #{updateUid},</if>
            <if test="status != null ">status = #{status},</if>
            <if test="abolishStatus != null ">abolish_status = #{abolishStatus},</if>
            <if test="releaseDate != null ">release_date = #{releaseDate},</if>
            <if test="authorUid != null ">author_uid = #{authorUid},</if>
            <if test="authorName != null and authorName != ''">author_name =#{authorName},</if>
            <if test="authorDeptId != null ">author_dept_id = #{authorDeptId},</if>
            <if test="associatedDanger != null ">associated_danger = #{associatedDanger},</if>
            <if test="type != null and type != ''">type = #{type},</if>
@@ -96,4 +114,7 @@
    <update id="deleteEmergencyPlan">
        update emergency_plan set del_flag = 1 where id = #{id}
    </update>
    <update id="updateAbolish">
        update emergency_plan set abolish_status = #{abolishStatus} where id = #{id}
    </update>
</mapper>