HandleAffairsXfMapper.xml 4.87 KB
<?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.trash.office.mapper.HandleAffairsXfMapper">
    
    <resultMap type="HandleAffairsXf" id="HandleAffairsXfResult">
        <result property="id"    column="id"    />
        <result property="company"    column="company"    />
        <result property="receiveDate"    column="receive_date"    />
        <result property="appeal"    column="appeal"    />
        <result property="deptOpinion"    column="dept_opinion"    />
        <result property="zhbOpinion"    column="zhb_opinion"    />
        <result property="isRead"    column="is_read"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectHandleAffairsXfVo">
        select id, company, receive_date, appeal, dept_opinion, zhb_opinion, is_read, status, create_time, create_by, update_time, update_by from office_handle_affairs_xf
    </sql>

    <select id="selectHandleAffairsXfList" parameterType="HandleAffairsXf" resultMap="HandleAffairsXfResult">
        <include refid="selectHandleAffairsXfVo"/>
        <where>  
            <if test="company != null  and company != ''"> and company = #{company}</if>
            <if test="receiveDate != null "> and receive_date = #{receiveDate}</if>
            <if test="appeal != null  and appeal != ''"> and appeal = #{appeal}</if>
            <if test="deptOpinion != null  and deptOpinion != ''"> and dept_opinion = #{deptOpinion}</if>
            <if test="zhbOpinion != null  and zhbOpinion != ''"> and zhb_opinion = #{zhbOpinion}</if>
            <if test="isRead != null "> and is_read = #{isRead}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectHandleAffairsXfById" parameterType="Long" resultMap="HandleAffairsXfResult">
        <include refid="selectHandleAffairsXfVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertHandleAffairsXf" parameterType="HandleAffairsXf" useGeneratedKeys="true" keyProperty="id">
        insert into office_handle_affairs_xf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            create_time,
            <if test="company != null">company,</if>
            <if test="receiveDate != null">receive_date,</if>
            <if test="appeal != null">appeal,</if>
            <if test="deptOpinion != null">dept_opinion,</if>
            <if test="zhbOpinion != null">zhb_opinion,</if>
            <if test="isRead != null">is_read,</if>
            <if test="status != null">status,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            now(),
            <if test="company != null">#{company},</if>
            <if test="receiveDate != null">#{receiveDate},</if>
            <if test="appeal != null">#{appeal},</if>
            <if test="deptOpinion != null">#{deptOpinion},</if>
            <if test="zhbOpinion != null">#{zhbOpinion},</if>
            <if test="isRead != null">#{isRead},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>

    <update id="updateHandleAffairsXf" parameterType="HandleAffairsXf">
        update office_handle_affairs_xf
        <trim prefix="SET" suffixOverrides=",">
            update_time = now(),
            <if test="company != null">company = #{company},</if>
            <if test="receiveDate != null">receive_date = #{receiveDate},</if>
            <if test="appeal != null">appeal = #{appeal},</if>
            <if test="deptOpinion != null">dept_opinion = #{deptOpinion},</if>
            <if test="zhbOpinion != null">zhb_opinion = #{zhbOpinion},</if>
            <if test="isRead != null">is_read = #{isRead},</if>
            <if test="status != null">status = #{status},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteHandleAffairsXfById" parameterType="Long">
        delete from office_handle_affairs_xf where id = #{id}
    </delete>

    <delete id="deleteHandleAffairsXfByIds" parameterType="String">
        delete from office_handle_affairs_xf where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>