| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019 |
- <?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"/>
- <result property="courseShow" column="course_show"/>
- <result property="firstChoice" column="first_choice"/>
- <result property="certificateTypeId" column="certificate_type_id"/>
- <result property="certificateId" column="certificate_id"/>
- <result property="certificateTpId" column="certificate_tp_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"/>
- <result property="courseShow" column="course_show"/>
- <result property="firstChoice" column="first_choice"/>
- <result property="certificateTypeId" column="certificate_type_id"/>
- <result property="certificateId" column="certificate_id"/>
- <result property="certificateTpId" column="certificate_tp_id"/>
- <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"/>
- <result property="externalLink" column="external_link"/>
- <result property="externalLinkStatus" column="external_link_status"/>
- <result property="learningStatus" column="learning_status"/>
- <result property="classStatus" column="class_status"/>
- <result property="learningTimeStart" column="learning_time_start"/>
- <result property="interfacePushId" column="interface_push_id"/>
- <result property="officialStatus" column="official_status"/>
- <result property="businessId" column="business_id"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="officialName" column="official_name"/>
- </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="sectionMaxNum" column="section_max_num"/>
- <result property="externalLink" column="external_link"/>
- <result property="externalLinkStatus" column="external_link_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="sevenYear" column="seven_year"/>
- <result property="orderYear" column="order_year"/>
- <result property="ogCreateTime" column="og_create_time"/>
- <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"/>
- <result property="subjectNames" column="subject_names"/>
- <result property="sectionNum" column="section_num"/>
- <result property="goodsLearningOrder" column="goods_learning_order"/>
- <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="startTime" column="start_time"/>
- <result property="endTime" column="end_time"/>
- <result property="openGoodsTime" column="open_goods_time"/>
- <result property="oldOrderSn" column="old_order_sn"/>
- </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"/>
- <result property="officialName" column="official_name"/>
- <result property="userId" column="user_id"/>
- <result property="periodWaitTime" column="period_wait_time"/>
- </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 AND c.course_show =1 AND c.first_choice =0
- <if test="subjectIds != null and subjectIds.size()!=0 ">
- AND c.subject_id in
- <foreach collection="subjectIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <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 AND c.status !=-1 AND c.course_show =1 AND c.first_choice =0
- <if test="subjectIds != null and subjectIds.size()!=0 ">
- AND c.subject_id in
- <foreach collection="subjectIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <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 = og.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 = og.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 eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = og.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,
- cg.learning_status,
- cgu.official_status,
- cg.learning_time_start,
- cg.class_status,
- cg.interface_push_id,
- cb.business_name,
- g.business_id,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- cg.official_name,
- g.external_link,
- g.external_link_status
- FROM
- class_grade_user cgu
- LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
- LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
- LEFT JOIN goods g on g.goods_id=og.goods_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- WHERE
- cgu.user_id =#{userId}
- AND cg.status=1 AND cgu.`status`=1 AND cgu.change_grade=0
- <if test="educationTypeId != null and educationTypeId != ''">
- AND g.education_type_id = #{educationTypeId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- 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}
- and (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
- 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}
- and (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
- </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,
- og.create_time as og_create_time,
- og.seven_year as order_year,
- cb.goods_learning_order,
- (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,
- <if test="querySign == null or querySign == 0">
- (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,
- </if>
- (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id LEFT JOIN exam_apply_user eau on eau.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 limit 1) 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="querySign == null or querySign == 0">
- (SELECT GROUP_CONCAT(subject_name) from course_subject where FIND_IN_SET(id,g.subject_ids)) subject_names,
- </if>
- (SELECT count(*) from user_study_record usr where usr.user_id = o.user_id and usr.order_goods_id = og.order_goods_id) as study_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
- LEFT JOIN course_business cb on g.business_id = cb.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.refund_status in (0,3)
- AND og.pay_status in (2,3,4)
- AND g.goods_type =1
- <if test="orderGoodsIds != null and orderGoodsIds.size()!=0 ">
- AND og.order_goods_id in
- <foreach collection="orderGoodsIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="goodsStudyProgressList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="GoodsUserVo">
- SELECT
- g.*,
- u.realname,
- u.id_card,
- u.telphone,
- o.user_id,
- og.order_goods_id,
- og.grade_id,
- IFNULL(ge.exam_num,0) as exam_num,
- og.create_time as open_goods_time,
- (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.`type` in (1,3) and ubr.report_status=1 and ubr.grade_id = og.grade_id and ubr.user_id = o.user_id and ubr.current_status = 1) as record_num,
- (SELECT cgu.period_wait_time FROM class_grade_user cgu where cgu.`status`=1 and cgu.grade_id = og.grade_id and cgu.user_id = o.user_id and cgu.order_goods_id = og.order_goods_id) as end_time,
- oi.old_order_sn
- FROM
- `order` o
- LEFT JOIN `user` u ON u.user_id = o.user_id
- LEFT JOIN order_goods og ON og.order_sn = o.order_sn
- LEFT JOIN goods g on og.goods_id = g.goods_id
- LEFT JOIN course_business cb on g.business_id = cb.id
- LEFT JOIN order_input oi on oi.input_order_sn = o.input_order_sn
- LEFT JOIN (SELECT
- COUNT( m.id ) AS exam_num,
- c.goods_id
- FROM
- course_menu_exam m
- LEFT JOIN goods_course c ON m.course_id = c.course_id
- where
- m.type in (1,3)
- GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
- where 1=1
- AND og.`status` = 1
- -- AND og.refund_status in (0,1,3)
- AND og.refund_status in (0,3)
- AND og.pay_status in (2,3,4)
- AND g.goods_type =1
- <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>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="orderGoodsId != null and orderGoodsId != ''">
- AND og.order_goods_id = #{orderGoodsId}
- </if>
- <if test="goodsId != null and goodsId != ''">
- AND og.goods_id = #{goodsId}
- </if>
- <if test="oldCompanyId != null and oldCompanyId != ''">
- AND o.old_company_id = #{oldCompanyId}
- </if>
- <if test="oldInstitutionId != null and oldInstitutionId != ''">
- AND o.old_institution_id = #{oldInstitutionId}
- </if>
- <if test="oldCustomerId != null and oldCustomerId != ''">
- AND o.old_customer_id = #{oldCustomerId}
- </if>
- <if test="userId != null and userId != ''">
- and o.user_id = #{userId}
- </if>
- <if test="realname != null and realname !='' ">
- AND u.realname like concat('%', #{realname}, '%')
- </if>
- <if test="idCard != null and idCard !='' ">
- AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="telphone != null and telphone !='' ">
- AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="oldOrderSn != null and oldOrderSn != ''">
- AND oi.old_order_sn = #{oldOrderSn}
- </if>
- <if test="studyFinishStatus != null and studyFinishStatus == 1">
- AND (SELECT cgu.period_wait_time FROM class_grade_user cgu where cgu.`status`=1 and cgu.grade_id = og.grade_id and cgu.user_id = o.user_id and cgu.order_goods_id = og.order_goods_id) >0
- </if>
- <if test="studyFinishStatus != null and studyFinishStatus == 2">
- AND (SELECT cgu.period_wait_time FROM class_grade_user cgu where cgu.`status`=1 and cgu.grade_id = og.grade_id and cgu.user_id = o.user_id and cgu.order_goods_id = og.order_goods_id) is null
- </if>
- order by og.create_time desc
- </select>
- <select id="goodsHandoutsList" 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.service_start_time,
- og.service_end_time,
- cb.goods_learning_order,
- (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 GROUP_CONCAT(subject_name) from course_subject where FIND_IN_SET(id,g.subject_ids)) subject_names
- 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
- LEFT JOIN course_business cb on g.business_id = cb.id
- where 1=1
- AND og.`status` = 1
- -- AND og.refund_status in (0,1,3)
- AND og.refund_status in (0,3)
- AND og.pay_status in (2,3,4)
- AND g.goods_type =8
- <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>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="orderGoodsId != null and orderGoodsId != ''">
- AND og.order_goods_id = #{orderGoodsId}
- </if>
- <if test="goodsId != null and goodsId != ''">
- AND og.goods_id = #{goodsId}
- </if>
- order by og.create_time desc
- </select>
- <select id="courseList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="CourseUserVo">
- SELECT
- c.*,
- #{gradeId} as grade_id,
- cs.subject_name,
- <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.`type` in (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 course_subject cs ON cs.id = c.subject_id
- LEFT JOIN (SELECT
- COUNT( m.id ) AS exam_num,
- m.course_id
- FROM
- course_menu_exam m
- where
- m.type in (1,3) 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 in (1,3)
- 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 where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_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,
- cg.official_name,
- cgu.period_wait_time
- FROM
- class_grade_user cgu
- LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
- LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
- WHERE
- 1=1
- <if test="gradeId != null and gradeId != ''">
- and cg.grade_id = #{gradeId}
- </if>
- <if test="orderGoodsId != null and orderGoodsId != ''">
- and cgu.order_goods_id = #{orderGoodsId}
- </if>
- and cg.`status` =1 and og.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
- order by cg.create_time desc LIMIT 1
- </select>
- <select id="gradeIdSelectTenant" 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 in (1,3)
- 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 where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_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,
- cg.official_name
- FROM
- class_grade_user cgu
- LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
- LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
- WHERE
- 1=1 and cgu.tenant_id = #{tenantId}
- and cg.tenant_id = #{tenantId}
- and og.tenant_id = #{tenantId}
- <if test="gradeId != null and gradeId != ''">
- and cg.grade_id = #{gradeId}
- </if>
- and cg.`status` =1 and og.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
- user_period up
- LEFT JOIN goods_course gc ON gc.goods_id = up.goods_id
- WHERE
- gc.course_id = #{courseId}
- </select>
- <select id="gradeIdUserSelect" parameterType="map" resultMap="ClassGradeVoResult" >
- SELECT
- (SELECT
- ifnull(COUNT( m.id ),0)
- FROM
- goods_course c LEFT JOIN course_menu_exam m ON m.course_id = c.course_id
- where
- m.type in (1,3)
- and c.goods_id = #{goodsId}) as exam_num,
- (SELECT ifnull(COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id),0) FROM user_bank_record ubr where ubr.`status`=1 and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id 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,
- cgu.user_id,
- cgu.order_goods_id
- FROM
- class_grade_user cgu
- LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
- WHERE
- 1=1
- <if test="gradeId != null and gradeId != ''">
- and cg.grade_id = #{gradeId}
- </if>
- and cg.`status` =1 and cgu.change_grade = 0 and cgu.`status` = 1
- </select>
- <select id="getCourseByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.Course">
- select * from course where code = #{code} and tenant_id = #{newTenantId}
- </select>
- <select id="getCourseByNotTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.course.domain.Course">
- select * from course where course_id = #{cid}
- </select>
- <select id="getCourseByTenantTwo" parameterType="map" resultType="java.lang.Long">
- select * from course where course_name = #{courseName} and code = #{code} and tenant_id = #{tenantId}
- </select>
- <select id="getSpecialQuestionList" parameterType="com.zhongzheng.modules.order.bo.SpecialQuestionBo" resultType="com.zhongzheng.modules.order.vo.SpecialQuestionVo">
- SELECT
- g.goods_id,
- g.cover_url,
- gqr.id as qsId,
- og.order_goods_id,
- o.order_sn,
- g.`year`,
- g.goods_type,
- g.education_type_id,
- g.project_id,
- g.business_id,
- g.major_id,
- g.goods_name,
- g.tenant_id,
- CONCAT( cb.business_name, cpt.project_name ) AS businessName,
- og.service_start_time,
- og.service_end_time
- FROM
- `order` o
- LEFT JOIN order_goods og ON og.order_sn = o.order_sn
- LEFT JOIN goods_question_rel gqr ON og.order_goods_id = gqr.qs_order_goods_id
- LEFT JOIN goods g ON og.goods_id = g.goods_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN question_merchant qm ON g.question_merchant_id = qm.merchant_id
- WHERE
- o.`status` = 1
- AND og.refund_status != 2
- AND og.pay_status IN ( 2, 3, 4 )
- AND g.goods_type = 9
- AND o.user_id = #{userId}
- <if test="questionMerchantId != null and questionMerchantId != ''">
- AND g.question_merchant_id = #{questionMerchantId}
- </if>
- </select>
- <select id="getSpecialQuestionCount" parameterType="com.zhongzheng.modules.order.bo.SpecialQuestionBo" resultType="java.lang.Long">
- SELECT
- count(distinct g.goods_id)
- 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
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN question_merchant qm ON g.question_merchant_id = qm.merchant_id
- WHERE
- o.`status` = 1
- AND og.refund_status != 2
- AND og.pay_status IN ( 2, 3, 4 )
- AND g.goods_type = 9
- AND o.user_id = #{userId}
- <if test="questionMerchantId != null and questionMerchantId != ''">
- AND g.question_merchant_id = #{questionMerchantId}
- </if>
- </select>
- <select id="getOrderGoodsIds" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultType="java.lang.Long">
- SELECT
- og.order_goods_id
- 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
- LEFT JOIN course_business cb on g.business_id = cb.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.refund_status in (0,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>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="orderGoodsId != null and orderGoodsId != ''">
- AND og.order_goods_id = #{orderGoodsId}
- </if>
- <if test="goodsId != null and goodsId != ''">
- AND og.goods_id = #{goodsId}
- </if>
- <if test="studyStatus != null and studyStatus == 3">
- and (SELECT count(*) from class_grade_user cgu where cgu.user_id = o.user_id and cgu.grade_id = og.grade_id and cgu.period_status != -1) >0
- </if>
- <if test="studyStatus != null and studyStatus == 2">
- and (SELECT count(*) from class_grade_user cgu where cgu.user_id = o.user_id and cgu.grade_id = og.grade_id and cgu.period_status = -1) >0
- and (SELECT count(*) from user_study_record usr where usr.user_id = o.user_id and usr.order_goods_id = og.order_goods_id ) >0
- </if>
- <if test="studyStatus != null and studyStatus == 1">
- and (SELECT count(*) from user_study_record usr where usr.user_id = o.user_id and usr.order_goods_id = og.order_goods_id ) =0
- </if>
- order by og.create_time desc
- </select>
- </mapper>
|