SysFileMapper.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.pavis.backend.slim.project.system.mapper.SysFileMapper">
  6. <resultMap type="com.pavis.backend.slim.project.system.domain.SysFile" id="SysFileResult">
  7. <id property="fileId" column="file_id"/>
  8. <result property="userId" column="user_id"/>
  9. <result property="name" column="name"/>
  10. <result property="originalName" column="original_name"/>
  11. <result property="objectKey" column="object_key"/>
  12. <result property="url" column="url"/>
  13. <result property="path" column="path"/>
  14. <result property="size" column="size"/>
  15. <result property="type" column="type"/>
  16. <result property="suffix" column="suffix"/>
  17. <result property="icon" column="icon"/>
  18. <result property="identifier" column="identifier"/>
  19. <result property="isDir" column="is_dir"/>
  20. <result property="createBy" column="create_by"/>
  21. <result property="createTime" column="create_time"/>
  22. <result property="updateBy" column="update_by"/>
  23. <result property="updateTime" column="update_time"/>
  24. </resultMap>
  25. <select id="selectByKbIdAndUserId" resultMap="SysFileResult">
  26. select *
  27. from sys_file sf
  28. left join sys_kb_file skf on sf.file_id = skf.file_id
  29. where skf.kb_id = #{kbId}
  30. and skf.user_id = #{userId}
  31. </select>
  32. <select id="selectFileAndKbName" resultType="com.pavis.backend.slim.project.system.domain.SysFile"
  33. parameterType="com.pavis.backend.slim.project.system.domain.front.FileKey">
  34. SELECT
  35. sf.file_id,sf.user_id,sf.name,sf.original_name,sf.object_key,sf.url,
  36. sf.path,sf.size,sf.type,sf.suffix,sf.icon,sf.identifier,
  37. sf.is_dir,sf.create_by,sf.create_time,sf.update_by,sf.update_time,sk.name as kbName,
  38. sk.kb_id as kbId
  39. FROM
  40. sys_file sf
  41. LEFT JOIN sys_kb_file skf ON sf.file_id = skf.file_id
  42. RIGHT JOIN sys_kb sk ON skf.kb_id = sk.kb_id
  43. WHERE 1=1
  44. <if test="numDay!=null and numDay!=''">
  45. and <![CDATA[ sf.create_time >= #{icon} ]]>
  46. </if>
  47. <if test="suffix!=null and suffix!=''">
  48. and sf.suffix like concat ('%',#{suffix},'%')
  49. </if>
  50. <if test="fileName!=null and fileName!=''">
  51. and sf.original_name like concat ('%',#{fileName},'%')
  52. </if>
  53. and sf.is_dir=0
  54. </select>
  55. </mapper>