<?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.TWarehousebillsCntrLoggerMapper">
    
    <resultMap type="TWarehousebillsCntrLogger" id="TWarehousebillsCntrLoggerResult">
        <result property="fId"    column="f_id"    />
        <result property="fPid"    column="f_pid"    />
        <result property="fGoodsid"    column="f_goodsid"    />
        <result property="fPackageid"    column="f_packageid"    />
        <result property="fCntrid"    column="f_cntrid"    />
        <result property="fCntrcount"    column="f_cntrcount"    />
        <result property="fCntrweight"    column="f_cntrweight"    />
        <result property="fCntrstatus"    column="f_cntrstatus"    />
        <result property="fSoc"    column="f_soc"    />
        <result property="fTemperature"    column="f_temperature"    />
        <result property="fDraught"    column="f_Draught"    />
        <result property="fHumidity"    column="f_Humidity"    />
        <result property="fPrecooling"    column="f_precooling"    />
        <result property="fPlantakecntr"    column="f_plantakecntr"    />
        <result property="fIfdanger"    column="f_IFDANGER"    />
        <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="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTWarehousebillsCntrLoggerVo">
        select f_id, f_pid, f_goodsid, f_packageid, f_cntrid, f_cntrcount, f_cntrweight, f_cntrstatus, f_soc, f_temperature, f_Draught, f_Humidity, f_precooling, f_plantakecntr, f_IFDANGER, create_by, create_time, update_by, update_time, remark from t_warehousebills_cntr_logger
    </sql>

    <select id="selectTWarehousebillsCntrLoggerList" parameterType="TWarehousebillsCntrLogger" resultMap="TWarehousebillsCntrLoggerResult">
        <include refid="selectTWarehousebillsCntrLoggerVo"/>
        <where>  
            <if test="fPid != null "> and f_pid = #{fPid}</if>
            <if test="fGoodsid != null "> and f_goodsid = #{fGoodsid}</if>
            <if test="fPackageid != null  and fPackageid != ''"> and f_packageid = #{fPackageid}</if>
            <if test="fCntrid != null "> and f_cntrid = #{fCntrid}</if>
            <if test="fCntrcount != null "> and f_cntrcount = #{fCntrcount}</if>
            <if test="fCntrweight != null "> and f_cntrweight = #{fCntrweight}</if>
            <if test="fCntrstatus != null  and fCntrstatus != ''"> and f_cntrstatus = #{fCntrstatus}</if>
            <if test="fSoc != null  and fSoc != ''"> and f_soc = #{fSoc}</if>
            <if test="fTemperature != null  and fTemperature != ''"> and f_temperature = #{fTemperature}</if>
            <if test="fDraught != null  and fDraught != ''"> and f_Draught = #{fDraught}</if>
            <if test="fHumidity != null  and fHumidity != ''"> and f_Humidity = #{fHumidity}</if>
            <if test="fPrecooling != null  and fPrecooling != ''"> and f_precooling = #{fPrecooling}</if>
            <if test="fPlantakecntr != null "> and f_plantakecntr = #{fPlantakecntr}</if>
            <if test="fIfdanger != null  and fIfdanger != ''"> and f_IFDANGER = #{fIfdanger}</if>
        </where>
    </select>
    
    <select id="selectTWarehousebillsCntrLoggerById" parameterType="Long" resultMap="TWarehousebillsCntrLoggerResult">
        <include refid="selectTWarehousebillsCntrLoggerVo"/>
        where f_id = #{fId}
    </select>
        
    <insert id="insertTWarehousebillsCntrLogger" parameterType="TWarehousebillsCntrLogger" useGeneratedKeys="true" keyProperty="fId">
        insert into t_warehousebills_cntr_logger
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fPid != null">f_pid,</if>
            <if test="fGoodsid != null">f_goodsid,</if>
            <if test="fPackageid != null and fPackageid != ''">f_packageid,</if>
            <if test="fCntrid != null">f_cntrid,</if>
            <if test="fCntrcount != null">f_cntrcount,</if>
            <if test="fCntrweight != null">f_cntrweight,</if>
            <if test="fCntrstatus != null">f_cntrstatus,</if>
            <if test="fSoc != null">f_soc,</if>
            <if test="fTemperature != null">f_temperature,</if>
            <if test="fDraught != null">f_Draught,</if>
            <if test="fHumidity != null">f_Humidity,</if>
            <if test="fPrecooling != null">f_precooling,</if>
            <if test="fPlantakecntr != null">f_plantakecntr,</if>
            <if test="fIfdanger != null">f_IFDANGER,</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="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fPid != null">#{fPid},</if>
            <if test="fGoodsid != null">#{fGoodsid},</if>
            <if test="fPackageid != null and fPackageid != ''">#{fPackageid},</if>
            <if test="fCntrid != null">#{fCntrid},</if>
            <if test="fCntrcount != null">#{fCntrcount},</if>
            <if test="fCntrweight != null">#{fCntrweight},</if>
            <if test="fCntrstatus != null">#{fCntrstatus},</if>
            <if test="fSoc != null">#{fSoc},</if>
            <if test="fTemperature != null">#{fTemperature},</if>
            <if test="fDraught != null">#{fDraught},</if>
            <if test="fHumidity != null">#{fHumidity},</if>
            <if test="fPrecooling != null">#{fPrecooling},</if>
            <if test="fPlantakecntr != null">#{fPlantakecntr},</if>
            <if test="fIfdanger != null">#{fIfdanger},</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="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTWarehousebillsCntrLogger" parameterType="TWarehousebillsCntrLogger">
        update t_warehousebills_cntr_logger
        <trim prefix="SET" suffixOverrides=",">
            <if test="fPid != null">f_pid = #{fPid},</if>
            <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
            <if test="fPackageid != null and fPackageid != ''">f_packageid = #{fPackageid},</if>
            <if test="fCntrid != null">f_cntrid = #{fCntrid},</if>
            <if test="fCntrcount != null">f_cntrcount = #{fCntrcount},</if>
            <if test="fCntrweight != null">f_cntrweight = #{fCntrweight},</if>
            <if test="fCntrstatus != null">f_cntrstatus = #{fCntrstatus},</if>
            <if test="fSoc != null">f_soc = #{fSoc},</if>
            <if test="fTemperature != null">f_temperature = #{fTemperature},</if>
            <if test="fDraught != null">f_Draught = #{fDraught},</if>
            <if test="fHumidity != null">f_Humidity = #{fHumidity},</if>
            <if test="fPrecooling != null">f_precooling = #{fPrecooling},</if>
            <if test="fPlantakecntr != null">f_plantakecntr = #{fPlantakecntr},</if>
            <if test="fIfdanger != null">f_IFDANGER = #{fIfdanger},</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="remark != null">remark = #{remark},</if>
        </trim>
        where f_id = #{fId}
    </update>

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

    <delete id="deleteTWarehousebillsCntrLoggerByIds" parameterType="String">
        delete from t_warehousebills_cntr_logger where f_id in 
        <foreach item="fId" collection="array" open="(" separator="," close=")">
            #{fId}
        </foreach>
    </delete>
    <insert id="copyTwarehousebillsCntr" parameterType="Long">
        insert into t_warehousebills_cntr_logger
        SELECT
            tc.f_id,
            tc.f_pid,
            tc.f_goodsid,
            tc.f_packageid,
            tc.f_cntrid,
            tc.f_cntrcount,
            tc.f_cntrweight,
            tc.f_cntrstatus,
            tc.f_soc,
            tc.f_temperature,
            tc.f_Draught,
            tc.f_Humidity,
            tc.f_precooling,
            tc.f_plantakecntr,
            tc.f_IFDANGER,
            tc.create_by,
            tc.create_time,
            tc.update_by,
            tc.update_time,
            tc.remark
        FROM
            t_warehousebills_cntr tc
        WHERE tc.f_pid = #{fId}
    </insert>
    
</mapper>