CourseHandoutsMapper.xml 3.5 KB

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