<?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.landtool.lanbase.modules.sys.dao.SysAttachmentDao">
|
|
<select id="queryObject" resultType="com.landtool.lanbase.modules.sys.entity.SysAttachment">
|
select * from sys_attachment where id = #{id}
|
</select>
|
|
<select id="queryList" parameterType="map" resultType="com.landtool.lanbase.modules.sys.entity.SysAttachment">
|
|
SELECT *
|
FROM(
|
SELECT ROW_NUMBER() OVER(ORDER BY B.id) AS rownumber,B.*
|
FROM (
|
|
SELECT * FROM SYS_ATTACHMENT
|
<where>
|
<if test="title != null and title != ''">
|
AND title LIKE ('%' || #{title} || '%')
|
</if>
|
<if test="mime_type != null and mime_type != ''">
|
AND mime_type LIKE ('%' || #{mime_type} || '%')
|
</if>
|
</where>
|
|
) B
|
) A
|
WHERE rownumber > #{lowerOffset} AND <![CDATA[ rownumber <= ${upperOffset} ]]>
|
</select>
|
|
<select id="queryTotal" parameterType="map" resultType="int">
|
SELECT COUNT(*) FROM SYS_ATTACHMENT
|
<where>
|
<if test="title != null and title != ''">
|
AND title LIKE ('%' || #{title} || '%')
|
</if>
|
<if test="mime_type != null and mime_type != ''">
|
AND mime_type LIKE ('%' || #{mime_type} || '%')
|
</if>
|
</where>
|
</select>
|
|
<delete id="deleteBatch">
|
delete from SYS_ATTACHMENT where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<insert id="save" parameterType="com.landtool.lanbase.modules.sys.entity.SysAttachment">
|
insert into SYS_ATTACHMENT
|
(
|
title,
|
user_id,
|
path,
|
mime_type,
|
suffix,
|
create_time
|
)
|
values
|
(
|
#{title},
|
#{userId},
|
#{path},
|
#{mimeType},
|
#{suffix},
|
#{createTime}
|
)
|
</insert>
|
|
<delete id="deleteByPath">
|
delete from SYS_ATTACHMENT where path = #{path}
|
</delete>
|
</mapper>
|