<?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.warehouseBusiness.mapper.TWarehousebillsLogMapper">
    
    <resultMap type="TWarehousebillsLog" id="TWarehousebillsLogResult">
        <result property="fId"    column="f_id"    />
        <result property="fPid"    column="f_pid"    />
        <result property="fItmeid"    column="f_itmeid"    />
        <result property="fItmestatus"    column="f_itmestatus"    />
        <result property="fBillstatus"    column="f_billstatus"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTWarehousebillsLogVo">
        select f_id, f_pid, f_itmeid, f_itmestatus, f_billstatus, create_time, create_by, update_by, update_time, remark from t_warehousebills_log
    </sql>

    <select id="selectTWarehousebillsLogList" parameterType="TWarehousebillsLog" resultMap="TWarehousebillsLogResult">
        <include refid="selectTWarehousebillsLogVo"/>
        <where>  
            <if test="fPid != null "> and f_pid = #{fPid}</if>
            <if test="fItmeid != null "> and f_itmeid = #{fItmeid}</if>
            <if test="fItmestatus != null "> and f_itmestatus = #{fItmestatus}</if>
            <if test="fBillstatus != null  and fBillstatus != ''"> and f_billstatus = #{fBillstatus}</if>
        </where>
    </select>
    
    <select id="selectTWarehousebillsLogById" parameterType="Long" resultMap="TWarehousebillsLogResult">
        <include refid="selectTWarehousebillsLogVo"/>
        where f_id = #{fId}
    </select>
        
    <insert id="insertTWarehousebillsLog" parameterType="TWarehousebillsLog" useGeneratedKeys="true" keyProperty="fId">
        insert into t_warehousebills_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fPid != null">f_pid,</if>
            <if test="fItmeid != null">f_itmeid,</if>
            <if test="fItmestatus != null">f_itmestatus,</if>
            <if test="fBillstatus != null">f_billstatus,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fPid != null">#{fPid},</if>
            <if test="fItmeid != null">#{fItmeid},</if>
            <if test="fItmestatus != null">#{fItmestatus},</if>
            <if test="fBillstatus != null">#{fBillstatus},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTWarehousebillsLog" parameterType="TWarehousebillsLog">
        update t_warehousebills_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="fPid != null">f_pid = #{fPid},</if>
            <if test="fItmeid != null">f_itmeid = #{fItmeid},</if>
            <if test="fItmestatus != null">f_itmestatus = #{fItmestatus},</if>
            <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <delete id="deleteTWarehousebillsLogById" parameterType="Long">
        delete from t_warehousebills_log where f_id = #{fId}
    </delete>

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