123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.yonge.cooleshow.biz.dal.dao.CourseGroupDao">
- <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.CourseGroup">
- <id column="id_" jdbcType="BIGINT" property="id"/>
- <result column="type_" jdbcType="VARCHAR" property="type"/>
- <result column="teacher_id_" jdbcType="INTEGER" property="teacherId"/>
- <result column="name_" jdbcType="VARCHAR" property="name"/>
- <result column="subject_id_" jdbcType="INTEGER" property="subjectId"/>
- <result column="single_course_minutes_" jdbcType="INTEGER" property="singleCourseMinutes"/>
- <result column="course_num_" jdbcType="INTEGER" property="courseNum"/>
- <result column="complete_course_num_" jdbcType="INTEGER" property="completeCourseNum"/>
- <result column="course_introduce_" jdbcType="VARCHAR" property="courseIntroduce"/>
- <result column="course_price_" jdbcType="VARCHAR" property="coursePrice"/>
- <result column="status_" jdbcType="VARCHAR" property="status"/>
- <result column="sales_start_date_" jdbcType="TIMESTAMP" property="salesStartDate"/>
- <result column="sales_end_date_" jdbcType="TIMESTAMP" property="salesEndDate"/>
- <result column="background_pic_" jdbcType="VARCHAR" property="backgroundPic"/>
- <result column="mix_student_num_" jdbcType="INTEGER" property="mixStudentNum"/>
- <result column="course_start_time_" jdbcType="TIMESTAMP" property="courseStartTime"/>
- <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
- <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
- <result column="updated_by_" jdbcType="INTEGER" property="updatedBy"/>
- <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
- <result column="pre_student_num_" jdbcType="INTEGER" property="preStudentNum"/>
- </resultMap>
- <sql id="Base_Column_List">
- id_
- , type_, teacher_id_, name_, subject_id_, single_course_minutes_, course_num_, complete_course_num_, course_introduce_, course_price_, status_, sales_start_date_, sales_end_date_, background_pic_, mix_student_num_,pre_student_num_, course_start_time_, created_by_, created_time_, updated_by_, updated_time_
- </sql>
- <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
- parameterType="com.yonge.cooleshow.biz.dal.entity.CourseGroup">
- insert into course_group(type_, teacher_id_, name_, subject_id_, single_course_minutes_, course_num_,
- complete_course_num_, course_introduce_, course_price_, status_, sales_start_date_, sales_end_date_, background_pic_,
- mix_student_num_,pre_student_num_, course_start_time_, created_by_, created_time_, updated_by_, updated_time_)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.type}, #{entity.teacherId}, #{entity.name}, #{entity.subjectId}, #{entity.singleCourseMinutes},
- #{entity.courseNum}, #{entity.completeCourseNum}, #{entity.courseIntroduce}, #{entity.coursePrice}, #{entity.status},
- #{entity.salesStartDate}, #{entity.salesEndDate}, #{entity.backgroundPic}, #{entity.mixStudentNum},
- #{entity.preStudentNum},#{entity.courseStartTime}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy},
- #{entity.updatedTime})
- </foreach>
- </insert>
- <select id="queryTeacherCourseGroup" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupVo">
- select
- b.id_ as courseGroupId,
- b.name_ as courseGroupName,
- s.name_ as subjectName,
- a.teacher_id_ as teacherId,
- u.real_name_ as teacherName,
- b.course_start_time_ as courseStartTime,
- b.single_course_minutes_ as singleCourseMinutes,
- a.status_ as `status`,
- ifnull(b.pre_student_num_, 0) as studentCount,
- b.background_pic_ as backgroundPic,
- b.course_price_ as coursePrice,
- b.course_num_ as courseNum
- from course_group as b
- left join course_schedule as a on a.course_group_id_ = b.id_
- left join subject as s on b.subject_id_ = s.id_
- left join sys_user as u on a.teacher_id_ = u.id_
- <where>
- a.lock_ = 0
- <if test="param.teacherId != null">
- and b.teacher_id_ = #{param.teacherId}
- </if>
- <if test="param.status != null">
- and a.status_ = #{param.status}
- </if>
- <if test="param.groupStatus != null">
- and b.status_ = #{param.groupStatus}
- </if>
- <if test="param.type_ != null">
- and a.type_ = #{param.type}
- </if>
- <if test="param.startDate != null">
- AND <![CDATA[ a.class_date_ >= #{param.startDate} ]]>
- </if>
- <if test="param.endDate != null">
- AND <![CDATA[ a.class_date_ <= #{param.endDate} ]]>
- </if>
- <if test="param.subjectId != null">
- AND b.subject_id_ = #{param.subjectId}
- </if>
- </where>
- </select>
- <select id="selectAdminLivePage" resultType="com.yonge.cooleshow.biz.dal.vo.LiveCourseGroupVo">
- select distinct
- cg.id_ as courseGroupId,
- cg.name_ as name,
- cg.complete_course_num_ as endCourseNum,
- if(cg.complete_course_num_ = 0 ,cg.course_num_,cg.course_num_ - cg.complete_course_num_) as noStartCourseNum,
- cg.course_price_ as coursePrice,
- cg.pre_student_num_ as preStudentNum,
- cg.status_ as status,
- cg.course_num_ as courseNum,
- cg.created_time_ as createTime,
- cg.course_introduce_ as courseIntroduce
- from course_group cg
- left join course_schedule_student_payment cssp on cg.id_ = cssp.course_group_id_
- <if test="param.search != null and param.search != ''">
- left join sys_user su on su.id_ = cssp.user_id_
- </if>
- <where>
- <if test="param.teacherId != null">
- and #{param.teacherId} = cg.teacher_id_
- </if>
- <if test="param.search != null and param.search !=''">
- and (
- cg.id_ like concat('%',#{param.search},'%')
- or su.id_ like concat('%',#{param.search},'%')
- or su.username_ like concat('%',#{param.search},'%')
- or su.phone_ like concat('%',#{param.search},'%')
- )
- </if>
- <if test="param.orderNo != null and param.orderNo != ''">
- and cssp.order_no_ like concat('%',#{param.orderNo},'%')
- </if>
- <if test="param.subjectId != null">
- and #{param.subjectId} = cg.subject_id_
- </if>
- <if test="param.status != null">
- and #{param.status} = cg.status_
- </if>
- <if test="param.startTime != null">
- and #{param.startTime} <= cg.created_time_
- </if>
- <if test="param.endTime != null">
- and #{param.endTime} >= cg.created_time_
- </if>
- <if test="param.courseType != null">
- and #{param.courseType} = cg.type_
- </if>
- </where>
- </select>
- <select id="selectCourseGroupSubject" resultType="com.yonge.cooleshow.biz.dal.vo.LiveCourseGroupVo">
- select
- cg.id_ as courseGroupId,
- s.name_ as subjectName
- from course_group cg
- left join subject s on cg.subject_id_ = s.id_
- <where>
- <if test="courseGroupIdList != null and courseGroupIdList.size() != 0">
- and cg.id_ in
- <foreach collection="courseGroupIdList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </where>
- <if test="courseGroupIdList != null and courseGroupIdList.size() != 0">
- order by field(cg.id_,
- <foreach collection="courseGroupIdList" item="item" open="" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectAdminLiveStudentPage" resultType="com.yonge.cooleshow.biz.dal.vo.LiveCourseGroupStudentVo">
- select
- su.id_ as studentId,
- su.username_ as studentName,
- cssp.actual_price_ as price,
- cssp.order_no_ as orderNo,
- cssp.created_time_ as payTime
- from course_schedule_student_payment cssp
- left join sys_user su on cssp.user_id_ = su.id_
- <where>
- <if test="param.courseGroupId != null">
- and #{param.courseGroupId} = cssp.course_group_id_
- </if>
- <if test="param.search != null and param.search != ''">
- and (
- cssp.course_group_id_ like concat('%',#{param.search},'%')
- or su.id_ like concat('%',#{param.search},'%')
- or su.username_ like concat('%',#{param.search},'%')
- or su.phone_ like concat('%',#{param.search},'%')
- )
- </if>
- <if test="param.orderNo != null and param.orderNo != ''">
- and cssp.order_no_ like concat('%',#{param.orderNo},'%')
- </if>
- <if test="param.startTime != null">
- and #{param.startTime} <= cssp.created_time_
- </if>
- <if test="param.endTime != null">
- and #{param.endTime} >= cssp.created_time_
- </if>
- </where>
- </select>
- <select id="selectAdminLivePlan" resultType="com.yonge.cooleshow.biz.dal.vo.LiveCourseGroupPlanVo">
- select
- cs.id_ as courseId,
- cs.class_num_ as classNum,
- cs.class_date_ as classDate,
- cs.start_time_ as startTime,
- cs.end_time_ as endTime,
- cs.status_ as courseStatus,
- cp.plan_ as planInfo,
- lrv.url_ as videoUrl
- from course_schedule cs
- left join live_room_video lrv on cs.id_ = lrv.course_id_
- left join course_plan cp on cp.course_group_id_ = cs.course_group_id_ and cp.class_num_ = cs.class_num_
- <where>
- <if test="courseGroupId != null">
- and #{courseGroupId} = cs.course_group_id_
- </if>
- </where>
- order by cs.class_num_
- </select>
- </mapper>
|