<?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.warehouse.check.mapper.TWarehouseCheckItemsDetailsMapper">

    <resultMap type="TWarehouseCheckItemsDetails" id="TWarehouseCheckItemsDetailsResult">
        <result property="fId" column="f_id"/>
        <result property="fCheckFid" column="f_check_fid"/>
        <result property="fItemFid" column="f_item_fid"/>
        <result property="fPhotoUrl" column="f_photo_url"/>
        <result property="fRemark" column="f_remark"/>
        <result property="fCreateBy" column="f_create_by"/>
        <result property="fCreateTime" column="f_create_time"/>
        <result property="fUpdateBy" column="f_update_by"/>
        <result property="fUpdateTime" column="f_update_time"/>
        <result property="fDelFlag" column="f_del_flag"/>
    </resultMap>

    <sql id="selectTWarehouseCheckItemsDetailsVo">
        select f_id,
               f_check_fid,
               f_item_fid,
               f_photo_url,
               f_remark,
               f_create_by,
               f_create_time,
               f_update_by,
               f_update_time,
               f_del_flag
        from t_warehouse_check_items_details
    </sql>

    <select id="selectTWarehouseCheckItemsDetailsList" parameterType="TWarehouseCheckItemsDetails"
            resultMap="TWarehouseCheckItemsDetailsResult">
        <include refid="selectTWarehouseCheckItemsDetailsVo"/>
        <where>
            <if test="fCheckFid != null ">and f_check_fid = #{fCheckFid}</if>
            <if test="fItemFid != null ">and f_item_fid = #{fItemFid}</if>
            <if test="fPhotoUrl != null  and fPhotoUrl != ''">and f_photo_url = #{fPhotoUrl}</if>
            <if test="fRemark != null  and fRemark != ''">and f_remark = #{fRemark}</if>
            <if test="fCreateBy != null ">and f_create_by = #{fCreateBy}</if>
            <if test="fCreateTime != null ">and f_create_time = #{fCreateTime}</if>
            <if test="fUpdateBy != null ">and f_update_by = #{fUpdateBy}</if>
            <if test="fUpdateTime != null ">and f_update_time = #{fUpdateTime}</if>
            <if test="fDelFlag != null ">and f_del_flag = #{fDelFlag}</if>
        </where>
    </select>

    <select id="selectTWarehouseCheckItemsDetailsById" parameterType="Long"
            resultMap="TWarehouseCheckItemsDetailsResult">
        <include refid="selectTWarehouseCheckItemsDetailsVo"/>
        where f_id = #{fId}
    </select>

    <insert id="insertTWarehouseCheckItemsDetails" parameterType="TWarehouseCheckItemsDetails" useGeneratedKeys="true"
            keyProperty="fId">
        insert into t_warehouse_check_items_details
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fCheckFid != null">f_check_fid,</if>
            <if test="fItemFid != null">f_item_fid,</if>
            <if test="fPhotoUrl != null and fPhotoUrl != ''">f_photo_url,</if>
            <if test="fRemark != null">f_remark,</if>
            <if test="fCreateBy != null">f_create_by,</if>
            <if test="fCreateTime != null">f_create_time,</if>
            <if test="fUpdateBy != null">f_update_by,</if>
            <if test="fUpdateTime != null">f_update_time,</if>
            <if test="fDelFlag != null">f_del_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fCheckFid != null">#{fCheckFid},</if>
            <if test="fItemFid != null">#{fItemFid},</if>
            <if test="fPhotoUrl != null and fPhotoUrl != ''">#{fPhotoUrl},</if>
            <if test="fRemark != null">#{fRemark},</if>
            <if test="fCreateBy != null">#{fCreateBy},</if>
            <if test="fCreateTime != null">#{fCreateTime},</if>
            <if test="fUpdateBy != null">#{fUpdateBy},</if>
            <if test="fUpdateTime != null">#{fUpdateTime},</if>
            <if test="fDelFlag != null">#{fDelFlag},</if>
        </trim>
    </insert>

    <update id="updateTWarehouseCheckItemsDetails" parameterType="TWarehouseCheckItemsDetails">
        update t_warehouse_check_items_details
        <trim prefix="SET" suffixOverrides=",">
            <if test="fCheckFid != null">f_check_fid = #{fCheckFid},</if>
            <if test="fItemFid != null">f_item_fid = #{fItemFid},</if>
            <if test="fPhotoUrl != null and fPhotoUrl != ''">f_photo_url = #{fPhotoUrl},</if>
            <if test="fRemark != null">f_remark = #{fRemark},</if>
            <if test="fCreateBy != null">f_create_by = #{fCreateBy},</if>
            <if test="fCreateTime != null">f_create_time = #{fCreateTime},</if>
            <if test="fUpdateBy != null">f_update_by = #{fUpdateBy},</if>
            <if test="fUpdateTime != null">f_update_time = #{fUpdateTime},</if>
            <if test="fDelFlag != null">f_del_flag = #{fDelFlag},</if>
        </trim>
        where f_id = #{fId}
    </update>

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

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

</mapper>