107 lines
5.0 KiB
XML
107 lines
5.0 KiB
XML
<?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.bms.system.mapper.BmsBizAttachmentMapper">
|
|
|
|
<resultMap type="BmsBizAttachment" id="BmsBizAttachmentResult">
|
|
<id property="attachmentId" column="attachment_id" />
|
|
<result property="bizType" column="biz_type" />
|
|
<result property="bizId" column="biz_id" />
|
|
<result property="fileName" column="file_name" />
|
|
<result property="filePath" column="file_path" />
|
|
<result property="fileSize" column="file_size" />
|
|
<result property="contentType" column="content_type" />
|
|
<result property="fileExtension" column="file_extension" />
|
|
<result property="remark" column="remark" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="delFlag" column="del_flag" />
|
|
</resultMap>
|
|
|
|
<sql id="selectBmsBizAttachmentVo">
|
|
select attachment_id, biz_type, biz_id, file_name, file_path, file_size, content_type,
|
|
file_extension, remark, create_by, create_time, update_by, update_time, del_flag
|
|
from biz_attachment
|
|
</sql>
|
|
|
|
<select id="selectBmsBizAttachmentById" parameterType="Long" resultMap="BmsBizAttachmentResult">
|
|
<include refid="selectBmsBizAttachmentVo"/>
|
|
where attachment_id = #{attachmentId} and del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectBmsBizAttachmentList" parameterType="BmsBizAttachment" resultMap="BmsBizAttachmentResult">
|
|
<include refid="selectBmsBizAttachmentVo"/>
|
|
<where>
|
|
del_flag = '0'
|
|
<if test="bizType != null and bizType != ''">
|
|
AND biz_type = #{bizType}
|
|
</if>
|
|
<if test="bizId != null and bizId != ''">
|
|
AND biz_id = #{bizId}
|
|
</if>
|
|
<if test="fileName != null and fileName != ''">
|
|
AND file_name like concat('%', #{fileName}, '%')
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
AND create_by like concat('%', #{createBy}, '%')
|
|
</if>
|
|
<if test="params != null and params.beginTime != null and params.beginTime != ''">
|
|
AND create_time >= #{params.beginTime}
|
|
</if>
|
|
<if test="params != null and params.endTime != null and params.endTime != ''">
|
|
AND create_time <= #{params.endTime}
|
|
</if>
|
|
</where>
|
|
order by attachment_id desc
|
|
</select>
|
|
|
|
<insert id="insertBmsBizAttachment" parameterType="BmsBizAttachment" useGeneratedKeys="true" keyProperty="attachmentId">
|
|
insert into biz_attachment (
|
|
<if test="bizType != null and bizType != ''">biz_type,</if>
|
|
<if test="bizId != null">biz_id,</if>
|
|
<if test="fileName != null and fileName != ''">file_name,</if>
|
|
<if test="filePath != null and filePath != ''">file_path,</if>
|
|
<if test="fileSize != null">file_size,</if>
|
|
<if test="contentType != null">content_type,</if>
|
|
<if test="fileExtension != null">file_extension,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
create_time,
|
|
del_flag
|
|
) values (
|
|
<if test="bizType != null and bizType != ''">#{bizType},</if>
|
|
<if test="bizId != null">#{bizId},</if>
|
|
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
|
<if test="filePath != null and filePath != ''">#{filePath},</if>
|
|
<if test="fileSize != null">#{fileSize},</if>
|
|
<if test="contentType != null">#{contentType},</if>
|
|
<if test="fileExtension != null">#{fileExtension},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
sysdate(),
|
|
'0'
|
|
)
|
|
</insert>
|
|
|
|
<update id="updateBmsBizAttachment" parameterType="BmsBizAttachment">
|
|
update biz_attachment
|
|
<set>
|
|
<if test="bizId != null">biz_id = #{bizId},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
update_time = sysdate()
|
|
</set>
|
|
where attachment_id = #{attachmentId}
|
|
</update>
|
|
|
|
<update id="deleteBmsBizAttachmentByIds" parameterType="Long">
|
|
update biz_attachment set del_flag = '2' where attachment_id in
|
|
<foreach collection="array" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
</mapper>
|