CourseHandoutsMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.zhongzheng.modules.course.mapper.CourseHandoutsMapper">
  6. <resultMap type="com.zhongzheng.modules.course.domain.CourseHandouts" id="CourseHandoutsResult">
  7. <result property="handoutsId" column="handouts_id"/>
  8. <result property="handoutsName" column="handouts_name"/>
  9. <result property="status" column="status"/>
  10. <result property="handoutsUrl" column="handouts_url"/>
  11. <result property="encoder" column="encoder"/>
  12. <result property="canDownload" column="can_download"/>
  13. <collection property="fileList" column="handouts_id" select="findFileList"/>
  14. </resultMap>
  15. <resultMap type="com.zhongzheng.modules.course.domain.CourseHandoutsBusiness" id="CourseHandoutsBusinessResult">
  16. <result property="id" column="id"/>
  17. <result property="educationId" column="education_id"/>
  18. <result property="businessId" column="business_id"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateTime" column="update_time"/>
  21. <result property="handoutsId" column="handouts_id"/>
  22. </resultMap>
  23. <resultMap type="com.zhongzheng.modules.course.vo.CourseHandoutsBusinessVo" id="CourseHandoutsBusinessVoResult">
  24. <result property="id" column="id"/>
  25. <result property="educationId" column="education_id"/>
  26. <result property="businessId" column="business_id"/>
  27. <result property="educationName" column="education_name"/>
  28. <result property="businessName" column="business_name"/>
  29. <result property="handoutsId" column="handouts_id"/>
  30. <result property="subjectName" column="subject_name"/>
  31. <result property="projectName" column="project_name"/>
  32. <result property="projectId" column="project_id"/>
  33. </resultMap>
  34. <resultMap type="com.zhongzheng.modules.course.vo.CourseFileVo" id="CourseFileVoResult">
  35. <result property="fileId" column="file_id"/>
  36. <result property="url" column="url"/>
  37. <result property="urlName" column="url_name"/>
  38. <result property="status" column="status"/>
  39. <result property="createTime" column="create_time"/>
  40. <result property="updateTime" column="update_time"/>
  41. <result property="majorId" column="major_id"/>
  42. <result property="type" column="type"/>
  43. <result property="sort" column="sort"/>
  44. </resultMap>
  45. <resultMap type="com.zhongzheng.modules.course.vo.CourseHandoutsVo" id="CourseHandoutsVoResult">
  46. <result property="handoutsId" column="handouts_id"/>
  47. <result property="status" column="status"/>
  48. <result property="encoder" column="encoder"/>
  49. <result property="canDownload" column="can_download"/>
  50. <result property="url" column="url"/>
  51. <result property="urlName" column="url_name"/>
  52. <result property="handoutsName" column="handouts_name"/>
  53. </resultMap>
  54. <select id="findFileList" resultMap="CourseFileVoResult">
  55. SELECT
  56. cf.*
  57. FROM
  58. course_file cf
  59. WHERE
  60. cf.handouts_id =#{handouts_id}
  61. </select>
  62. <select id="selectEntity" parameterType="Long" resultMap="CourseHandoutsBusinessVoResult">
  63. SELECT
  64. h.*,
  65. b.business_name,
  66. e.education_name,
  67. s.subject_name,
  68. t.project_name,
  69. t.id as project_id
  70. FROM
  71. course_handouts_business h
  72. LEFT JOIN course_business b ON h.business_id = b.id
  73. LEFT JOIN course_education_type e ON h.education_id = e.id
  74. LEFT JOIN course_subject s on s.id = h.subject_id
  75. LEFT JOIN course_project_type t on t.id = b.project_id
  76. where 1=1
  77. <if test="handoutsId != null and handoutsId != ''">
  78. AND h.handouts_id = #{handoutsId}
  79. </if>
  80. </select>
  81. <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.CourseHandoutsQueryBo" resultMap="CourseHandoutsResult">
  82. SELECT
  83. s.*
  84. FROM
  85. course_handouts s
  86. LEFT JOIN course_handouts_business h ON s.handouts_id = h.handouts_id
  87. WHERE
  88. 1 = 1
  89. <if test="status != null and status.size()!=0 ">
  90. AND s.status in
  91. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  92. #{item}
  93. </foreach>
  94. </if>
  95. <if test="encoder != null and encoder != ''">
  96. AND s.encoder = #{encoder}
  97. </if>
  98. <if test="businessId != null and businessId != ''">
  99. AND h.business_id = #{businessId}
  100. </if>
  101. <if test="educationId != null and educationId != ''">
  102. AND h.education_id = #{educationId}
  103. </if>
  104. <if test="id != null ">
  105. AND s.handouts_id = #{id}
  106. </if>
  107. <if test="subjectId != null and subjectId != ''">
  108. AND h.subject_id = #{subjectId}
  109. </if>
  110. <if test="handoutsName != null and handoutsName != ''">
  111. AND s.handouts_name like (concat('%', #{handoutsName}, '%'))
  112. </if>
  113. <if test="key != null and key != ''">
  114. AND (s.handouts_name like (concat('%', #{key}, '%')) or s.encoder = #{key})
  115. </if>
  116. GROUP BY s.handouts_id
  117. ORDER BY s.update_time desc
  118. </select>
  119. <select id="getHandoutsByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseHandouts">
  120. SELECT * from course_handouts where encoder = #{encoder} and tenant_id = #{newTenantId}
  121. </select>
  122. <select id="queryByGoodsList" parameterType="com.zhongzheng.modules.course.bo.CourseHandoutsQueryBo" resultMap="CourseHandoutsVoResult">
  123. SELECT
  124. s.handouts_name,s.can_download,cf.*
  125. FROM
  126. course_handouts s
  127. LEFT JOIN course_file cf ON cf.handouts_id = s.handouts_id
  128. WHERE
  129. 1 = 1
  130. <if test="handoutsId != null and handoutsId != ''">
  131. AND s.handouts_id = #{handoutsId}
  132. </if>
  133. ORDER BY cf.sort
  134. </select>
  135. </mapper>