<?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.zzg.system.mapper.system.SysFilesMapper">
|
|
<resultMap type="SysFiles" id="SysFilesResult">
|
<result property="id" column="id"/>
|
<result property="fileId" column="file_id"/>
|
<result property="title" column="title"/>
|
<result property="path" column="path"/>
|
<result property="md5" column="md5"/>
|
<result property="createBy" column="create_by"/>
|
<result property="createTime" column="create_time"/>
|
<result property="realPath" column="real_path"/>
|
</resultMap>
|
|
<sql id="selectSysFilesVo">
|
select id,
|
file_id,
|
title,
|
path,
|
md5,
|
create_by,
|
create_time,
|
real_path
|
from sys_files
|
</sql>
|
|
<select id="selectSysFilesList" parameterType="SysFiles" resultMap="SysFilesResult">
|
<include refid="selectSysFilesVo"/>
|
<where>
|
<if test="fileId != null and fileId != ''">and file_id = #{fileId},</if>
|
<if test="title != null and title != ''">and title = #{title}</if>
|
<if test="path != null and path != ''">and path like concat('%', #{path}, '%')</if>
|
<if test="md5 != null and md5 != ''">and md5 = #{md5}</if>
|
<if test="realPath != null and realPath != ''">and real_path = #{realPath}</if>
|
</where>
|
</select>
|
|
|
<select id="selectSysFiles" parameterType="SysFiles" resultMap="SysFilesResult">
|
<include refid="selectSysFilesVo"/>
|
<where>
|
<if test="fileId != null and fileId != ''">and file_id = #{fileId},</if>
|
<if test="title != null and title != ''">and title = #{title}</if>
|
<if test="path != null and path != ''">and path = #{path}</if>
|
<if test="md5 != null and md5 != ''">and md5 = #{md5}</if>
|
<if test="realPath != null and realPath != ''">and real_path = #{realPath}</if>
|
</where>
|
limit 1
|
</select>
|
|
<select id="selectSysFilesByFileId" parameterType="SysFiles" resultMap="SysFilesResult">
|
<include refid="selectSysFilesVo"/>
|
where
|
file_id = #{fileId}
|
limit 1
|
</select>
|
|
|
<select id="selectSysFilesById" parameterType="Long" resultMap="SysFilesResult">
|
<include refid="selectSysFilesVo"/>
|
where id = #{id}
|
</select>
|
|
|
<select id="selectSysFilesListByFileIds" resultMap="SysFilesResult">
|
select id, file_id , title, path, md5, create_by, create_time ,real_path from sys_files
|
where file_id in
|
<foreach collection="fileIds" item="id" separator="," open="(" close=")">
|
#{id}
|
</foreach>
|
|
</select>
|
|
|
<insert id="insertSysFiles" parameterType="SysFiles" useGeneratedKeys="true" keyProperty="id">
|
insert into sys_files
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null and id != ''">id,</if>
|
<if test="fileId != null and fileId != ''">file_id,</if>
|
<if test="title != null and title != ''">title,</if>
|
<if test="path != null and path != ''">path,</if>
|
<if test="md5 != null and md5 != ''">md5,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="realPath != null">real_path,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null and id != ''">#{id},</if>
|
<if test="fileId != null and fileId != ''">#{fileId},</if>
|
<if test="title != null and title != ''">#{title},</if>
|
<if test="path != null and path != ''">#{path},</if>
|
<if test="md5 != null and md5 != ''">#{md5},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="realPath != null">#{realPath},</if>
|
</trim>
|
</insert>
|
|
<update id="updateSysFiles" parameterType="SysFiles">
|
update sys_files
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="fileId != null and fileId != ''">file_id = #{fileId},</if>
|
<if test="title != null and title != ''">title = #{title},</if>
|
<if test="path != null and path != ''">path = #{path},</if>
|
<if test="md5 != null and md5 != ''">md5 = #{md5},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="realPath != null">real_path = #{realPath},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteSysFilesById" parameterType="Long">
|
delete
|
from sys_files
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteSysFilesByIds" parameterType="String">
|
delete from sys_files where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
|
<delete id="deleteSysFilesByFileIds" parameterType="String">
|
delete from sys_files where file_id in
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|