<?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.system.mapper.TdFileProvideMapper">

    <resultMap type="TdFileProvide" id="TdFileProvideResult">
        <result property="fileId"    column="file_id"    />
        <result property="provideCount"    column="provide_count"    />
        <result property="provideDepart"    column="provide_depart"    />
        <result property="provideUserid"    column="provide_userid"    />
        <result property="provideDate"    column="provide_date"    />
        <result property="targetDepart"    column="target_depart"    />
        <result property="provideLevel"    column="provide_level"    />
        <result property="instancyExtent"    column="instancy_extent"    />
        <result property="allianceFile"    column="alliance_file"    />
        <result property="remark"    column="remark"    />
        <result property="updateDepart"    column="update_depart"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateDate"    column="update_date"    />
        <result property="frameworkId"    column="frameworkId"    />
        <result property="fileSecret"    column="file_secret"    />
        <result property="releaseSecretid"    column="release_secretid"    />
        <result property="fileName"    column="file_name"    />
        <result property="fileNum"    column="file_num"    />
        <result property="fileSecretyj"    column="file_secretyj"    />
        <result property="filePurpose"    column="file_purpose"    />
        <result property="fileCode"    column="file_code"    />
        <result property="receiveUser"    column="receive_user"    />
        <result property="receiveCount"    column="receive_count"    />
        <result property="operateId"    column="operate_id"    />
        <result property="areaid"    column="areaid"    />
    </resultMap>

    <sql id="selectTdFileProvideVo">
        select file_id, provide_count, provide_depart, provide_userid, provide_date, target_depart, provide_level, instancy_extent, alliance_file, remark, update_depart, update_user, update_date, frameworkId, file_secret, release_secretid, file_name, file_num, file_secretyj, file_purpose, file_code, receive_user, receive_count, operate_id, areaid from td_file_provide
    </sql>

    <select id="selectTdFileProvideList" parameterType="TdFileProvide" resultMap="TdFileProvideResult">
        <include refid="selectTdFileProvideVo"/>
        <where>
            <if test="fileId != null  and fileId != ''"> and file_id = #{fileId}</if>
            <if test="provideCount != null "> and provide_count = #{provideCount}</if>
            <if test="provideDepart != null  and provideDepart != ''"> and provide_depart = #{provideDepart}</if>
            <if test="provideUserid != null  and provideUserid != ''"> and provide_userid = #{provideUserid}</if>
            <if test="provideDate != null "> and provide_date = #{provideDate}</if>
            <if test="targetDepart != null  and targetDepart != ''"> and target_depart = #{targetDepart}</if>
            <if test="provideLevel != null  and provideLevel != ''"> and provide_level = #{provideLevel}</if>
            <if test="instancyExtent != null  and instancyExtent != ''"> and instancy_extent = #{instancyExtent}</if>
            <if test="allianceFile != null  and allianceFile != ''"> and alliance_file = #{allianceFile}</if>
            <if test="updateDepart != null  and updateDepart != ''"> and update_depart = #{updateDepart}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
            <if test="updateDate != null "> and update_date = #{updateDate}</if>
            <if test="frameworkId != null  and frameworkId != ''"> and frameworkId = #{frameworkId}</if>
            <if test="fileSecret != null  and fileSecret != ''"> and file_secret = #{fileSecret}</if>
            <if test="releaseSecretid != null  and releaseSecretid != ''"> and release_secretid = #{releaseSecretid}</if>
            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
            <if test="fileNum != null  and fileNum != ''"> and file_num = #{fileNum}</if>
            <if test="fileSecretyj != null  and fileSecretyj != ''"> and file_secretyj = #{fileSecretyj}</if>
            <if test="filePurpose != null  and filePurpose != ''"> and file_purpose = #{filePurpose}</if>
            <if test="fileCode != null  and fileCode != ''"> and file_code = #{fileCode}</if>
            <if test="receiveUser != null  and receiveUser != ''"> and receive_user = #{receiveUser}</if>
            <if test="receiveCount != null "> and receive_count = #{receiveCount}</if>
            <if test="operateId != null  and operateId != ''"> and operate_id = #{operateId}</if>
            <if test="areaid != null  and areaid != ''"> and areaid = #{areaid}</if>
        </where>
    </select>

    <select id="selectTdFileProvideByFileId" parameterType="String" resultMap="TdFileProvideResult">
        <include refid="selectTdFileProvideVo"/>
        where file_id = #{fileId}
    </select>

    <insert id="insertTdFileProvide" parameterType="TdFileProvide">
        insert into td_file_provide
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fileId != null">file_id,</if>
            <if test="provideCount != null">provide_count,</if>
            <if test="provideDepart != null">provide_depart,</if>
            <if test="provideUserid != null">provide_userid,</if>
            <if test="provideDate != null">provide_date,</if>
            <if test="targetDepart != null">target_depart,</if>
            <if test="provideLevel != null">provide_level,</if>
            <if test="instancyExtent != null">instancy_extent,</if>
            <if test="allianceFile != null">alliance_file,</if>
            <if test="remark != null">remark,</if>
            <if test="updateDepart != null">update_depart,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="updateDate != null">update_date,</if>
            <if test="frameworkId != null">frameworkId,</if>
            <if test="fileSecret != null">file_secret,</if>
            <if test="releaseSecretid != null">release_secretid,</if>
            <if test="fileName != null">file_name,</if>
            <if test="fileNum != null">file_num,</if>
            <if test="fileSecretyj != null">file_secretyj,</if>
            <if test="filePurpose != null">file_purpose,</if>
            <if test="fileCode != null">file_code,</if>
            <if test="receiveUser != null">receive_user,</if>
            <if test="receiveCount != null">receive_count,</if>
            <if test="operateId != null">operate_id,</if>
            <if test="areaid != null">areaid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fileId != null">#{fileId},</if>
            <if test="provideCount != null">#{provideCount},</if>
            <if test="provideDepart != null">#{provideDepart},</if>
            <if test="provideUserid != null">#{provideUserid},</if>
            <if test="provideDate != null">#{provideDate},</if>
            <if test="targetDepart != null">#{targetDepart},</if>
            <if test="provideLevel != null">#{provideLevel},</if>
            <if test="instancyExtent != null">#{instancyExtent},</if>
            <if test="allianceFile != null">#{allianceFile},</if>
            <if test="remark != null">#{remark},</if>
            <if test="updateDepart != null">#{updateDepart},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="updateDate != null">#{updateDate},</if>
            <if test="frameworkId != null">#{frameworkId},</if>
            <if test="fileSecret != null">#{fileSecret},</if>
            <if test="releaseSecretid != null">#{releaseSecretid},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="fileNum != null">#{fileNum},</if>
            <if test="fileSecretyj != null">#{fileSecretyj},</if>
            <if test="filePurpose != null">#{filePurpose},</if>
            <if test="fileCode != null">#{fileCode},</if>
            <if test="receiveUser != null">#{receiveUser},</if>
            <if test="receiveCount != null">#{receiveCount},</if>
            <if test="operateId != null">#{operateId},</if>
            <if test="areaid != null">#{areaid},</if>
        </trim>
    </insert>

    <update id="updateTdFileProvide" parameterType="TdFileProvide">
        update td_file_provide
        <trim prefix="SET" suffixOverrides=",">
            <if test="provideCount != null">provide_count = #{provideCount},</if>
            <if test="provideDepart != null">provide_depart = #{provideDepart},</if>
            <if test="provideUserid != null">provide_userid = #{provideUserid},</if>
            <if test="provideDate != null">provide_date = #{provideDate},</if>
            <if test="targetDepart != null">target_depart = #{targetDepart},</if>
            <if test="provideLevel != null">provide_level = #{provideLevel},</if>
            <if test="instancyExtent != null">instancy_extent = #{instancyExtent},</if>
            <if test="allianceFile != null">alliance_file = #{allianceFile},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="updateDepart != null">update_depart = #{updateDepart},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="updateDate != null">update_date = #{updateDate},</if>
            <if test="frameworkId != null">frameworkId = #{frameworkId},</if>
            <if test="fileSecret != null">file_secret = #{fileSecret},</if>
            <if test="releaseSecretid != null">release_secretid = #{releaseSecretid},</if>
            <if test="fileName != null">file_name = #{fileName},</if>
            <if test="fileNum != null">file_num = #{fileNum},</if>
            <if test="fileSecretyj != null">file_secretyj = #{fileSecretyj},</if>
            <if test="filePurpose != null">file_purpose = #{filePurpose},</if>
            <if test="fileCode != null">file_code = #{fileCode},</if>
            <if test="receiveUser != null">receive_user = #{receiveUser},</if>
            <if test="receiveCount != null">receive_count = #{receiveCount},</if>
            <if test="operateId != null">operate_id = #{operateId},</if>
            <if test="areaid != null">areaid = #{areaid},</if>
        </trim>
        where file_id = #{fileId}
    </update>

    <delete id="deleteTdFileProvideByFileId" parameterType="String">
        delete from td_file_provide where file_id = #{fileId}
    </delete>

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