123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 |
- <?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.zhongzheng.modules.course.mapper.CourseMapper">
- <resultMap type="com.zhongzheng.modules.course.domain.Course" id="CourseResult">
- <result property="courseId" column="course_id"/>
- <result property="prefixName" column="prefix_name"/>
- <result property="coverUrl" column="cover_url"/>
- <result property="introduction" column="introduction"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="status" column="status"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="schoolId" column="school_id"/>
- <result property="courseName" column="course_name"/>
- <result property="publishStatus" column="publish_status"/>
- <result property="sort" column="sort"/>
- <result property="suitableObject" column="suitable_object"/>
- <result property="pcDetailHtml" column="pc_detail_html"/>
- <result property="mobileDetailHtml" column="mobile_detail_html"/>
- <result property="majorId" column="major_id"/>
- <result property="code" column="code"/>
- <result property="subjectId" column="subject_id"/>
- <result property="projectId" column="project_id"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseVo" id="CourseResultVo">
- <result property="courseId" column="course_id"/>
- <result property="prefixName" column="prefix_name"/>
- <result property="coverUrl" column="cover_url"/>
- <result property="introduction" column="introduction"/>
- <result property="status" column="status"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="schoolId" column="school_id"/>
- <result property="courseName" column="course_name"/>
- <result property="publishStatus" column="publish_status"/>
- <result property="sort" column="sort"/>
- <result property="suitableObject" column="suitable_object"/>
- <result property="pcDetailHtml" column="pc_detail_html"/>
- <result property="mobileDetailHtml" column="mobile_detail_html"/>
- <result property="majorId" column="major_id"/>
- <result property="code" column="code"/>
- <result property="subjectId" column="subject_id"/>
- <result property="projectId" column="project_id"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="schoolName" column="school_name"/>
- <result property="categoryName" column="category_name"/>
- <result property="subjectName" column="subject_name"/>
- <collection property="goodsList" column="course_id" select="findGoodsList"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseUserVo" id="CourseUserVo">
- <result property="courseId" column="course_id"/>
- <result property="prefixName" column="prefix_name"/>
- <result property="coverUrl" column="cover_url"/>
- <result property="gradeId" column="grade_id"/>
- <result property="introduction" column="introduction"/>
- <result property="status" column="status"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="schoolId" column="school_id"/>
- <result property="courseName" column="course_name"/>
- <result property="publishStatus" column="publish_status"/>
- <result property="sort" column="sort"/>
- <result property="suitableObject" column="suitable_object"/>
- <result property="pcDetailHtml" column="pc_detail_html"/>
- <result property="mobileDetailHtml" column="mobile_detail_html"/>
- <result property="majorId" column="major_id"/>
- <result property="code" column="code"/>
- <result property="subjectId" column="subject_id"/>
- <result property="projectId" column="project_id"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="schoolName" column="school_name"/>
- <result property="categoryName" column="category_name"/>
- <result property="subjectName" column="subject_name"/>
- <result property="examNum" column="exam_num"/>
- <result property="recordNum" column="record_num"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.goods.vo.GoodsPeriodVo" id="GoodsPeriodVo">
- <result property="goodsId" column="goods_id"/>
- <result property="year" column="year"/>
- <result property="goodsName" column="goods_name"/>
- <result property="periodStatus" column="period_status"/>
- <result property="rebuild" column="rebuild"/>
- <result property="gradeId" column="grade_id"/>
- <result property="examNum" column="exam_num"/>
- <result property="recordNum" column="record_num"/>
- <result property="applyStatus" column="apply_status"/>
- <result property="beforeStatus" column="before_status"/>
- <result property="applyName" column="apply_name"/>
- <result property="beforeName" column="before_name"/>
- <result property="rebuildNum" column="rebuildNum"/>
- <result property="rebuildStatus" column="rebuild_status"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="serviceStartTime" column="service_start_time"/>
- <result property="serviceEndTime" column="service_end_time"/>
- <result property="classStartTime" column="class_start_time"/>
- <result property="classEndTime" column="class_end_time"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.goods.vo.GoodsPeriodStatusVo" id="GoodsPeriodStatusVo">
- <result property="id" column="id"/>
- <result property="type" column="type"/>
- <result property="name" column="name"/>
- <result property="periodId" column="period_id"/>
- <result property="sectionType" column="section_type"/>
- <result property="auditReason" column="audit_reason"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.goods.vo.GoodsUserVo" id="GoodsUserVo">
- <result property="goodsId" column="goods_id"/>
- <result property="year" column="year"/>
- <result property="supplyId" column="supply_id"/>
- <result property="userId" column="user_id"/>
- <result property="goodsType" column="goods_type"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="schoolId" column="school_id"/>
- <result property="majorId" column="major_id"/>
- <result property="goodsName" column="goods_name"/>
- <result property="standPrice" column="stand_price"/>
- <result property="lowestPrice" column="lowest_price"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="status" column="status"/>
- <result property="validityStartTime" column="validity_start_time"/>
- <result property="validityEndTime" column="validity_end_time"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="certificateIds" column="certificate_ids"/>
- <result property="introduce" column="introduce"/>
- <result property="suitableObject" column="suitable_object"/>
- <result property="buyNote" column="buy_note"/>
- <result property="pcDetailHtml" column="pc_detail_html"/>
- <result property="mobileDetailHtml" column="mobile_detail_html"/>
- <result property="goodsStatus" column="goods_status"/>
- <result property="coverUrl" column="cover_url"/>
- <result property="classHours" column="class_hours"/>
- <result property="standPriceJson" column="stand_price_json"/>
- <result property="code" column="code"/>
- <result property="projectId" column="project_id"/>
- <result property="goodsAuditionConfig" column="goods_audition_config"/>
- <result property="goodsPhotographConfig" column="goods_photograph_config"/>
- <result property="goodsPlayConfig" column="goods_play_config"/>
- <result property="goodsExamConfig" column="goods_exam_config"/>
- <result property="gradeId" column="grade_id"/>
- <result property="rebuildStatus" column="rebuild_status"/>
- <result property="supplyName" column="supply_name"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="schoolName" column="school_name"/>
- <result property="categoryName" column="category_name"/>
- <result property="handoutsId" column="handouts_id"/>
- <result property="templateType" column="template_type"/>
- <result property="period" column="period"/>
- <result property="makeStartTime" column="make_start_time"/>
- <result property="makeEndTime" column="make_end_time"/>
- <result property="studyCount" column="order_study_count"/>
- <result property="makeGoodsName" column="make_goods_name"/>
- <result property="makeGoodsCode" column="make_goods_code"/>
- <result property="applyStatus" column="apply_status"/>
- <result property="beforeStatus" column="before_status"/>
- <result property="applyName" column="apply_name"/>
- <result property="beforeName" column="before_name"/>
- <result property="courseNum" column="course_num"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="profileStatus" column="profile_status"/>
- <result property="profileTpStatus" column="profile_tp_status"/>
- <result property="subExamStatus" column="sub_exam_status"/>
- <result property="subPerformance" column="sub_performance"/>
- <result property="subResult" column="sub_result"/>
- <result property="subApplySiteStartTime" column="sub_apply_site_start_time"/>
- <result property="subApplySiteEndTime" column="sub_apply_site_end_time"/>
- <result property="subApplySiteExamTime" column="sub_apply_site_exam_time"/>
- <result property="gradeId" column="grade_id"/>
- <result property="subscribeId" column="subscribe_id"/>
- <result property="serviceStartTime" column="service_start_time"/>
- <result property="serviceEndTime" column="service_end_time"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeVo" id="ClassGradeVoResult">
- <result property="gradeId" column="grade_id"/>
- <result property="classStatus" column="class_status"/>
- <result property="officialName" column="official_name"/>
- <result property="className" column="class_name"/>
- <result property="studentUpper" column="student_upper"/>
- <result property="learningTimeStart" column="learning_time_start"/>
- <result property="learningStatus" column="learning_status"/>
- <result property="status" column="status"/>
- <result property="classStartTime" column="class_start_time"/>
- <result property="classEndTime" column="class_end_time"/>
- <result property="examineId" column="examine_id"/>
- <result property="areasId" column="areas_id"/>
- <result property="sysUserId" column="sys_user_id"/>
- <result property="interfacePushId" column="interface_push_id"/>
- <result property="remark" column="remark"/>
- <result property="interfaceAccountId" column="interface_account_id"/>
- <result property="interfacePeriodId" column="interface_period_id"/>
- <result property="interfaceAccountName" column="interface_account_name"/>
- <result property="interfacePeriodName" column="interface_period_name"/>
- <result property="interfacePushName" column="interface_push_name"/>
- <result property="studentNum" column="student_num"/>
- <result property="periodStatus" column="period_status"/>
- <result property="examNum" column="exam_num"/>
- <result property="recordNum" column="record_num"/>
- <result property="interfacePushId" column="interface_push_id"/>
- <result property="interfaceAccountId" column="interface_account_id"/>
- <result property="officialLearningUrl" column="official_learning_url"/>
- <result property="learnStatus" column="learn_status"/>
- <result property="officialStatus" column="official_status"/>
- <result property="periodPlush" column="period_plush"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- </resultMap>
- <select id="findGoodsList" resultMap="CourseGoodsListResult">
- SELECT
- g.goods_name,
- g.goods_id
- FROM
- goods_course gc
- LEFT JOIN goods g ON gc.goods_id = g.goods_id
- WHERE
- gc.course_id =#{course_id}
- </select>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseGoodsVo" id="CourseGoodsListResult">
- <result property="goodsName" column="goods_name"/>
- <result property="goodsId" column="goods_id"/>
- </resultMap>
- <select id="selectCourseList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="CourseResultVo">
- SELECT
- c.*,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- s.school_name,
- m.category_name,
- cs.subject_name
- FROM
- course c
- LEFT JOIN course_education_type cet ON c.education_type_id = cet.id AND cet.status =1
- LEFT JOIN course_project_type cpt ON c.project_id = cpt.id AND cpt.status =1
- LEFT JOIN course_business cb ON c.business_id = cb.id AND cb.status =1
- LEFT JOIN school s ON s.id = c.school_id AND s.status =1
- LEFT JOIN major m ON c.major_id = m.id AND m.status =1
- LEFT JOIN course_subject cs ON cs.id = c.subject_id AND cs.status =1
- WHERE
- 1 = 1 AND c.status !=-1
- <if test="status != null and status.size()!=0 ">
- AND c.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND c.education_type_id = #{educationTypeId}
- </if>
- <if test="subjectId != null and subjectId != ''">
- AND c.subject_id = #{subjectId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND c.business_id = #{businessId}
- </if>
- <if test="prefixName != null and prefixName != ''">
- AND c.prefix_name like concat('%', #{prefixName}, '%')
- </if>
- <if test="courseName != null and courseName != ''">
- AND c.course_name like concat('%', #{courseName}, '%')
- </if>
- <if test="publishStatus != null ">
- AND c.publish_status = #{publishStatus}
- </if>
- <if test="schoolId != null and schoolId != ''">
- AND c.school_id = #{schoolId}
- </if>
- <if test="majorId != null and majorId != ''">
- AND c.major_id = #{majorId}
- </if>
- <if test="key != null and key != ''">
- AND (c.course_name like concat('%', #{key}, '%') or c.code = #{key} or c.prefix_name like concat('%', #{key}, '%'))
- </if>
- GROUP BY
- c.course_id
- ORDER BY c.create_time DESC
- </select>
- <select id="selectCourseList_COUNT" resultType="Long">
- SELECT
- count(distinct c.course_id )
- FROM
- course c
- WHERE
- 1 = 1
- <if test="status != null and status.size()!=0 ">
- AND c.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND c.education_type_id = #{educationTypeId}
- </if>
- <if test="subjectId != null and subjectId != ''">
- AND c.subject_id = #{subjectId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND c.business_id = #{businessId}
- </if>
- <if test="prefixName != null and prefixName != ''">
- AND c.prefix_name like concat('%', #{prefixName}, '%')
- </if>
- <if test="courseName != null and courseName != ''">
- AND c.course_name like concat('%', #{courseName}, '%')
- </if>
- <if test="publishStatus != null ">
- AND c.publish_status = #{publishStatus}
- </if>
- <if test="schoolId != null and schoolId != ''">
- AND c.school_id = #{schoolId}
- </if>
- <if test="majorId != null and majorId != ''">
- AND c.major_id = #{majorId}
- </if>
- <if test="key != null and key != ''">
- AND (c.course_name like concat('%', #{key}, '%') or c.code = #{key} or c.prefix_name like concat('%', #{key}, '%'))
- </if>
- </select>
- <select id="selectDetailById" parameterType="Long" resultMap="CourseResultVo">
- SELECT
- c.*,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- s.school_name,
- m.category_name,
- cs.subject_name
- FROM
- course c
- LEFT JOIN course_education_type cet ON c.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON c.project_id = cpt.id
- LEFT JOIN course_business cb ON c.business_id = cb.id
- LEFT JOIN school s ON s.id = c.school_id
- LEFT JOIN major m ON c.major_id = m.id
- LEFT JOIN course_subject cs ON cs.id = c.subject_id
- WHERE
- course_id = #{id}
- </select>
- <select id="getCourseUserVoInfo" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo" resultMap="CourseUserVo">
- SELECT
- c.*,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- s.school_name,
- m.category_name,
- cs.subject_name
- FROM
- course c
- LEFT JOIN course_education_type cet ON c.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON c.project_id = cpt.id
- LEFT JOIN course_business cb ON c.business_id = cb.id
- LEFT JOIN school s ON s.id = c.school_id
- LEFT JOIN major m ON c.major_id = m.id
- LEFT JOIN course_subject cs ON cs.id = c.subject_id
- WHERE
- course_id = #{id}
- </select>
- <select id="listGoodsPeriodVo" parameterType="com.zhongzheng.modules.user.bo.UserPlanQueryBo" resultMap="GoodsPeriodVo">
- SELECT
- g.goods_id,
- g.goods_name,
- g.`year`,
- cgu.period_status,
- (SELECT COUNT(1) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.period_status =1 and (ups.`status` =3 or ups.`status` =0) and up.grade_id = cgu.grade_id and up.user_id = cgu.user_id) as rebuild,
- (case WHEN (SELECT COUNT(1) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where up.grade_id = cgu.grade_id AND ups.period_status =1 and ups.`status` =3 and up.user_id = cgu.user_id ) >0 then 1 ELSE 0 end) as rebuild_status,
- cgu.grade_id,
- (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
- (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
- (SELECT ea.apply_name FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) as apply_name,
- (SELECT eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name,
- cgu.order_goods_id,
- og.service_start_time,
- og.service_end_time,
- cg.class_start_time,
- cg.class_end_time
- FROM
- class_grade_user cgu
- LEFT JOIN class_grade_goods cgg ON cgu.grade_id = cgg.grade_id
- LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
- LEFT JOIN goods g on g.goods_id=cgg.goods_id
- LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
- WHERE
- cgu.user_id =#{userId}
- AND cg.status=1 AND cgu.`status`=1 AND cgu.change_grade=0
- ORDER BY cgu.create_time DESC
- </select>
- <select id="listSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="GoodsPeriodStatusVo">
- SELECT
- ups.id,
- ups.period_id,
- cs.`name`,
- 1 as type,
- cs.section_type as section_type,
- ups.audit_reason
- FROM
- user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id
- LEFT JOIN course_section cs ON cs.section_id = up.section_id
- WHERE
- 1 = 1
- AND user_id = #{userId}
- AND ups.period_status = 1
- AND ups.`status` = 0
- AND up.exam_id = 0
- and up.grade_id = #{gradeId}
- UNION
- SELECT
- ups.id,
- ups.period_id,
- exam_name as name,
- 2 as type,
- 0 as section_type,
- ups.audit_reason
- FROM
- user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id
- LEFT JOIN exam e ON e.exam_id = up.exam_id
- WHERE
- 1 = 1
- AND user_id = #{userId}
- AND ups.period_status = 1
- AND ups.`status` = 0
- AND up.section_id = 0
- and up.grade_id = #{gradeId}
- </select>
- <select id="goodsRebuildStatus" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultType="Long">
- SELECT case WHEN COUNT(1) >0 then 0 ELSE 1 end FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where up.goods_id = #{goodsId} AND ups.period_status =1 and up.user_id = #{userId} and up.grade_id = #{gradeId} and ups.`status` =0
- </select>
- <select id="goodsList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="GoodsUserVo">
- SELECT
- g.*,
- o.user_id,
- og.study_count as order_study_count,
- og.order_goods_id,
- og.grade_id,
- og.service_start_time,
- og.service_end_time,
- (SELECT cet.education_name FROM course_education_type cet where cet.id = g.education_type_id) as education_name,
- (SELECT cet.project_name FROM course_project_type cet where cet.id = g.project_id) as project_name,
- (SELECT cet.business_name FROM course_business cet where cet.id = g.business_id) as business_name,
- (SELECT COUNT(1) FROM goods_course gc where gc.goods_id = g.goods_id) as course_num,
- (case WHEN (SELECT COUNT(1) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where up.goods_id = g.goods_id AND ups.period_status =1 and ups.`status` =0) >0 then 0 ELSE 1 end) as rebuild_status,
- (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = g.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
- (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = g.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
- (SELECT ea.apply_name FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = g.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) as apply_name,
- (SELECT eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = g.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name,
- (SELECT `status` from user_profile where user_id = o.user_id and goods_id = g.goods_id and current_status = 1 and type_status = 1 and order_goods_id = og.order_goods_id limit 1 ) as profile_status,
- (case WHEN(SELECT COUNT(1) from profile_tp where `status`=1 and FIND_IN_SET(g.goods_id,goods_ids) ) >0 then 1 ELSE 0 end) as profile_tp_status
- <if test="userId != null and userId != ''">
- ,
- us.exam_status as sub_exam_status,
- us.performance as sub_performance,
- us.`result` as sub_result,
- us.subscribe_id,
- us.apply_site_start_time as sub_apply_site_start_time,
- us.apply_site_end_time as sub_apply_site_end_time,
- us.apply_site_exam_time as sub_apply_site_exam_time
- </if>
- FROM
- `order` o
- LEFT JOIN order_goods og ON og.order_sn = o.order_sn
- LEFT JOIN goods g on og.goods_id = g.goods_id
- <if test="userId != null and userId != ''">
- LEFT JOIN (SELECT * from user_subscribe where subscribe_id in (SELECT MAX(subscribe_id) from user_subscribe where user_id = #{userId} and subscribe_status = 1 GROUP BY order_goods_id)) us on us.order_goods_id = og.order_goods_id
- </if>
- where 1=1
- AND og.`status` = 1
- AND og.refund_status in (0,1,3)
- AND og.pay_status in (2,3,4)
- AND g.goods_type =1
- <if test="pageNum == null">
- and (SELECT count(*) from class_grade cg where (cg.class_end_time > unix_timestamp(now()) or ISNULL(cg.class_end_time)) and cg.grade_id = og.grade_id ) >0
- </if>
- <if test="userId != null and userId != ''">
- and o.user_id = #{userId}
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND g.education_type_id = #{educationTypeId}
- </if>
- order by o.create_time desc
- </select>
- <select id="courseList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="CourseUserVo">
- SELECT
- c.*,
- #{gradeId} as grade_id,
- <if test="userId != null ">
- (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.course_id= gc.course_id and ubr.report_status=1 and ubr.grade_id = #{gradeId} and ubr.user_id = #{userId} and ubr.current_status = 1) as record_num,
- </if>
- IFNULL(ge.exam_num,0) as exam_num
- FROM
- course c
- LEFT JOIN goods_course gc ON gc.course_id = c.course_id
- LEFT JOIN (SELECT
- COUNT( m.id ) AS exam_num,
- m.course_id
- FROM
- course_menu_exam m
- where
- m.type = 1 GROUP BY m.course_id
- ) ge on gc.course_id = ge.course_id
- where 1=1
- and gc.goods_id =#{goodsId}
- order by gc.sort asc
- </select>
- <select id="courseExamNum" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="CourseUserVo">
- SELECT
- c.*,
- #{gradeId} as grade_id
- FROM
- course c
- LEFT JOIN goods_course gc ON gc.course_id = c.course_id
- where 1=1
- and gc.goods_id =#{goodsId}
- order by gc.sort asc
- </select>
- <select id="rebuildNext" parameterType="Long" resultType="Long">
- SELECT
- COUNT( 1 )
- FROM
- user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id
- WHERE
- up.goods_id = #{goodsId}
- AND up.grade_id = #{gradeId}
- AND ups.`status` = 0
- AND ups.period_status = 1
- </select>
- <select id="gradeIdSelect" parameterType="map" resultMap="ClassGradeVoResult" >
- SELECT
- (SELECT
- COUNT( m.id )
- FROM
- goods_course c LEFT JOIN course_menu_exam m ON m.course_id = c.course_id
- where
- m.type = 1
- and c.goods_id = #{goodsId}) as exam_num,
- (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
- = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
- cgu.grade_id,
- cg.class_start_time,
- cg.class_end_time,
- cg.class_status,
- cg.status,
- cg.learning_status,
- cgu.period_status,
- cg.learning_time_start,
- cgu.learn_status,
- cg.interface_account_id,
- cg.official_learning_url,
- cg.interface_push_id,
- cgu.official_status,
- cgu.period_plush,
- cgu.order_goods_id
- FROM
- class_grade_user cgu
- LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
- LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
- WHERE
- 1=1
- <if test="gradeId != null and gradeId != ''">
- and cg.grade_id = #{gradeId}
- </if>
- and cg.`status` =1 and cgg.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
- order by cg.create_time desc LIMIT 1
- </select>
- <select id="checkCourseHaveStudy" parameterType="Long" resultType="Long">
- SELECT
- count(*)
- FROM
- goods_course gc
- LEFT JOIN user_period up ON gc.goods_id = up.goods_id
- WHERE
- gc.course_id = #{courseId}
- </select>
- </mapper>
|