CourseHandoutsMapper.xml 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. </resultMap>
  14. <resultMap type="com.zhongzheng.modules.course.domain.CourseHandoutsBusiness" id="CourseHandoutsBusinessResult">
  15. <result property="id" column="id"/>
  16. <result property="educationId" column="education_id"/>
  17. <result property="businessId" column="business_id"/>
  18. <result property="createTime" column="create_time"/>
  19. <result property="updateTime" column="update_time"/>
  20. <result property="handoutsId" column="handouts_id"/>
  21. </resultMap>
  22. <resultMap type="com.zhongzheng.modules.course.vo.CourseHandoutsBusinessVo" id="CourseHandoutsBusinessVoResult">
  23. <result property="id" column="id"/>
  24. <result property="educationId" column="education_id"/>
  25. <result property="businessId" column="business_id"/>
  26. <result property="educationName" column="education_name"/>
  27. <result property="businessName" column="business_name"/>
  28. <result property="handoutsId" column="handouts_id"/>
  29. <result property="subjectName" column="subject_name"/>
  30. <result property="projectName" column="project_name"/>
  31. <result property="projectId" column="project_id"/>
  32. </resultMap>
  33. <select id="selectEntity" parameterType="Long" resultMap="CourseHandoutsBusinessVoResult">
  34. SELECT
  35. h.*,
  36. b.business_name,
  37. e.education_name,
  38. s.subject_name,
  39. t.project_name,
  40. t.id as project_id
  41. FROM
  42. course_handouts_business h
  43. LEFT JOIN course_business b ON h.business_id = b.id
  44. LEFT JOIN course_education_type e ON h.education_id = e.id
  45. LEFT JOIN course_subject s on s.id = h.subject_id
  46. LEFT JOIN course_project_type t on t.id = b.project_id
  47. where 1=1
  48. <if test="handoutsId != null and handoutsId != ''">
  49. AND h.handouts_id = #{handoutsId}
  50. </if>
  51. </select>
  52. <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.CourseHandoutsQueryBo" resultMap="CourseHandoutsResult">
  53. SELECT
  54. s.*
  55. FROM
  56. course_handouts s
  57. LEFT JOIN course_handouts_business h ON s.handouts_id = h.handouts_id
  58. WHERE
  59. 1 = 1
  60. <if test="status != null and status.size()!=0 ">
  61. AND s.status in
  62. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  63. #{item}
  64. </foreach>
  65. </if>
  66. <if test="encoder != null and encoder != ''">
  67. AND s.encoder = #{encoder}
  68. </if>
  69. <if test="businessId != null and businessId != ''">
  70. AND h.business_id = #{businessId}
  71. </if>
  72. <if test="educationId != null and educationId != ''">
  73. AND h.education_id = #{educationId}
  74. </if>
  75. <if test="id != null and id != ''">
  76. AND s.handouts_id = #{id}
  77. </if>
  78. <if test="subjectId != null and subjectId != ''">
  79. AND h.subject_id = #{subjectId}
  80. </if>
  81. <if test="handoutsName != null and handoutsName != ''">
  82. AND s.handouts_name like (concat('%', #{handoutsName}, '%'))
  83. </if>
  84. <if test="key != null and key != ''">
  85. AND (s.handouts_name like (concat('%', #{key}, '%')) or s.encoder = #{key})
  86. </if>
  87. GROUP BY s.handouts_id
  88. ORDER BY s.update_time desc
  89. </select>
  90. </mapper>