<?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.project.system.attachment.mapper.AttachmentMapper">
|
|
<resultMap type="Attachment" id="AttachmentResult">
|
<result property="attachmentId" column="attachment_id" />
|
<result property="createBy" column="create_by" />
|
<result property="createUserId" column="create_user_id" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateUserId" column="update_user_id" />
|
<result property="updateTime" column="update_time" />
|
<result property="remark" column="remark" />
|
<result property="filePath" column="file_path" />
|
<result property="originalFileName" column="original_file_name" />
|
<result property="attachmentType" column="attachment_type" />
|
<result property="fileJoinId" column="file_join_id" />
|
<result property="companyId" column="company_id" />
|
<result property="fileType" column="file_type" />
|
</resultMap>
|
|
<sql id="selectAttachmentVo">
|
select attachment_id, create_by, create_user_id, create_time, update_by, update_user_id, update_time, remark, file_path, original_file_name, attachment_type, file_join_id, company_id, file_type from sys_attachment
|
</sql>
|
|
<select id="selectAttachmentList" parameterType="Attachment" resultMap="AttachmentResult">
|
<include refid="selectAttachmentVo"/>
|
<where>
|
<if test="attachmentId != null "> and attachment_id = #{attachmentId}</if>
|
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
<if test="createUserId != null "> and create_user_id = #{createUserId}</if>
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
|
<if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
|
<if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if>
|
<if test="originalFileName != null and originalFileName != ''"> and original_file_name like concat('%', #{originalFileName}, '%')</if>
|
<if test="attachmentType != null "> and attachment_type = #{attachmentType}</if>
|
<if test="fileJoinId != null "> and file_join_id = #{fileJoinId}</if>
|
<if test="companyId != null "> and company_id = #{companyId}</if>
|
<if test="fileType != null "> and file_type = #{fileType}</if>
|
</where>
|
</select>
|
|
<select id="selectAttachmentById" parameterType="Long" resultMap="AttachmentResult">
|
<include refid="selectAttachmentVo"/>
|
where attachment_id = #{attachmentId}
|
</select>
|
|
<insert id="insertAttachment" parameterType="Attachment" useGeneratedKeys="true" keyProperty="attachmentId">
|
insert into sys_attachment
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createUserId != null ">create_user_id,</if>
|
<if test="createTime != null ">create_time,</if>
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
<if test="updateUserId != null ">update_user_id,</if>
|
<if test="updateTime != null ">update_time,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
<if test="filePath != null and filePath != ''">file_path,</if>
|
<if test="originalFileName != null and originalFileName != ''">original_file_name,</if>
|
<if test="attachmentType != null ">attachment_type,</if>
|
<if test="fileJoinId != null ">file_join_id,</if>
|
<if test="companyId != null ">company_id,</if>
|
<if test="fileType != null ">file_type,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createUserId != null ">#{createUserId},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
<if test="updateUserId != null ">#{updateUserId},</if>
|
<if test="updateTime != null ">#{updateTime},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="filePath != null and filePath != ''">#{filePath},</if>
|
<if test="originalFileName != null and originalFileName != ''">#{originalFileName},</if>
|
<if test="attachmentType != null ">#{attachmentType},</if>
|
<if test="fileJoinId != null ">#{fileJoinId},</if>
|
<if test="companyId != null ">#{companyId},</if>
|
<if test="fileType != null ">#{fileType},</if>
|
</trim>
|
</insert>
|
|
<update id="updateAttachment" parameterType="Attachment">
|
update sys_attachment
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
<if test="createUserId != null ">create_user_id = #{createUserId},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateUserId != null ">update_user_id = #{updateUserId},</if>
|
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
|
<if test="originalFileName != null and originalFileName != ''">original_file_name = #{originalFileName},</if>
|
<if test="attachmentType != null ">attachment_type = #{attachmentType},</if>
|
<if test="fileJoinId != null ">file_join_id = #{fileJoinId},</if>
|
<if test="companyId != null ">company_id = #{companyId},</if>
|
<if test="fileType != null ">file_type = #{fileType},</if>
|
</trim>
|
where attachment_id = #{attachmentId}
|
</update>
|
|
<delete id="deleteAttachmentById" parameterType="Long">
|
delete from sys_attachment where attachment_id = #{attachmentId}
|
</delete>
|
|
<delete id="deleteAttachmentByIds" parameterType="String">
|
delete from sys_attachment where attachment_id in
|
<foreach item="attachmentId" collection="array" open="(" separator="," close=")">
|
#{attachmentId}
|
</foreach>
|
</delete>
|
|
</mapper>
|