heheng
2024-11-26 c9d2e60f7d1a5cfe9e5b2da93af4d9edeecf5577
expert-system/src/main/resources/mapper/system/ProjectFileMapper.xml
@@ -11,6 +11,7 @@
        <result property="filePath"    column="file_path"    />
        <result property="fileUrl"    column="file_url"    />
        <result property="fileName"    column="file_name"    />
        <result property="originalFileName" column="original_file_name"/>
        <result property="fileSuffix"    column="file_suffix"    />
        <result property="fileDesc"    column="file_desc"    />
        <result property="fileSize"    column="file_size"    />
@@ -23,12 +24,14 @@
    </resultMap>
    <sql id="selectProjectFileVo">
        select id, project_id, module, file_path, file_url, file_name, file_suffix, file_desc, file_size, file_type, del_flag, create_by, create_time, update_by, update_time from project_file
        select id, project_id, module, file_path, file_url, file_name, file_suffix, file_desc,
            original_file_name,file_size, file_type, del_flag, create_by, create_time, update_by, update_time from project_file
    </sql>
    <select id="selectProjectFileList" parameterType="ProjectFile" resultMap="ProjectFileResult">
        <include refid="selectProjectFileVo"/>
        <where>
        <where>
            and del_flag = 0
            <if test="projectId != null "> and project_id = #{projectId}</if>
            <if test="module != null  and module != ''"> and module = #{module}</if>
            <if test="filePath != null  and filePath != ''"> and file_path = #{filePath}</if>
@@ -54,6 +57,7 @@
            <if test="filePath != null">file_path,</if>
            <if test="fileUrl != null">file_url,</if>
            <if test="fileName != null">file_name,</if>
            <if test="originalFileName != null">original_file_name,</if>
            <if test="fileSuffix != null">file_suffix,</if>
            <if test="fileDesc != null">file_desc,</if>
            <if test="fileSize != null">file_size,</if>
@@ -70,6 +74,7 @@
            <if test="filePath != null">#{filePath},</if>
            <if test="fileUrl != null">#{fileUrl},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="originalFileName != null">#{originalFileName},</if>
            <if test="fileSuffix != null">#{fileSuffix},</if>
            <if test="fileDesc != null">#{fileDesc},</if>
            <if test="fileSize != null">#{fileSize},</if>
@@ -81,6 +86,32 @@
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
        <insert id="insertProjectFiles" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
            insert into project_file
                (project_id,module,file_path,file_url,file_name,file_suffix,file_desc,file_size,file_type,create_by)
            values
            <foreach collection="list" item="item" separator=",">
                <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="item.projectId != null">#{item.projectId},</if>
                    <if test="item.module != null and item.module != ''">#{item.module},</if>
                    <if test="item.filePath != null">#{item.filePath},</if>
                    <if test="item.fileUrl != null">#{item.fileUrl},</if>
                    <if test="item.fileName != null">#{item.fileName},</if>
                    <if test="item.fileSuffix != null">#{item.fileSuffix},</if>
                    <if test="item.fileDesc != null">#{item.fileDesc},</if>
                    <if test="item.fileSize != null">#{item.fileSize},</if>
                    <if test="item.fileType != null">#{item.fileType},</if>
                    <if test="item.createBy != null">#{item.createBy},</if>
                </trim>
            </foreach>
        </insert>
    <update id="updateProjectFile" parameterType="ProjectFile">
        update project_file
@@ -95,22 +126,24 @@
            <if test="fileSize != null">file_size = #{fileSize},</if>
            <if test="fileType != null">file_type = #{fileType},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</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>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteProjectFileById" parameterType="Long">
        delete from project_file where id = #{id}
    </delete>
    <update id="deleteProjectFileById" parameterType="Long">
        update project_file set del_flag = 1 where id = #{id}
    </update>
    <delete id="deleteProjectFileByIds" parameterType="String">
        delete from project_file where id in
    <update id="deleteProjectFileByIdAndType" >
        update project_file set del_flag = 1 where project_id = #{projectId} and module = #{module}
    </update>
    <update id="deleteProjectFileByIds" parameterType="String">
        update project_file set del_flag = 1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    </update>
</mapper>