TenantCloudCourseRecordMapper.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ym.mec.biz.dal.dao.TenantCloudCourseRecordDao">
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantCloudCourseRecord">
  5. <id column="id_" jdbcType="INTEGER" property="id"/>
  6. <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
  7. <result column="course_id_" jdbcType="INTEGER" property="courseId"/>
  8. <result column="deduct_state_" jdbcType="INTEGER" property="deductState"/>
  9. <result column="amount_" jdbcType="VARCHAR" property="amount"/>
  10. <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
  11. <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
  12. </resultMap>
  13. <sql id="Base_Column_List">
  14. id_
  15. , tenant_id_,course_id_, deduct_state_, amount_,created_by_, created_time_
  16. </sql>
  17. <select id="queryPage" parameterType="map" resultType="com.ym.mec.biz.dal.vo.TenantCloudCourseRecordVo">
  18. select a.id_ as id,
  19. b.id_ as courseId,
  20. o.name_ as organName,
  21. t.id_ as tenantId,
  22. t.name_ as tenantName,
  23. b.type_ as type,
  24. s.real_name_ as teacherName,
  25. b.student_num_ as studentNum,
  26. b.class_date_ as classDate,
  27. b.start_class_time_ as startClassTime,
  28. b.end_class_time_ as endClassTime,
  29. b.status_ as `status`,
  30. a.deduct_state_ as deductState,
  31. a.amount_ as amount
  32. from tenant_info as t
  33. join tenant_cloud_course_record as a on t.id_ = a.tenant_id_
  34. left join course_schedule as b on a.course_id_ = b.id_
  35. left join sys_user as s on b.teacher_id_ = s.id_
  36. left join organization as o on o.id_ = b.organ_id_
  37. <where> 1 = 1
  38. <if test="param.tenantId != null ">
  39. AND t.id_ = #{param.tenantId}
  40. </if>
  41. <if test="param.search != null ">
  42. AND (
  43. b.`id_` LIKE CONCAT('%', #{param.search},'%')
  44. OR b.`name_` LIKE CONCAT('%', #{param.search},'%')
  45. )
  46. </if>
  47. <if test="param.type != null ">
  48. AND b.type_ = #{param.type}
  49. </if>
  50. <if test="param.orgId != null ">
  51. AND o.id_= #{param.orgId}
  52. </if>
  53. <if test="param.teacherName != null ">
  54. AND s.real_name_ = #{param.teacherName}
  55. </if>
  56. <if test="param.teacherId!= null ">
  57. AND b.teacher_id_ = #{param.teacherId}
  58. </if>
  59. <if test="param.deductState != null ">
  60. AND a.deduct_state_ = #{param.deductState}
  61. </if>
  62. <if test="param.status != null ">
  63. AND b.status_ = #{param.status}
  64. </if>
  65. <if test="param.deductState != null ">
  66. AND a.deduct_state_ = #{param.deductState}
  67. </if>
  68. <if test="param.startDate != null">
  69. AND b.class_date_ <![CDATA[ >= ]]> #{param.startDate}
  70. </if>
  71. <if test="param.endDate != null ">
  72. AND b.`class_date_` <![CDATA[ <= ]]> #{param.endDate}
  73. </if>
  74. <if test="param.ids != null ">
  75. AND a.id_ IN
  76. <foreach collection="ids" item="id" open="(" close=")" separator=",">
  77. #{id}
  78. </foreach>
  79. </if>
  80. </where>
  81. </select>
  82. </mapper>