2024-08-29 22:01:03 +08:00

161 lines
8.3 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.rzdata.web.mapper.AttachmentMapper">
<resultMap type="Attachment" id="AttachmentResult">
<result property="id" column="id" />
<result property="bizType" column="biz_type" />
<result property="fileUrl" column="file_url" />
<result property="fileOldName" column="file_old_name" />
<result property="fileNewName" column="file_new_name" />
<result property="suffixType" column="suffix_type" />
<result property="fileSize" column="file_size" />
<result property="businessId" column="business_id" />
<result property="sorts" column="sorts" />
<result property="remark" column="remark" />
<result property="del" column="del" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="failureTime" column="failure_time" />
</resultMap>
<sql id="selectAttachmentVo">
select id, biz_type, file_url, file_old_name, file_new_name, suffix_type, file_size, business_id, sorts, remark, del, create_by, create_date, update_by, update_date, failure_time from t_attachment
</sql>
<select id="selectAttachmentList" parameterType="Attachment" resultMap="AttachmentResult">
<include refid="selectAttachmentVo"/>
<where>
<if test="bizType != null and bizType != ''"> and biz_type = #{bizType}</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
<if test="fileOldName != null and fileOldName != ''"> and file_old_name like concat('%', #{fileOldName}, '%')</if>
<if test="fileNewName != null and fileNewName != ''"> and file_new_name like concat('%', #{fileNewName}, '%')</if>
<if test="suffixType != null and suffixType != ''"> and suffix_type = #{suffixType}</if>
<if test="fileSize != null "> and file_size = #{fileSize}</if>
<if test="businessId != null and businessId != ''"> and business_id = #{businessId}</if>
<if test="sorts != null "> and sorts = #{sorts}</if>
<if test="del != null "> and del = #{del}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="failureTime != null "> and failure_time = #{failureTime}</if>
<if test="businessIds != null and businessIds.size() > 0">
and business_id in
<foreach item="id" index="index" collection="businessIds" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<select id="selectAttachmentById" parameterType="String" resultMap="AttachmentResult">
<include refid="selectAttachmentVo"/>
where id = #{id}
</select>
<insert id="insertAttachment" parameterType="Attachment">
insert into t_attachment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="bizType != null">biz_type,</if>
<if test="fileUrl != null">file_url,</if>
<if test="fileOldName != null">file_old_name,</if>
<if test="fileNewName != null">file_new_name,</if>
<if test="suffixType != null">suffix_type,</if>
<if test="fileSize != null">file_size,</if>
<if test="businessId != null">business_id,</if>
<if test="sorts != null">sorts,</if>
<if test="remark != null">remark,</if>
<if test="del != null">del,</if>
<if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
<if test="failureTime != null">failure_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="bizType != null">#{bizType},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="fileOldName != null">#{fileOldName},</if>
<if test="fileNewName != null">#{fileNewName},</if>
<if test="suffixType != null">#{suffixType},</if>
<if test="fileSize != null">#{fileSize},</if>
<if test="businessId != null">#{businessId},</if>
<if test="sorts != null">#{sorts},</if>
<if test="remark != null">#{remark},</if>
<if test="del != null">#{del},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
<if test="failureTime != null">#{failureTime},</if>
</trim>
</insert>
<update id="updateAttachment" parameterType="Attachment">
update t_attachment
<trim prefix="SET" suffixOverrides=",">
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="fileOldName != null">file_old_name = #{fileOldName},</if>
<if test="fileNewName != null">file_new_name = #{fileNewName},</if>
<if test="suffixType != null">suffix_type = #{suffixType},</if>
<if test="fileSize != null">file_size = #{fileSize},</if>
<if test="businessId != null">business_id = #{businessId},</if>
<if test="sorts != null">sorts = #{sorts},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="del != null">del = #{del},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
<if test="failureTime != null">failure_time = #{failureTime},</if>
</trim>
where id = #{id}
</update>
<update id="updateAttachmentByBusinessId" parameterType="Attachment">
update t_attachment
<trim prefix="SET" suffixOverrides=",">
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="fileOldName != null">file_old_name = #{fileOldName},</if>
<if test="fileNewName != null">file_new_name = #{fileNewName},</if>
<if test="suffixType != null">suffix_type = #{suffixType},</if>
<if test="fileSize != null">file_size = #{fileSize},</if>
<if test="sorts != null">sorts = #{sorts},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="del != null">del = #{del},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
<if test="failureTime != null">failure_time = #{failureTime},</if>
</trim>
where business_id = #{businessId}
</update>
<delete id="deleteAttachmentById" parameterType="String">
delete from t_attachment where id = #{id}
</delete>
<delete id="deleteAttachmentByIds" parameterType="String">
delete from t_attachment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteAttachmentByBusinessId" parameterType="java.util.List">
delete from t_attachment where business_id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>