1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?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.pavis.backend.slim.project.system.mapper.SysFileMapper">
- <resultMap type="com.pavis.backend.slim.project.system.domain.SysFile" id="SysFileResult">
- <id property="fileId" column="file_id"/>
- <result property="userId" column="user_id"/>
- <result property="name" column="name"/>
- <result property="originalName" column="original_name"/>
- <result property="objectKey" column="object_key"/>
- <result property="url" column="url"/>
- <result property="path" column="path"/>
- <result property="size" column="size"/>
- <result property="type" column="type"/>
- <result property="suffix" column="suffix"/>
- <result property="icon" column="icon"/>
- <result property="identifier" column="identifier"/>
- <result property="isDir" column="is_dir"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- </resultMap>
- <select id="selectByKbIdAndUserId" resultMap="SysFileResult">
- select *
- from sys_file sf
- left join sys_kb_file skf on sf.file_id = skf.file_id
- where skf.kb_id = #{kbId}
- and skf.user_id = #{userId}
- </select>
- <select id="selectFileAndKbName" resultType="com.pavis.backend.slim.project.system.domain.SysFile"
- parameterType="com.pavis.backend.slim.project.system.domain.front.FileKey">
- SELECT
- sf.file_id,sf.user_id,sf.name,sf.original_name,sf.object_key,sf.url,
- sf.path,sf.size,sf.type,sf.suffix,sf.icon,sf.identifier,
- sf.is_dir,sf.create_by,sf.create_time,sf.update_by,sf.update_time,sk.name as kbName,
- sk.kb_id as kbId
- FROM
- sys_file sf
- LEFT JOIN sys_kb_file skf ON sf.file_id = skf.file_id
- RIGHT JOIN sys_kb sk ON skf.kb_id = sk.kb_id
- WHERE 1=1
- <if test="numDay!=null and numDay!=''">
- and <![CDATA[ sf.create_time >= #{icon} ]]>
- </if>
- <if test="suffix!=null and suffix!=''">
- and sf.suffix like concat ('%',#{suffix},'%')
- </if>
- <if test="fileName!=null and fileName!=''">
- and sf.original_name like concat ('%',#{fileName},'%')
- </if>
- and sf.is_dir=0
- </select>
- </mapper>
|