PersonResourcesMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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.system.mapper.PersonResourcesMapper">
  6. <resultMap type="PersonResources" id="PersonResourcesResult">
  7. <result property="resourcesId" column="resources_id" />
  8. <result property="resourcesName" column="resources_name" />
  9. <result property="sourceId" column="source_id" />
  10. <result property="category" column="category" />
  11. <result property="chapterId" column="chapter_id" />
  12. <result property="edition" column="edition" />
  13. <result property="knowledgeBasicId" column="knowledge_basic_id" />
  14. <result property="resourcesUrl" column="resources_url" />
  15. <result property="type" column="type" />
  16. <result property="linkWay" column="link_way" />
  17. <result property="bookId" column="book_id" />
  18. <result property="schoolId" column="school_id" />
  19. <result property="subjectId" column="subject_id" />
  20. <result property="delFlag" column="del_flag" />
  21. <result property="province" column="province" />
  22. <result property="createId" column="create_id" />
  23. <result property="city" column="city" />
  24. <result property="createTime" column="create_time" />
  25. <result property="county" column="county" />
  26. <result property="remark" column="remark" />
  27. <result property="fileSize" column="file_size" />
  28. <result property="coursewareType" column="courseware_type" />
  29. <result property="videoId" column="video_id" />
  30. <result property="updateTime" column="update_time" />
  31. </resultMap>
  32. <sql id="selectPersonResourcesVo">
  33. select resources_id, resources_name, source_id, category, courseware_type, chapter_id, edition, knowledge_basic_id, resources_url, type, link_way, book_id, school_id, subject_id, del_flag, province, create_id, city, create_time, county, remark, file_size from test_person_resources
  34. </sql>
  35. <select id="selectPersonResourcesList" parameterType="PersonResources" resultMap="PersonResourcesResult">
  36. <include refid="selectPersonResourcesVo"/>
  37. where 1=1
  38. <if test="resourcesName != null and resourcesName != ''"> and resources_name like concat('%', #{resourcesName}, '%')</if>
  39. <if test="sourceId != null and sourceId != ''"> and source_id = #{sourceId}</if>
  40. <if test="category != null and category != ''"> and category = #{category}</if>
  41. <if test="chapterId != null "> and chapter_id = #{chapterId}</if>
  42. <if test="edition != null "> and edition = #{edition}</if>
  43. <if test="knowledgeBasicId != null "> and knowledge_basic_id = #{knowledgeBasicId}</if>
  44. <if test="resourcesUrl != null and resourcesUrl != ''"> and resources_url = #{resourcesUrl}</if>
  45. <if test="type != null "> and type = #{type}</if>
  46. <if test="linkWay != null and linkWay != ''"> and link_way = #{linkWay}</if>
  47. <if test="bookId != null "> and book_id = #{bookId}</if>
  48. <if test="schoolId != null "> and school_id = #{schoolId}</if>
  49. <if test="subjectId != null "> and subject_id = #{subjectId}</if>
  50. <if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
  51. <if test="province != null "> and province = #{province}</if>
  52. <if test="createId != null "> and create_id = #{createId}</if>
  53. <if test="city != null "> and city = #{city}</if>
  54. <if test="county != null "> and county = #{county}</if>
  55. <if test="fileSize != null "> and file_size = #{fileSize}</if>
  56. <if test="coursewareType != null and coursewareType != '' "> and courseware_type = #{coursewareType}</if>
  57. <if test="sourceIds != null and sourceIds.size()>0 ">
  58. and source_id in <foreach item="id" collection="sourceIds" open="(" separator="," close=")">#{id}</foreach>
  59. </if>
  60. order by resources_id desc
  61. </select>
  62. <select id="selectPersonResourcesById" parameterType="Long" resultMap="PersonResourcesResult">
  63. <include refid="selectPersonResourcesVo"/>
  64. where resources_id = #{resourcesId}
  65. </select>
  66. <insert id="insertPersonResources" parameterType="PersonResources" useGeneratedKeys="true" keyProperty="resourcesId">
  67. insert into test_person_resources
  68. <trim prefix="(" suffix=")" suffixOverrides=",">
  69. <if test="resourcesName != null and resourcesName != ''">resources_name,</if>
  70. <if test="sourceId != null">source_id,</if>
  71. <if test="category != null and category != ''">category,</if>
  72. <if test="chapterId != null">chapter_id,</if>
  73. <if test="edition != null">edition,</if>
  74. <if test="knowledgeBasicId != null">knowledge_basic_id,</if>
  75. <if test="resourcesUrl != null">resources_url,</if>
  76. <if test="type != null">type,</if>
  77. <if test="linkWay != null">link_way,</if>
  78. <if test="bookId != null">book_id,</if>
  79. <if test="schoolId != null">school_id,</if>
  80. <if test="subjectId != null">subject_id,</if>
  81. <if test="delFlag != null">del_flag,</if>
  82. <if test="province != null">province,</if>
  83. <if test="createId != null">create_id,</if>
  84. <if test="city != null">city,</if>
  85. <if test="createTime != null">create_time,</if>
  86. <if test="county != null">county,</if>
  87. <if test="remark != null">remark,</if>
  88. <if test="fileSize != null">file_size,</if>
  89. <if test= "coursewareType != null and coursewareType != '' ">courseware_type,</if>
  90. <if test="videoId != null">video_id,</if>
  91. <if test="updateTime != null">update_time,</if>
  92. </trim>
  93. <trim prefix="values (" suffix=")" suffixOverrides=",">
  94. <if test="resourcesName != null and resourcesName != ''">#{resourcesName},</if>
  95. <if test="sourceId != null">#{sourceId},</if>
  96. <if test="category != null and category != ''">#{category},</if>
  97. <if test="chapterId != null">#{chapterId},</if>
  98. <if test="edition != null">#{edition},</if>
  99. <if test="knowledgeBasicId != null">#{knowledgeBasicId},</if>
  100. <if test="resourcesUrl != null">#{resourcesUrl},</if>
  101. <if test="type != null">#{type},</if>
  102. <if test="linkWay != null">#{linkWay},</if>
  103. <if test="bookId != null">#{bookId},</if>
  104. <if test="schoolId != null">#{schoolId},</if>
  105. <if test="subjectId != null">#{subjectId},</if>
  106. <if test="delFlag != null">#{delFlag},</if>
  107. <if test="province != null">#{province},</if>
  108. <if test="createId != null">#{createId},</if>
  109. <if test="city != null">#{city},</if>
  110. <if test="createTime != null">#{createTime},</if>
  111. <if test="county != null">#{county},</if>
  112. <if test="remark != null">#{remark},</if>
  113. <if test="fileSize != null">#{fileSize},</if>
  114. <if test="coursewareType != null and coursewareType != '' ">#{coursewareType},</if>
  115. <if test="videoId != null">#{videoId},</if>
  116. <if test="updateTime != null">#{updateTime},</if>
  117. </trim>
  118. </insert>
  119. <update id="updatePersonResources" parameterType="PersonResources">
  120. update test_person_resources
  121. <trim prefix="SET" suffixOverrides=",">
  122. <if test="resourcesName != null and resourcesName != ''">resources_name = #{resourcesName},</if>
  123. <if test="sourceId != null">source_id = #{sourceId},</if>
  124. <if test="category != null and category != ''">category = #{category},</if>
  125. <if test="chapterId != null">chapter_id = #{chapterId},</if>
  126. <if test="edition != null">edition = #{edition},</if>
  127. <if test="knowledgeBasicId != null">knowledge_basic_id = #{knowledgeBasicId},</if>
  128. <if test="resourcesUrl != null">resources_url = #{resourcesUrl},</if>
  129. <if test="type != null">type = #{type},</if>
  130. <if test="linkWay != null">link_way = #{linkWay},</if>
  131. <if test="bookId != null">book_id = #{bookId},</if>
  132. <if test="schoolId != null">school_id = #{schoolId},</if>
  133. <if test="subjectId != null">subject_id = #{subjectId},</if>
  134. <if test="delFlag != null">del_flag = #{delFlag},</if>
  135. <if test="province != null">province = #{province},</if>
  136. <if test="createId != null">create_id = #{createId},</if>
  137. <if test="city != null">city = #{city},</if>
  138. <if test="createTime != null">create_time = #{createTime},</if>
  139. <if test="county != null">county = #{county},</if>
  140. <if test="remark != null">remark = #{remark},</if>
  141. <if test="fileSize != null">file_size = #{fileSize},</if>
  142. <if test="coursewareType != null and coursewareType != '' ">courseware_type = #{coursewareType},</if>
  143. <if test="videoId != null">video_id = #{videoId},</if>
  144. <if test="updateTime != null">update_time=#{updateTime},</if>
  145. </trim>
  146. where resources_id = #{resourcesId}
  147. </update>
  148. <delete id="deletePersonResourcesById" parameterType="Long">
  149. delete from test_person_resources where resources_id = #{resourcesId}
  150. </delete>
  151. <delete id="deletePersonResourcesByIds" parameterType="String">
  152. delete from test_person_resources where resources_id in
  153. <foreach item="resourcesId" collection="array" open="(" separator="," close=")">
  154. #{resourcesId}
  155. </foreach>
  156. </delete>
  157. </mapper>