ThoughtTeacherFileMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.supervision.thought.mapper.ThoughtTeacherFileMapper">
  6. <resultMap type="ThoughtTeacherFile" id="ThoughtTeacherFileResult">
  7. <result property="id" column="id" />
  8. <result property="fileName" column="file_name" />
  9. <result property="readVolume" column="read_volume" />
  10. <result property="theNumberPages" column="the_number_pages" />
  11. <result property="createUser" column="create_user" />
  12. <result property="createUserid" column="create_userid" />
  13. <result property="createTime" column="create_time" />
  14. <result property="directoryId" column="directory_id" />
  15. <result property="directoryName" column="directory_name" />
  16. <result property="parentDirId" column="parent_dir_id" />
  17. <result property="parentDirName" column="parent_dir_name" />
  18. <result property="fileSize" column="file_size" />
  19. </resultMap>
  20. <sql id="selectThoughtTeacherFileVo">
  21. select id, file_name, read_volume, the_number_pages, create_user, create_userid, create_time, directory_id, directory_name, parent_dir_id, parent_dir_name, file_size from thought_teacher_file
  22. </sql>
  23. <select id="selectThoughtTeacherFileList" parameterType="ThoughtTeacherFile" resultMap="ThoughtTeacherFileResult">
  24. <include refid="selectThoughtTeacherFileVo"/>
  25. <where>
  26. <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
  27. <if test="readVolume != null "> and read_volume = #{readVolume}</if>
  28. <if test="theNumberPages != null "> and the_number_pages = #{theNumberPages}</if>
  29. <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
  30. <if test="createUserid != null "> and create_userid = #{createUserid}</if>
  31. <if test="directoryId != null "> and directory_id = #{directoryId}</if>
  32. <if test="directoryName != null and directoryName != ''"> and directory_name like concat('%', #{directoryName}, '%')</if>
  33. <if test="parentDirId != null and parentDirId != ''"> and parent_dir_id = #{parentDirId}</if>
  34. <if test="parentDirName != null and parentDirName != ''"> and parent_dir_name like concat('%', #{parentDirName}, '%')</if>
  35. <if test="fileSize != null and fileSize != ''"> and file_size = #{fileSize}</if>
  36. </where>
  37. order by id desc
  38. </select>
  39. <select id="selectThoughtTeacherFileById" parameterType="Long" resultMap="ThoughtTeacherFileResult">
  40. <include refid="selectThoughtTeacherFileVo"/>
  41. where id = #{id}
  42. </select>
  43. <select id="selectReadRanking" resultMap="ThoughtTeacherFileResult">
  44. <include refid="selectThoughtTeacherFileVo"/>
  45. ORDER BY read_volume desc LIMIT 7
  46. </select>
  47. <insert id="insertThoughtTeacherFile" parameterType="ThoughtTeacherFile" useGeneratedKeys="true" keyProperty="id">
  48. insert into thought_teacher_file
  49. <trim prefix="(" suffix=")" suffixOverrides=",">
  50. <if test="fileName != null">file_name,</if>
  51. <if test="readVolume != null">read_volume,</if>
  52. <if test="theNumberPages != null">the_number_pages,</if>
  53. <if test="createUser != null">create_user,</if>
  54. <if test="createUserid != null">create_userid,</if>
  55. <if test="createTime != null">create_time,</if>
  56. <if test="directoryId != null">directory_id,</if>
  57. <if test="directoryName != null">directory_name,</if>
  58. <if test="parentDirId != null">parent_dir_id,</if>
  59. <if test="parentDirName != null">parent_dir_name,</if>
  60. <if test="fileSize != null">file_size,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="fileName != null">#{fileName},</if>
  64. <if test="readVolume != null">#{readVolume},</if>
  65. <if test="theNumberPages != null">#{theNumberPages},</if>
  66. <if test="createUser != null">#{createUser},</if>
  67. <if test="createUserid != null">#{createUserid},</if>
  68. <if test="createTime != null">#{createTime},</if>
  69. <if test="directoryId != null">#{directoryId},</if>
  70. <if test="directoryName != null">#{directoryName},</if>
  71. <if test="parentDirId != null">#{parentDirId},</if>
  72. <if test="parentDirName != null">#{parentDirName},</if>
  73. <if test="fileSize != null">#{fileSize},</if>
  74. </trim>
  75. </insert>
  76. <update id="updateThoughtTeacherFile" parameterType="ThoughtTeacherFile">
  77. update thought_teacher_file
  78. <trim prefix="SET" suffixOverrides=",">
  79. <if test="fileName != null">file_name = #{fileName},</if>
  80. <if test="readVolume != null">read_volume = #{readVolume},</if>
  81. <if test="theNumberPages != null">the_number_pages = #{theNumberPages},</if>
  82. <if test="createUser != null">create_user = #{createUser},</if>
  83. <if test="createUserid != null">create_userid = #{createUserid},</if>
  84. <if test="createTime != null">create_time = #{createTime},</if>
  85. <if test="directoryId != null">directory_id = #{directoryId},</if>
  86. <if test="directoryName != null">directory_name = #{directoryName},</if>
  87. <if test="parentDirId != null">parent_dir_id = #{parentDirId},</if>
  88. <if test="parentDirName != null">parent_dir_name = #{parentDirName},</if>
  89. <if test="fileSize != null">file_size = #{fileSize},</if>
  90. </trim>
  91. where id = #{id}
  92. </update>
  93. <delete id="deleteThoughtTeacherFileById" parameterType="Long">
  94. delete from thought_teacher_file where id = #{id}
  95. </delete>
  96. <delete id="deleteThoughtTeacherFileByIds" parameterType="String">
  97. delete from thought_teacher_file where id in
  98. <foreach item="id" collection="array" open="(" separator="," close=")">
  99. #{id}
  100. </foreach>
  101. </delete>
  102. </mapper>