<?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.tool.mapper.TUnifyFileMapper"> <resultMap type="TUnifyFile" id="TUnifyFileResult"> <result property="id" column="id" /> <result property="fileId" column="file_id" /> <result property="uploadName" column="upload_name" /> <result property="uploadType" column="upload_type" /> <result property="uploadPath" column="upload_path" /> <result property="uploadFormat" column="upload_format" /> <result property="newUploadName" column="new_upload_name" /> <result property="delFlag" column="del_flag" /> <result property="fileBusinessId" column="file_business_id" /> <result property="createBy" column="create_by" /> <result property="createTime" column="create_time" /> <result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time" /> </resultMap> <sql id="selectTUnifyFileVo"> select id, file_id, upload_name, upload_type, upload_path, upload_format, new_upload_name, del_flag, file_business_id, create_by, create_time, update_by, update_time from t_unify_file </sql> <select id="selectTUnifyFileList" parameterType="TUnifyFile" resultMap="TUnifyFileResult"> <include refid="selectTUnifyFileVo"/> <where> del_flag = 0 <if test="fileId != null and fileId != ''"> and file_id = #{fileId}</if> <if test="uploadName != null and uploadName != ''"> and upload_name like concat('%', #{uploadName}, '%')</if> <if test="uploadType != null and uploadType != ''"> and upload_type = #{uploadType}</if> <if test="uploadPath != null and uploadPath != ''"> and upload_path = #{uploadPath}</if> <if test="uploadFormat != null and uploadFormat != ''"> and upload_format = #{uploadFormat}</if> <if test="newUploadName != null and newUploadName != ''"> and new_upload_name like concat('%', #{newUploadName}, '%')</if> <if test="fileBusinessId != null and fileBusinessId != ''"> and file_business_id = #{fileBusinessId}</if> </where> </select> <select id="selectTUnifyFileById" parameterType="String" resultMap="TUnifyFileResult"> <include refid="selectTUnifyFileVo"/> where id = #{id} </select> <insert id="insertTUnifyFile" parameterType="TUnifyFile"> insert into t_unify_file <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="fileId != null">file_id,</if> <if test="uploadName != null">upload_name,</if> <if test="uploadType != null">upload_type,</if> <if test="uploadPath != null">upload_path,</if> <if test="uploadFormat != null">upload_format,</if> <if test="newUploadName != null">new_upload_name,</if> <if test="delFlag != null">del_flag,</if> <if test="fileBusinessId != null">file_business_id,</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> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> <if test="fileId != null">#{fileId},</if> <if test="uploadName != null">#{uploadName},</if> <if test="uploadType != null">#{uploadType},</if> <if test="uploadPath != null">#{uploadPath},</if> <if test="uploadFormat != null">#{uploadFormat},</if> <if test="newUploadName != null">#{newUploadName},</if> <if test="delFlag != null">#{delFlag},</if> <if test="fileBusinessId != null">#{fileBusinessId},</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> </trim> </insert> <update id="updateTUnifyFile" parameterType="TUnifyFile"> update t_unify_file <trim prefix="SET" suffixOverrides=","> <if test="fileId != null">file_id = #{fileId},</if> <if test="uploadName != null">upload_name = #{uploadName},</if> <if test="uploadType != null">upload_type = #{uploadType},</if> <if test="uploadPath != null">upload_path = #{uploadPath},</if> <if test="uploadFormat != null">upload_format = #{uploadFormat},</if> <if test="newUploadName != null">new_upload_name = #{newUploadName},</if> <if test="delFlag != null">del_flag = #{delFlag},</if> <if test="fileBusinessId != null">file_business_id = #{fileBusinessId},</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="deleteTUnifyFileById" parameterType="String"> delete from t_unify_file where id = #{id} </delete> <delete id="deleteTUnifyFileByIds" parameterType="String"> delete from t_unify_file where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> <update id="updateTUnifyFileByIds" parameterType="String"> update t_unify_file set del_flag = 1 where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </update> <update id="updateTUnifyFileBusinessIds" parameterType="String"> update t_unify_file set del_flag = 1 where file_business_id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </update> <select id="selectTUnifyFileByBusinessIdList" parameterType="String" resultMap="TUnifyFileResult"> <include refid="selectTUnifyFileVo"/> where file_business_id = #{fileBusinessId} and del_flag = 0 <if test="uploadType != null and uploadType != ''"> and upload_type = #{uploadType}</if> </select> <select id="listFileId" parameterType="String" resultMap="TUnifyFileResult"> <include refid="selectTUnifyFileVo"/> where file_id = #{fileId} and del_flag = 0 order by create_time </select> </mapper>