| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 | <?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"/>        <result column="im_group_id_" jdbcType="VARCHAR" property="imGroupId"/>    </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_, im_group_id_, 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_,im_group_id_, 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.imGroupId},#{entity.courseStartTime}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy},            #{entity.updatedTime})        </foreach>    </insert>    <select id="queryTeacherCourseGroup" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupVo">        select distinct        b.id_                         as courseGroupId,        b.name_                       as courseGroupName,        s.name_                       as subjectName,        b.teacher_id_                 as teacherId,        u.username_                  as teacherName,        b.course_start_time_          as courseStartTime,        b.single_course_minutes_      as singleCourseMinutes,        b.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,        u.avatar_ as avatar,        b.sales_start_date_           as salesStartDate,        b.sales_end_date_             as salesEndDate,        b.mix_student_num_            as mixStudentNum,        b.im_group_id_              as imGroupId,        0  as existBuy        from course_group as b        left join subject as s on b.subject_id_ = s.id_        left join sys_user as u on b.teacher_id_ = u.id_        <where>            <if test="param.teacherId != null">                and b.teacher_id_ = #{param.teacherId}            </if>            <if test="param.groupStatus != null">                and b.status_ = #{param.groupStatus}            </if>            <if test="param.subjectId != null">                AND b.subject_id_ = #{param.subjectId}            </if>            <if test="param.search != null and param.search !=''">                and  (                u.real_name_ like concat('%',#{param.search},'%')                or b.name_ like concat('%',#{param.search},'%')                )            </if>        </where>    </select>    <select id="queryStudentCourseGroup" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupVo">        select distinct b.id_                         as courseGroupId,                        b.name_                       as courseGroupName,                        s.name_                       as subjectName,                        b.teacher_id_                 as teacherId,                        u.username_                   as teacherName,                        b.course_start_time_          as courseStartTime,                        b.single_course_minutes_      as singleCourseMinutes,                        b.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,                        u.avatar_                     as avatar,                        b.sales_start_date_           as salesStartDate,                        b.sales_end_date_             as salesEndDate,                        b.mix_student_num_            as mixStudentNum,                        b.im_group_id_                as imGroupId,                        if(y.status_ = 'PAID', 1, 0)  as existBuy        from course_group as b                 left join subject as s on b.subject_id_ = s.id_                 left join sys_user as u on b.teacher_id_ = u.id_                 left join             (select x.user_id_, x.course_group_id_, o.status_              from course_schedule_student_payment as x                       left join user_order as o on x.order_no_ = o.order_no_ and x.user_id_ = o.user_id_                       left join user_order_detail as d on d.order_no_ = x.order_no_              where x.user_id_ = #{param.studentId}) as y on b.id_ = y.course_group_id_        <where>            <if test="param.teacherId != null">                and b.teacher_id_ = #{param.teacherId}            </if>            <if test="param.groupStatus != null">                and b.status_ = #{param.groupStatus}            </if>            <if test="param.subjectId != null">                AND b.subject_id_ = #{param.subjectId}            </if>            <if test="param.search != null and param.search !=''">                and  (                u.real_name_ like concat('%',#{param.search},'%')                or b.name_ like concat('%',#{param.search},'%')                )            </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,        cg.im_group_id_  as imGroupId        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.studentId != null">                and #{param.studentId} = cssp.user_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>        order by cg.id_ desc    </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>        order by  cssp.id_ desc    </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>    <select id="selectAdminLiveCourseGroup" 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,            s.name_ as subjectName        from course_group cg         left join course_schedule_student_payment cssp on cg.id_ = cssp.course_group_id_        left join subject s on cg.subject_id_ = s.id_        <where>            <if test="courseGroupId != null">                and #{courseGroupId} = cg.id_            </if>        </where>    </select>    <select id="selectAdminLiveStudentCoursePage"            resultType="com.yonge.cooleshow.biz.dal.vo.LiveCourseGroupStudentCourseVo">        select distinct        cs.id_ as courseId,        cs.class_date_ as classDate,        cs.start_time_ as startTime,        cs.end_time_ as endTime,        cs.status_ as courseStatue,        cssp.order_no_ as orderNo,        sa.id_ as studentAttendanceId        from course_schedule cs        left join course_schedule_student_payment cssp on cs.id_ = cssp.course_id_        left join student_attendance sa on cssp.course_id_ = sa.course_schedule_id_        <where>            cs.status_ !=  '${@ com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum@CANCEL}'            <if test="param.studentId != null">                and cssp.user_id_ = #{param.studentId}            </if>            <if test="param.status != null">                <choose>                    <when test="param.status == @com.yonge.cooleshow.biz.dal.enums.StudentCourseEnum@TRUANT">                        and sa.id_ is null                    </when>                    <when test="param.status == @com.yonge.cooleshow.biz.dal.enums.StudentCourseEnum@ATTENDCLASS">                        and sa.id_ is not null                        and #{param.studentId} = sa.student_id_                    </when>                    <when test="param.status == @com.yonge.cooleshow.biz.dal.enums.StudentCourseEnum@NOTSTART">                        and cs.status_ = '${@ com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum@NOT_START}'                    </when>                </choose>            </if>            <if test="param.courseGroupId != null">                and #{param.courseGroupId} = cs.course_group_id_            </if>            <if test="param.courseId != null">                and cs.id_ like concat('%',#{param.courseId},'%')            </if>        </where>        order by  cs.id_ desc    </select>    <update id="opsPreStudentNum">        update course_group        set            pre_student_num_ = pre_student_num_ + #{num}        where id_ = #{id}    </update></mapper>
 |