SysFileDao.xml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.backendsys.modules.upload.dao.SysFileDao">
  4. <sql id="includeFile">
  5. id,
  6. COALESCE(category_id, '') category_id,
  7. COALESCE(request_id, '') request_id,
  8. COALESCE(upload_id, '') upload_id,
  9. user_id,
  10. name,
  11. content_type,
  12. url,
  13. COALESCE(url_thumb, '') url_thumb,
  14. COALESCE(object_key, '') object_key,
  15. size,
  16. md5,
  17. target,
  18. create_time,
  19. update_time
  20. </sql>
  21. <!-- type="java.util.LinkedHashMap" -->
  22. <resultMap id="resultMapFileList" type="com.backendsys.modules.upload.entity.SysFile">
  23. <id property="id" column="id" jdbcType="BIGINT" />
  24. <result property="category_id" column="category_id" javaType="java.lang.Long" />
  25. <result property="request_id" column="request_id" />
  26. <result property="upload_id" column="upload_id" />
  27. <result property="user_id" column="user_id" javaType="java.lang.Long" />
  28. <result property="name" column="name" />
  29. <result property="content_type" column="content_type" />
  30. <result property="url" column="url" />
  31. <result property="url_thumb" column="url_thumb" />
  32. <result property="object_key" column="object_key" />
  33. <result property="size" column="size" javaType="java.lang.Long" />
  34. <result property="md5" column="md5" />
  35. <result property="target" column="target" javaType="java.lang.Integer" />
  36. <result property="create_time" column="create_time" />
  37. <result property="update_time" column="update_time" />
  38. </resultMap>
  39. <select id="selectUploadFileList" resultMap="resultMapFileList">
  40. SELECT <include refid="includeFile" /> FROM sys_file
  41. <where>
  42. <if test="name != null and name != ''">
  43. AND name LIKE CONCAT('%', #{name}, '%')
  44. </if>
  45. <if test="category_id != null and category_id != ''">
  46. AND category_id = #{category_id}
  47. </if>
  48. <if test="user_id != null and user_id != ''">
  49. AND user_id = #{user_id}
  50. </if>
  51. <if test="object_key != null and object_key != ''">
  52. AND object_key = #{object_key}
  53. </if>
  54. <if test="target != null and target != ''">
  55. AND target = #{target}
  56. </if>
  57. </where>
  58. ORDER BY create_time DESC
  59. </select>
  60. </mapper>