<?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.ruoyi.project.plant.mapper.TStaffmgrRecordMapper">

    <resultMap type="TStaffmgrRecord" id="TStaffmgrRecordResult">
        <result property="recordId"    column="record_id"    />
        <result property="staffmgrId"    column="staffmgr_id"    />
        <result property="type"    column="type"    />
        <result property="actionDate"    column="action_date"    />
        <result property="content"    column="content"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createrCode"    column="creater_code"    />
        <result property="createdate"    column="createdate"    />
        <result property="updaterCode"    column="updater_code"    />
        <result property="updatedate"    column="updatedate"    />
        <result property="deptId"    column="dept_id"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>

    <sql id="selectTStaffmgrRecordVo">
        select record_id, staffmgr_id, type, action_date, content, del_flag, creater_code, createdate, updater_code, updatedate, dept_id, remarks from t_staffmgr_record
    </sql>

    <select id="selectTStaffmgrRecordList" parameterType="TStaffmgrRecord" resultMap="TStaffmgrRecordResult">
        <include refid="selectTStaffmgrRecordVo"/>
        <where>
            <if test="staffmgrId != null "> and staffmgr_id = #{staffmgrId}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="actionDate != null "> and action_date = #{actionDate}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
            <if test="createdate != null "> and createdate = #{createdate}</if>
            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        and del_flag = 0
        </where>
    </select>

    <select id="selectTStaffmgrRecordByRecordId" parameterType="Long" resultMap="TStaffmgrRecordResult">
    </select>

    <insert id="insertTStaffmgrRecord" parameterType="TStaffmgrRecord" useGeneratedKeys="true" keyProperty="recordId">
        insert into t_staffmgr_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="staffmgrId != null">staffmgr_id,</if>
            <if test="type != null and type != ''">type,</if>
            <if test="actionDate != null">action_date,</if>
            <if test="content != null and content != ''">content,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createrCode != null">creater_code,</if>
            <if test="createdate != null">createdate,</if>
            <if test="updaterCode != null">updater_code,</if>
            <if test="updatedate != null">updatedate,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="remarks != null">remarks,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="staffmgrId != null">#{staffmgrId},</if>
            <if test="type != null and type != ''">#{type},</if>
            <if test="actionDate != null">#{actionDate},</if>
            <if test="content != null and content != ''">#{content},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createrCode != null">#{createrCode},</if>
            <if test="createdate != null">#{createdate},</if>
            <if test="updaterCode != null">#{updaterCode},</if>
            <if test="updatedate != null">#{updatedate},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="remarks != null">#{remarks},</if>
         </trim>
    </insert>

    <update id="updateTStaffmgrRecord" parameterType="TStaffmgrRecord">
        update t_staffmgr_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="staffmgrId != null">staffmgr_id = #{staffmgrId},</if>
            <if test="type != null and type != ''">type = #{type},</if>
            <if test="actionDate != null">action_date = #{actionDate},</if>
            <if test="content != null and content != ''">content = #{content},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createrCode != null">creater_code = #{createrCode},</if>
            <if test="createdate != null">createdate = #{createdate},</if>
            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
            <if test="updatedate != null">updatedate = #{updatedate},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where record_id = #{recordId}
    </update>

    <delete id="deleteTStaffmgrRecordByRecordId" parameterType="Long">
        update t_staffmgr_record set del_flag=1 where record_id = #{recordId}
    </delete>

    <delete id="deleteTStaffmgrRecordByRecordIds" parameterType="String">
        update t_staffmgr_record set del_flag=1 where record_id in
        <foreach item="recordId" collection="array" open="(" separator="," close=")">
            #{recordId}
        </foreach>
    </delete>
</mapper>
