TEmergencyCrewMapper.xml 5.89 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
<?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.zehong.system.mapper.TEmergencyCrewMapper">

    <resultMap type="TEmergencyCrew" id="TEmergencyCrewResult">
        <result property="communicationId"    column="communication_id"    />
        <result property="personnelName"    column="personnel_name"    />
        <result property="postId"    column="post_id"    />
        <result property="post"    column="post"    />
        <result property="personnelDuty"    column="personnel_duty"    />
        <result property="personnelTelephoneNumber"    column="personnel_telephone_number"    />
        <result property="emergencyTeamId"    column="emergency_team_id"    />
        <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="isDel"    column="is_del"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>

    <sql id="selectTEmergencyCrewVo">
        select communication_id, personnel_name, post_id, personnel_duty, personnel_telephone_number, emergency_team_id, create_by, create_time, update_by, update_time, is_del, remarks from t_emergency_crew
    </sql>

    <select id="selectTEmergencyCrewList" parameterType="TEmergencyCrew" resultMap="TEmergencyCrewResult">
        select a.*,b.post_name as post from t_emergency_crew a left join sys_post b on a.post_id=b.post_id
        <where>
            a.is_del='0'
            <if test="personnelName != null  and personnelName != ''"> and personnel_name like concat('%', #{personnelName}, '%')</if>
            <if test="postId != null "> and post_id = #{postId}</if>
            <if test="personnelDuty != null  and personnelDuty != ''"> and personnel_duty = #{personnelDuty}</if>
            <if test="personnelTelephoneNumber != null  and personnelTelephoneNumber != ''"> and personnel_telephone_number = #{personnelTelephoneNumber}</if>
            <if test="emergencyTeamId != null "> and emergency_team_id = #{emergencyTeamId}</if>
            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        </where>
        group by a.communication_id desc
    </select>

    <select id="selectTEmergencyCrewById" parameterType="Long" resultMap="TEmergencyCrewResult">
        <include refid="selectTEmergencyCrewVo"/>
        where communication_id = #{communicationId}
    </select>

    <insert id="insertTEmergencyCrew" parameterType="TEmergencyCrew" useGeneratedKeys="true" keyProperty="communicationId">
        insert into t_emergency_crew
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="personnelName != null">personnel_name,</if>
            <if test="postId != null">post_id,</if>
            <if test="personnelDuty != null">personnel_duty,</if>
            <if test="personnelTelephoneNumber != null">personnel_telephone_number,</if>
            <if test="emergencyTeamId != null">emergency_team_id,</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="isDel != null">is_del,</if>
            <if test="remarks != null">remarks,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="personnelName != null">#{personnelName},</if>
            <if test="postId != null">#{postId},</if>
            <if test="personnelDuty != null">#{personnelDuty},</if>
            <if test="personnelTelephoneNumber != null">#{personnelTelephoneNumber},</if>
            <if test="emergencyTeamId != null">#{emergencyTeamId},</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="isDel != null">#{isDel},</if>
            <if test="remarks != null">#{remarks},</if>
         </trim>
    </insert>

    <update id="updateTEmergencyCrew" parameterType="TEmergencyCrew">
        update t_emergency_crew
        <trim prefix="SET" suffixOverrides=",">
            <if test="personnelName != null">personnel_name = #{personnelName},</if>
            <if test="postId != null">post_id = #{postId},</if>
            <if test="personnelDuty != null">personnel_duty = #{personnelDuty},</if>
            <if test="personnelTelephoneNumber != null">personnel_telephone_number = #{personnelTelephoneNumber},</if>
            <if test="emergencyTeamId != null">emergency_team_id = #{emergencyTeamId},</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="isDel != null">is_del = #{isDel},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where communication_id = #{communicationId}
    </update>

    <update id="deleteTEmergencyCrewById" parameterType="Long">
        update  t_emergency_crew  set is_del='1' where communication_id = #{communicationId}
    </update>

    <update id="deleteTEmergencyCrewByIds" parameterType="String">
        update  t_emergency_crew set is_del='1'  where communication_id in
        <foreach item="communicationId" collection="array" open="(" separator="," close=")">
            #{communicationId}
        </foreach>
    </update>
</mapper>