TopicLibraryMapper.xml 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.ruoyi.mapper.TopicLibraryMapper">
  6. <resultMap type="TopicLibrary" id="TopicLibraryResult">
  7. <result property="topicId" column="topic_id" />
  8. <result property="topicName" column="topic_name" />
  9. <result property="topicPassword" column="topic_password" />
  10. <result property="topicText" column="topic_text" />
  11. <result property="filePath" column="file_path" />
  12. <result property="fileName" column="file_name" />
  13. <result property="uplpadUser" column="uplpad_user" />
  14. <result property="uploadTime" column="upload_time" />
  15. <result property="upDept" column="up_dept" />
  16. <result property="report" column="report" />
  17. <result property="delFlag" column="del_flag" />
  18. <result property="topicState" column="topic_state" />
  19. </resultMap>
  20. <sql id="selectTopicLibraryVo">
  21. select topic_id, topic_name, topic_password, topic_text, file_path, file_name, uplpad_user, upload_time, up_dept, report, del_flag, topic_state from topic_library
  22. </sql>
  23. <select id="selectTopicLibraryList" parameterType="TopicLibrary" resultMap="TopicLibraryResult">
  24. <include refid="selectTopicLibraryVo"/>
  25. <where>
  26. <if test="topicName != null and topicName != ''"> and topic_name like concat('%', #{topicName}, '%')</if>
  27. <if test="topicState != null "> and topic_state = #{topicState}</if>
  28. </where>
  29. </select>
  30. <select id="selectTopicLibraryByTopicId" parameterType="Long" resultMap="TopicLibraryResult">
  31. <include refid="selectTopicLibraryVo"/>
  32. where topic_id = #{topicId}
  33. </select>
  34. <insert id="insertTopicLibrary" parameterType="TopicLibrary" useGeneratedKeys="true" keyProperty="topicId">
  35. insert into topic_library
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="topicName != null and topicName != ''">topic_name,</if>
  38. <if test="topicPassword != null">topic_password,</if>
  39. <if test="topicText != null">topic_text,</if>
  40. <if test="filePath != null">file_path,</if>
  41. <if test="fileName != null">file_name,</if>
  42. <if test="uplpadUser != null">uplpad_user,</if>
  43. <if test="uploadTime != null">upload_time,</if>
  44. <if test="upDept != null">up_dept,</if>
  45. <if test="report != null">report,</if>
  46. <if test="delFlag != null">del_flag,</if>
  47. <if test="topicState != null">topic_state,</if>
  48. </trim>
  49. <trim prefix="values (" suffix=")" suffixOverrides=",">
  50. <if test="topicName != null and topicName != ''">#{topicName},</if>
  51. <if test="topicPassword != null">#{topicPassword},</if>
  52. <if test="topicText != null">#{topicText},</if>
  53. <if test="filePath != null">#{filePath},</if>
  54. <if test="fileName != null">#{fileName},</if>
  55. <if test="uplpadUser != null">#{uplpadUser},</if>
  56. <if test="uploadTime != null">#{uploadTime},</if>
  57. <if test="upDept != null">#{upDept},</if>
  58. <if test="report != null">#{report},</if>
  59. <if test="delFlag != null">#{delFlag},</if>
  60. <if test="topicState != null">#{topicState},</if>
  61. </trim>
  62. </insert>
  63. <update id="updateTopicLibrary" parameterType="TopicLibrary">
  64. update topic_library
  65. <trim prefix="SET" suffixOverrides=",">
  66. <if test="topicName != null and topicName != ''">topic_name = #{topicName},</if>
  67. <if test="topicPassword != null">topic_password = #{topicPassword},</if>
  68. <if test="topicText != null">topic_text = #{topicText},</if>
  69. <if test="filePath != null">file_path = #{filePath},</if>
  70. <if test="fileName != null">file_name = #{fileName},</if>
  71. <if test="uplpadUser != null">uplpad_user = #{uplpadUser},</if>
  72. <if test="uploadTime != null">upload_time = #{uploadTime},</if>
  73. <if test="upDept != null">up_dept = #{upDept},</if>
  74. <if test="report != null">report = #{report},</if>
  75. <if test="delFlag != null">del_flag = #{delFlag},</if>
  76. <if test="topicState != null">topic_state = #{topicState},</if>
  77. </trim>
  78. where topic_id = #{topicId}
  79. </update>
  80. <delete id="deleteTopicLibraryByTopicId" parameterType="Long">
  81. delete from topic_library where topic_id = #{topicId}
  82. </delete>
  83. <delete id="deleteTopicLibraryByTopicIds" parameterType="String">
  84. delete from topic_library where topic_id in
  85. <foreach item="topicId" collection="array" open="(" separator="," close=")">
  86. #{topicId}
  87. </foreach>
  88. </delete>
  89. </mapper>