12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262 |
- <?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.grade.mapper.ClassGradeUserMapper">
- <resultMap type="com.zhongzheng.modules.grade.domain.ClassGradeUser" id="ClassGradeUserResult">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="gradeId" column="grade_id"/>
- <result property="status" column="status"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="createBy" column="create_by"/>
- <result property="fromType" column="from_type"/>
- <result property="periodStatus" column="period_status"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="finishStatus" column="finish_status"/>
- <result property="officialStatus" column="official_status"/>
- <result property="learnStatus" column="learn_status"/>
- <result property="periodPlush" column="period_plush"/>
- <result property="periodTime" column="period_time"/>
- <result property="periodWaitTime" column="period_wait_time"/>
- <result property="changeGrade" column="change_grade"/>
- <result property="officialStatusMsg" column="official_status_msg"/>
- <result property="periodPlushMsg" column="period_plush_msg"/>
- <result property="officialStatusTime" column="official_status_time"/>
- <result property="periodPlushTime" column="period_plush_time"/>
- <result property="officialStatusNum" column="official_status_num"/>
- <result property="periodStatusNum" column="period_status_num"/>
- <result property="periodIngTime" column="period_ing_time"/>
- <result property="auditUserName" column="audit_user_name"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeUserVo" id="ClassGradeUserVoResult">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="gradeId" column="grade_id"/>
- <result property="className" column="class_name"/>
- <result property="status" column="status"/>
- <result property="code" column="user_account"/>
- <result property="realName" column="realname"/>
- <result property="idCard" column="id_card"/>
- <result property="createBy" column="create_by"/>
- <result property="telPhone" column="telphone"/>
- <result property="changeGrade" column="change_grade"/>
- <result property="interfacePushId" column="interface_push_id"/>
- <result property="classStatus" column="class_status"/>
- <result property="officialName" column="official_name"/>
- <result property="classStartTime" column="class_start_time"/>
- <result property="classEndTime" column="class_end_time"/>
- <result property="officialStatusNum" column="official_status_num"/>
- <result property="periodTime" column="period_time"/>
- <result property="periodWaitTime" column="period_wait_time"/>
- <result property="periodStatus" column="period_status"/>
- <result property="periodStatusNum" column="period_status_num"/>
- <result property="periodIngTime" column="period_ing_time"/>
- <result property="finishStatus" column="finish_status"/>
- <result property="learnStatus" column="learn_status"/>
- <result property="reason" column="reason"/>
- <result property="interfaceAccountId" column="interface_account_id"/>
- <result property="noInterfaceAccountId" column="no_interface_account_id"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo" id="ClassGradeUserGoodsVoResult">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="gradeId" column="grade_id"/>
- <result property="status" column="status"/>
- <result property="goodsCode" column="goods_code"/>
- <result property="goodsName" column="goods_name"/>
- <result property="gradeStatus" column="grade_status"/>
- <result property="gradeCode" column="grade_code"/>
- <result property="gradeName" column="grade_name"/>
- <result property="year" column="year"/>
- <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="createTime" column="create_time"/>
- <result property="createBy" column="create_by"/>
- <result property="goodsId" column="goods_id"/>
- <result property="classStartTime" column="class_start_time"/>
- <result property="classEndTime" column="class_end_time"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodStudentVo" id="ClassPeriodStudentVo">
- <result property="userId" column="user_id"/>
- <result property="gradeId" column="grade_id"/>
- <result property="studentCode" column="user_account"/>
- <result property="realName" column="realname"/>
- <result property="idCard" column="id_card"/>
- <result property="telPhone" column="telphone"/>
- <result property="status" column="status"/>
- <result property="classHours" column="class_hours"/>
- <result property="periodStatus" column="period_status"/>
- <result property="secAllNum" column="sec_all_num"/>
- <result property="examNum" column="exam_num"/>
- <result property="recordNum" column="record_num"/>
- <result property="periodPlush" column="period_plush"/>
- <result property="startTime" column="start_time"/>
- <result property="endTime" column="end_time"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="rebuildNum" column="rebuild_num"/>
- <result property="profileStatus" column="profile_status"/>
- <result property="className" column="class_name"/>
- <result property="goodsName" column="goods_name"/>
- <result property="standPrice" column="stand_price"/>
- <result property="goodsCode" column="goods_code"/>
- <result property="keyValue" column="key_value"/>
- <result property="classStartTime" column="class_start_time"/>
- <result property="classEndTime" column="class_end_time"/>
- <result property="periodStatusNum" column="period_status_num"/>
- <result property="serviceStartTime" column="service_start_time"/>
- <result property="serviceEndTime" column="service_end_time"/>
- <result property="oneInchPhotos" column="one_inch_photos"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">
- <result property="userId" column="user_id"/>
- <result property="studentCode" column="user_account"/>
- <result property="realName" column="realname"/>
- <result property="oneInchPhotos" column="one_inch_photos"/>
- <result property="idCardImg1" column="id_card_img1"/>
- <result property="idCardImg2" column="id_card_img2"/>
- <result property="idCard" column="id_card"/>
- <result property="telPhone" column="telphone"/>
- <result property="secAllNum" column="sec_all_num"/>
- <result property="examNum" column="exam_num"/>
- <result property="recordNum" column="record_num"/>
- <result property="pass" column="pass"/>
- <result property="cheat" column="cheat"/>
- <result property="pending" column="pending"/>
- <result property="examPass" column="exam_pass"/>
- <result property="examPending" column="exam_pending"/>
- <result property="examCheat" column="exam_cheat"/>
- <result property="keyValue" column="key_value"/>
- <result property="periodStatus" column="period_status"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="goodsName" column="goods_name"/>
- <result property="className" column="class_name"/>
- <result property="classHours" column="class_hours"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
- <result property="userId" column="user_id"/>
- <result property="id" column="id"/>
- <result property="typeName" column="type_name"/>
- <result property="realName" column="realname"/>
- <result property="classHours" column="class_hours"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="status" column="status"/>
- <result property="auditTime" column="audit_time"/>
- <result property="type" column="type"/>
- <result property="sort" column="sort"/>
- <result property="courseId" column="course_id"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="durationTime" column="duration_time"/>
- <result property="courseSort" column="course_sort"/>
- <result property="sectionType" column="section_type"/>
- <result property="realLiveStartTime" column="real_live_start_time"/>
- <result property="realLiveEndTime" column="real_live_end_time"/>
- <result property="realDuration" column="real_duration"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodChapterVo" id="ClassPeriodChapterVo">
- <result property="userId" column="user_id"/>
- <result property="id" column="id"/>
- <result property="courseId" column="course_id"/>
- <result property="typeName" column="type_name"/>
- <result property="realName" column="realname"/>
- <result property="classHours" column="class_hours"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="status" column="status"/>
- <result property="auditTime" column="audit_time"/>
- <result property="type" column="type"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="performance" column="performance"/>
- <result property="sort" column="sort"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodSectionVo" id="ClassPeriodSectionVo">
- <result property="userId" column="user_id"/>
- <result property="id" column="id"/>
- <result property="typeName" column="type_name"/>
- <result property="realName" column="realname"/>
- <result property="classHours" column="class_hours"/>
- <result property="durationTime" column="duration_time"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="status" column="status"/>
- <result property="auditTime" column="audit_time"/>
- <result property="type" column="type"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="auditNum" column="audit_num"/>
- <result property="sort" column="sort"/>
- <result property="sectionType" column="section_type"/>
- <result property="realLiveStartTime" column="real_live_start_time"/>
- <result property="realLiveEndTime" column="real_live_end_time"/>
- <result property="realDuration" column="real_duration"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterVo" id="CourseChapterResultVo">
- <result property="chapterId" column="chapter_id"/>
- <result property="name" column="name"/>
- </resultMap>
- <select id="selectUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassGradeUserVoResult">
- SELECT
- g.*,
- u.user_account,
- u.realname,
- u.id_card,
- u.telphone,
- cg.class_name,
- cg.official_name,
- cg.class_status,
- cg.interface_push_id,
- cg.class_start_time,
- cg.class_end_time,
- g.official_status_num,
- g.period_time,
- g.period_wait_time,
- g.period_status
- FROM
- class_grade_user g
- LEFT JOIN `user` u ON g.user_id = u.user_id
- LEFT JOIN class_grade cg ON cg.grade_id = g.grade_id
- WHERE
- 1 = 1
- AND g.change_grade = 0
- AND g.grade_id = #{gradeId}
- AND g.user_id = #{userId}
- </select>
- <select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassGradeUserVoResult">
- SELECT
- g.*,
- u.user_account,
- u.realname,
- u.id_card,
- u.telphone
- FROM
- class_grade_user g
- LEFT JOIN `user` u ON g.user_id = u.user_id
- WHERE
- 1 = 1
- <if test="status != null and status.size()!=0 ">
- AND g.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="gradeId != null and gradeId != ''">
- AND g.grade_id = #{gradeId}
- </if>
- <if test="userId != null and userId != ''">
- AND g.user_id = #{userId}
- </if>
- <if test="classStartTime != null or classEndTime != null ">
- AND #{classStartTime} BETWEEN g.class_start_time
- </if>
- order by g.update_time desc
- </select>
- <select id="listUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- * ,
- (select `code` FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
- u.grade_id) as goods_code,
- (select `year` FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
- u.grade_id) as year,
- (select goods_name FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
- u.grade_id) as goods_name,
- (select b.business_name FROM course_business b LEFT JOIN goods g on b.id = g.business_id LEFT JOIN
- class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as business_name,
- (select b.project_name FROM course_project_type b LEFT JOIN goods g on b.id = g.project_id LEFT JOIN
- class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as project_name,
- (select b.school_name FROM school b LEFT JOIN goods g on b.id = g.school_id LEFT JOIN class_grade_goods c on
- g.goods_id = c.goods_id where c.grade_id = u.grade_id) as school_name,
- (select b.education_name FROM course_education_type b LEFT JOIN goods g on b.id = g.education_type_id LEFT JOIN
- class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as education_name,
- (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
- (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
- (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
- FROM
- class_grade_user u
- where 1=1
- <if test="status != null and status.size()!=0 ">
- AND u.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="userId != null and userId != ''">
- and u.user_id= #{userId}
- </if>
- order by u.create_time desc
- </select>
- <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- u.user_account,
- u.user_id,
- cgu.`status`,
- u.realname,
- cgg.goods_id,
- u.id_card,
- cgu.grade_id,
- u.telphone,
- u.one_inch_photos,
- up.`status` as profile_status,
- g.class_hours as class_hours,
- g.study_start_time as study_start_time,
- g.study_end_time as study_end_time,
- g.goods_name,
- g.code as goods_code,
- g.stand_price,
- cgu.period_status,
- cg.class_start_time,
- cg.class_end_time,
- cg.class_name,
- cgu.period_plush,
- cgu.period_status_num,
- IFNULL(ge.exam_num,0) as exam_num,
- <if test="userPhoto != null and userPhoto == 1">
- up.key_value,
- </if>
- cgu.period_time as end_time,
- (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
- (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_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 = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num
- <if test="userPhoto == null">
- ,(select COUNT(up.id) from user_period up LEFT JOIN user_period_status ups on up.id=ups.period_id where up.goods_id = (SELECT cgg.goods_id FROM class_grade_goods cgg where cg.grade_id=cgg.grade_id) and up.grade_id = cgu.grade_id and up.user_id = u.user_id
- and ups.period_status=0 and ups.`status`=0 and (SELECT COUNT(upss.id) from user_period_status upss where upss.id = ups.id and upss.period_status = 1 and upss.`status` = 2) > 0 ) as rebuild_num
- </if>
- 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
- LEFT JOIN `user` u ON u.user_id = cgu.user_id
- LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = cgg.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
- LEFT JOIN goods g on cgg.goods_id = g.goods_id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- 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 cgg.goods_id = ge.goods_id
- where 1=1
- and cgu.`status` =1
- <if test="periodPlush != null and periodPlush != ''">
- AND cgu.period_plush = #{periodPlush}
- </if>
- <if test="officialStatus != null and officialStatus != ''">
- AND cgu.official_status = #{officialStatus}
- </if>
- <if test="changeGrade != null and changeGrade != ''">
- AND cgu.change_grade = #{changeGrade}
- </if>
- <if test="profileStatus != null and profileStatus != ''">
- AND up.status = #{profileStatus}
- </if>
- <if test="gradeId != null and gradeId !='' ">
- and cgu.grade_id = #{gradeId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND g.education_type_id = #{educationTypeId}
- </if>
- <if test="schoolId != null and schoolId != ''">
- AND g.school_id = #{schoolId}
- </if>
- <if test="majorId != null and majorId != ''">
- AND g.major_id = #{majorId}
- </if>
- <if test="periodStatus != null ">
- and cgu.period_status = #{periodStatus}
- </if>
- <if test="classStartTime != null and classStartTime != '' ">
- AND cg.class_start_time >= #{classStartTime}
- </if>
- <if test="classEndTime != null and classEndTime != '' ">
- AND #{classEndTime} >= cg.class_end_time
- </if>
- <if test="studyStatus != null and studyStatus == 1 ">
- and cgu.period_status = -1
- </if>
- <if test="studyStatus != null and studyStatus == 2 ">
- and cgu.period_status != -1
- </if>
- <if test="className != null and className !='' ">
- and cg.class_name like concat('%', #{className}, '%')
- </if>
- <if test="searchKey != null and searchKey != '' ">
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%') or g.goods_name like concat('%', #{searchKey}, '%') or cg.class_name like concat('%', #{searchKey}, '%'))
- </if>
- <if test="searchStartTime != null and searchStartTime !='' ">
- AND cgu.create_time >=#{searchStartTime}
- </if>
- <if test="searchEndTime != null and searchEndTime !='' ">
- AND #{searchEndTime} >= cgu.create_time
- </if>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- <if test="periodStatus != 2 and periodStatus != 3">
- order by cgu.update_time desc
- </if>
- <if test="periodStatus == 2 ">
- order by cgu.period_wait_time,cgu.create_time
- </if>
- <if test="periodStatus == 3 ">
- order by cgu.period_ing_time,cgu.create_time
- </if>
- </select>
- <select id="listUserPeriodExport" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- u.user_account,
- u.user_id,
- cgu.`status`,
- u.realname,
- cgg.goods_id,
- u.id_card,
- cgu.grade_id,
- u.telphone,
- g.class_hours as class_hours,
- g.study_start_time as study_start_time,
- g.study_end_time as study_end_time,
- g.goods_name,
- g.code as goods_code,
- g.stand_price,
- cgu.period_status,
- cg.class_start_time,
- cg.class_end_time,
- cg.class_name,
- cgu.period_plush,
- cgu.period_status_num,
- (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
- (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
- <if test="userPhoto != null and userPhoto == 1">
- up.key_value,
- </if>
- cgu.period_time as end_time
- 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
- LEFT JOIN `user` u ON u.user_id = cgu.user_id
- LEFT JOIN goods g on cgg.goods_id = g.goods_id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = g.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
- where 1=1
- and cgu.`status` =1
- <if test="periodPlush != null and periodPlush != ''">
- AND cgu.period_plush = #{periodPlush}
- </if>
- <if test="officialStatus != null and officialStatus != ''">
- AND cgu.official_status = #{officialStatus}
- </if>
- <if test="changeGrade != null and changeGrade != ''">
- AND cgu.change_grade = #{changeGrade}
- </if>
- <if test="profileStatus != null and profileStatus != ''">
- AND up.status = #{profileStatus}
- </if>
- <if test="gradeId != null and gradeId !='' ">
- and cgu.grade_id = #{gradeId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND g.education_type_id = #{educationTypeId}
- </if>
- <if test="schoolId != null and schoolId != ''">
- AND g.school_id = #{schoolId}
- </if>
- <if test="majorId != null and majorId != ''">
- AND g.major_id = #{majorId}
- </if>
- <if test="periodStatus != null ">
- and cgu.period_status = #{periodStatus}
- </if>
- <if test="classStartTime != null and classStartTime != '' ">
- AND cg.class_start_time >= #{classStartTime}
- </if>
- <if test="classEndTime != null and classEndTime != '' ">
- AND #{classEndTime} >= cg.class_end_time
- </if>
- <if test="studyStatus != null and studyStatus == 1 ">
- and cgu.period_status = -1
- </if>
- <if test="studyStatus != null and studyStatus == 2 ">
- and cgu.period_status != -1
- </if>
- <if test="searchKey != null and searchKey != '' ">
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%') or g.goods_name like concat('%', #{searchKey}, '%') or cg.class_name like concat('%', #{searchKey}, '%'))
- </if>
- <if test="searchStartTime != null and searchStartTime !='' ">
- AND cgu.create_time >=#{searchStartTime}
- </if>
- <if test="searchEndTime != null and searchEndTime !='' ">
- AND #{searchEndTime} >= cgu.create_time
- </if>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- <if test="periodStatus != 2 and periodStatus != 3">
- order by cgu.update_time desc
- </if>
- <if test="periodStatus == 2 ">
- order by cgu.period_wait_time,cgu.create_time
- </if>
- <if test="periodStatus == 3 ">
- order by cgu.period_ing_time,cgu.create_time
- </if>
- </select>
- <select id="userPeriodStatus" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- IFNULL(ge.exam_num,0) as exam_num,
- cg.class_start_time,
- cg.class_end_time,
- g.study_start_time,
- g.study_end_time,
- (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.`type` in (1,3) and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
- cgu.user_id,
- cgg.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
- LEFT JOIN goods g on g.goods_id=cgg.goods_id
- 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 cgg.goods_id = ge.goods_id
- where 1=1
- and cgu.`status` =1
- <if test="gradeId != null and gradeId !='' ">
- and cgu.grade_id = #{gradeId}
- </if>
- <if test="userId != null ">
- and cgu.user_id = #{userId}
- </if>
- LIMIT 1
- </select>
- <select id="listPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodUserVo">
- SELECT
- u.user_account,
- u.realname,
- u.id_card,
- u.user_id,
- u.telphone,
- g.goods_id,
- g.goods_name,
- cg.class_name,
- g.class_hours,
- u.one_inch_photos,
- u.id_card_img1,
- u.id_card_img2,
- cgu.period_status,
- (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
- class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type in (1,3) ) 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.`type` in (1,3) and ubr.report_status =1 and ubr.user_id=#{userId} and ubr.grade_id=cgu.grade_id and ubr.current_status=1) as record_num,
- (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
- ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.grade_id = cgu.grade_id and up.`type` = 1) as pass,
- (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
- ups.`status` =2 and up.grade_id = cg.grade_id and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.`type` = 1) as pending,
- (SELECT
- COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
- =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.`type` = 1) as cheat,
- (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
- ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.grade_id = cg.grade_id and up.`type` in (2,3)) as exam_pass,
- (SELECT
- COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
- =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.`type` in (2,3)) as exam_cheat,
- (SELECT
- COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
- =2 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.`type` in (2,3)) as exam_pending,
- (SELECT up.key_value FROM user_profile up where up.goods_id = #{goodsId} and up.user_id =#{userId} and up.order_goods_id = cgu.order_goods_id and up.current_status = 1 and up.`status` = 1 and up.type_status =1 LIMIT 1) as key_value
- <if test="userId != null and userId !='' ">
- ,(SELECT MIN(first_start_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId}) as study_start_time,
- (SELECT MAX(end_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId}) as study_end_time
- </if>
- FROM
- class_grade_user cgu
- LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
- LEFT JOIN `user` u ON u.user_id = cgu.user_id
- LEFT JOIN class_grade_goods cgg ON cg.grade_id=cgg.grade_id
- LEFT JOIN goods g ON g.goods_id = cgg.goods_id
- where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- <if test="gradeId != null and gradeId !='' ">
- and cgu.grade_id = #{gradeId}
- </if>
- <if test="periodStatus != null and periodStatus !='' ">
- and cgu.period_status = #{periodStatus}
- </if>
- LIMIT 1
- </select>
- <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodVo">
- SELECT
- gc.sort as course_sort,
- cm.sort,
- cm.menu_id as id,
- cm.course_id,
- (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as realname,
- (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as user_id,
- (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
- (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on
- cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
- 1 as type,
- NULL as study_start_time,
- NULL as study_end_time
- FROM
- course_menu cm
- LEFT JOIN goods_course gc on gc.course_id = cm.course_id
- where 1=1
- <if test="goodsId != null and goodsId !='' ">
- and gc.goods_id=#{goodsId}
- </if>
- <if test="courseId != null and courseId !='' ">
- and gc.course_id=#{courseId}
- </if>
- AND cm.type=1
- UNION
- SELECT
- gc.sort as course_sort,
- cm.sort,
- cm.menu_id as id,
- cm.course_id,
- (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as realname,
- (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as user_id,
- (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
- (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
- 2 as type,
- (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
- ccs.section_id and ccs.chapter_id = usr.chapter_id where ccs.chapter_id = cm.menu_id AND usr.current_status = 1 AND usr.user_id=#{userId} and usr.course_id = cm.course_id and usr.goods_id = gc.goods_id and usr.grade_id = #{gradeId} ORDER BY usr.create_time ASC
- limit 1) as study_start_time,
- (SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
- ccs.section_id and ccs.chapter_id = usr.chapter_id where ccs.chapter_id = cm.menu_id AND usr.current_status = 1 AND usr.user_id=#{userId} and usr.course_id = cm.course_id and usr.goods_id = gc.goods_id and usr.grade_id = #{gradeId} ORDER BY usr.create_time DESC
- limit 1) as study_end_time
- FROM
- course_menu cm
- LEFT JOIN goods_course gc on gc.course_id = cm.course_id
- where 1=1
- <if test="goodsId != null and goodsId !='' ">
- and gc.goods_id=#{goodsId}
- </if>
- <if test="courseId != null and courseId !='' ">
- and gc.course_id=#{courseId}
- </if>
- AND cm.type=2
- </select>
- <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodVo">
- SELECT
- gc.sort as course_sort,
- cm.sort,
- cm.menu_id as id,
- cm.course_id,
- (SELECT u.realname FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as realname,
- (SELECT u.user_id FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as user_id,
- cs.`name` as type_name,
- cs.duration_time,
- cs.real_live_start_time,
- cs.real_live_end_time,
- cs.real_duration,
- cs.section_type,
- null as class_hours,
- 3 as type
- FROM
- course_menu cm
- LEFT JOIN course_section cs on cm.menu_id = cs.section_id
- LEFT JOIN goods_course gc on gc.course_id = cm.course_id
- where 1=1
- <if test="goodsId != null and goodsId !='' ">
- and gc.goods_id = #{goodsId}
- </if>
- <if test="courseId != null and courseId !='' ">
- and gc.course_id=#{courseId}
- </if>
- AND cm.type=3
- </select>
- <select id="listPeriodAuditExam" parameterType="map" resultMap="ClassPeriodChapterVo">
- SELECT
- cme.exam_id as id,
- cme.course_id,
- (SELECT u.realname FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as realname,
- (SELECT u.user_id FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as user_id,
- (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
- null as class_hours,
- 4 as type,
- (
- SELECT
- ups.record_start_time
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- period_status = 1
- AND up.course_id = gc.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.section_id =up.section_id
- AND up.exam_id = cme.exam_id
- ) AS study_start_time,
- (
- SELECT
- ups.record_end_time
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- period_status = 1
- AND up.course_id = gc.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- AND up.exam_id = cme.exam_id
- ) AS study_end_time,
- (
- SELECT
- ups.`status`
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- period_status = 1
- AND up.course_id = gc.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.section_id =up.section_id
- AND up.exam_id = cme.exam_id
- ) AS STATUS,
- (
- SELECT
- ups.create_time
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- period_status = 1
- AND up.course_id = gc.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.section_id =up.section_id
- AND up.exam_id = cme.exam_id
- ) AS audit_time,
- (
- SELECT
- COUNT( ups.id )
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- period_status = 1
- AND up.course_id = gc.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.section_id =up.section_id
- AND up.exam_id = cme.exam_id
- ) AS audit_num
- FROM
- course_menu_exam cme
- LEFT JOIN goods_course gc on gc.course_id = cme.course_id
- LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
- where 1=1
- <if test="goodsId != null and goodsId !='' ">
- and gc.goods_id= #{goodsId}
- </if>
- AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
- </select>
- <select id="listperiodChapter" parameterType="map" resultMap="ClassPeriodChapterVo">
- SELECT
- cmc.sort,
- cc.chapter_id as id,
- cm.course_id,
- ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if> LIMIT 1) AS realname,
- ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if> LIMIT 1) AS user_id,
- cc.`name` as type_name,
- ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS
- class_hours,
- 2 AS type,
- (
- SELECT
- usr.create_time
- FROM
- user_study_record usr
- LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
- WHERE
- ccs.chapter_id = cc.chapter_id
- AND usr.current_status = 1
- <if test="courseId != null and courseId !='' ">
- AND usr.course_id=#{courseId}
- </if>
- <if test="moduleId != null and moduleId !='' ">
- AND usr.module_id=#{moduleId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND usr.goods_id=#{goodsId}
- </if>
- <if test="gradeId != null and gradeId !='' ">
- AND usr.grade_id=#{gradeId}
- </if>
- <if test="userId != null and userId !='' ">
- AND usr.user_id=#{userId}
- </if>
- ORDER BY
- usr.create_time ASC
- LIMIT 1
- ) AS study_start_time,
- (
- SELECT
- usr.update_time
- FROM
- user_study_record usr
- LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
- WHERE
- ccs.chapter_id = cc.chapter_id
- AND usr.current_status = 1
- <if test="courseId != null and courseId !='' ">
- AND usr.course_id=#{courseId}
- </if>
- <if test="moduleId != null and moduleId !='' ">
- AND usr.module_id=#{moduleId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND usr.goods_id=#{goodsId}
- </if>
- <if test="gradeId != null and gradeId !='' ">
- AND usr.grade_id=#{gradeId}
- </if>
- <if test="userId != null and userId !='' ">
- AND usr.user_id=#{userId}
- </if>
- ORDER BY
- usr.create_time DESC
- LIMIT 1
- ) AS study_end_time,
- (
- SELECT
- ubr.performance
- FROM
- user_bank_record ubr
- LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id and cme.chapter_id = ubr.chapter_id
- WHERE 1=1
- AND ubr.current_status = 1
- <if test="moduleId != null and moduleId !='' ">
- AND ubr.module_id=#{moduleId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND ubr.goods_id=#{goodsId}
- </if>
- <if test="moduleId != null and moduleId !='' ">
- AND cme.module_id=#{moduleId}
- </if>
- <if test="courseId != null and courseId !='' ">
- AND cme.course_id =#{courseId}
- </if>
- <if test="userId != null and userId !='' ">
- AND ubr.user_id=#{userId}
- </if>
- AND cme.chapter_id = cmc.chapter_id
- LIMIT 1 ) AS performance
- FROM
- course_menu cm
- LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
- LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
- WHERE
- 1 = 1
- <if test="moduleId != null and moduleId !='' ">
- AND cmc.module_id=#{moduleId}
- </if>
- <if test="courseId != null and courseId !='' ">
- AND cm.course_id =#{courseId}
- </if>
- </select>
- <select id="listperiodExam" parameterType="map" resultMap="ClassPeriodSectionVo">
- SELECT
- cme.exam_id as id,
- cme.course_id,
- (SELECT u.realname FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as realname,
- (SELECT u.user_id FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as user_id,
- (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
- null as class_hours,
- 4 as type
- FROM
- course_menu_exam cme
- LEFT JOIN exam e ON cme.exam_id = e.exam_id
- WHERE 1=1
- AND cme.type=1
- <if test="courseId != null and courseId !='' ">
- AND cme.course_id=#{courseId}
- </if>
- <if test="chapterId != null and chapterId !='' ">
- AND cme.chapter_id =#{chapterId}
- </if>
- <if test="moduleId != null and moduleId !='' ">
- AND cme.module_id =#{moduleId}
- </if>
- </select>
- <select id="listPeriodSection" parameterType="map" resultMap="ClassPeriodSectionVo">
- SELECT
- ccs.sort,
- cs.section_id AS id,
- #{courseId} AS course_id,
- ( SELECT u.realname FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if> ) AS realname,
- ( SELECT u.user_id FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if> ) AS user_id,
- cs.NAME AS type_name,
- cs.duration_time,
- cs.section_type,
- cs.real_live_start_time,
- cs.real_live_end_time,
- cs.real_duration,
- NULL AS class_hours,
- 3 AS type
- FROM
- course_chapter_section ccs
- LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
- WHERE
- 1 = 1
- <if test="chapterId != null and chapterId !='' ">
- AND ccs.chapter_id = #{chapterId}
- </if>
- </select>
- <select id="listPeriodSectionExam" parameterType="map" resultMap="ClassPeriodSectionVo">
- SELECT
- cme.exam_id as id,
- cme.course_id,
- (SELECT u.realname FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as realname,
- (SELECT u.user_id FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as user_id,
- (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
- null as class_hours,
- 4 as type
- FROM
- course_menu_exam cme
- LEFT JOIN exam e ON cme.exam_id = e.exam_id
- WHERE 1=1
- and cme.module_id =0
- and cme.type =1
- <if test="courseId != null and courseId !='' ">
- AND cme.course_id=#{courseId}
- </if>
- <if test="chapterId != null and chapterId !='' ">
- AND cme.chapter_id = #{chapterId}
- </if>
- </select>
- <select id="selectStart" parameterType="map" resultType="long">
- SELECT
- usr.create_time
- FROM
- user_study_record usr
- WHERE
- usr.goods_id = #{goodsId}
- AND usr.grade_id = #{gradeId}
- AND usr.user_id = #{userId} UNION
- SELECT
- ubr.create_time
- FROM
- user_bank_record ubr
- WHERE
- ubr.goods_id =#{goodsId}
- AND ubr.grade_id = #{gradeId}
- AND ubr.user_id = #{userId}
- ORDER BY create_time ASC
- </select>
- <select id="sendClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgu.user_id,
- cg.class_start_time,
- cg.class_end_time,
- cgg.goods_id,
- cg.grade_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
- LEFT JOIN goods g on cgg.goods_id = g.goods_id
- LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
- where 1=1
- and irb.remind_id =5
- and cgu.status = 1
- AND unix_timestamp(now()) BETWEEN cg.class_end_time-1728000 and cg.class_end_time-1641600
- </select>
- <select id="checkSendClassGradeUser" parameterType="map" resultType="long">
- SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = #{remindId} and #{userId} = iu.user_id and #{gradeId} = iu.grade_id and iu.system_status=3
- </select>
- <select id="sendTenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgu.user_id,
- cg.class_start_time,
- cg.class_end_time,
- cgg.goods_id,
- cg.grade_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
- LEFT JOIN goods g on cgg.goods_id = g.goods_id
- LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
- where 1=1
- and irb.remind_id =6
- and cgu.status = 1
- AND unix_timestamp(now()) BETWEEN cg.class_end_time-864000 and cg.class_end_time-777600
- </select>
- <select id="sendFiveClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgu.user_id,
- cg.class_start_time,
- cg.class_end_time,
- cgg.goods_id,
- cg.grade_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
- LEFT JOIN goods g on cgg.goods_id = g.goods_id
- LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
- where 1=1
- and irb.remind_id =7
- and cgu.status = 1
- AND unix_timestamp(now()) BETWEEN cg.class_end_time-432000 and cg.class_end_time-345600
- </select>
- <select id="selectUserCount" parameterType="com.zhongzheng.modules.user.domain.User" resultType="long">
- SELECT
- COUNT( 1 )
- FROM
- `user`
- WHERE
- id_card = #{idCard} and user_id != #{userId} and `status` = 1
- </select>
- <select id="selectUserCertificate" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassGradeUserVoResult">
- </select>
- <select id="findChapterList" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="CourseChapterResultVo">
- SELECT
- cc.chapter_id,
- cc.`name`
- FROM
- course_module_chapter p
- LEFT JOIN course_chapter cc ON p.chapter_id = cc.chapter_id
- LEFT JOIN course_menu m ON m.menu_id = p.module_id
- LEFT JOIN goods_course gc ON gc.course_id = m.course_id
- WHERE
- gc.goods_id = #{goodsId}
- AND m.type = 1 UNION
- SELECT
- cc.chapter_id,
- cc.`name`
- FROM
- course_menu m
- LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id
- LEFT JOIN goods_course gc ON gc.course_id = m.course_id
- WHERE
- gc.goods_id = #{goodsId}
- AND m.type = 2
- </select>
- <select id="selectOfficialInfoCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
- SELECT
- count(*)
- FROM
- class_grade_user cgu
- WHERE
- cgu.grade_id = #{gradeId}
- AND cgu.official_status = 1
- </select>
- <select id="selectLearnStatusCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
- SELECT
- count(*)
- FROM
- class_grade_user cgu
- WHERE
- cgu.grade_id = #{gradeId}
- AND cgu.learn_status = 1
- </select>
- <select id="selectOfficialPeriodCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
- SELECT
- count(*)
- FROM
- class_grade_user cgu
- WHERE
- cgu.grade_id = #{gradeId}
- AND cgu.period_plush = 1
- </select>
- <select id="selectOfficialNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- gu.*
- FROM
- class_grade g
- LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
- WHERE
- g.interface_push_id > 0
- AND g.official_name IS NOT NULL
- AND g.`status` = 1
- AND gu.`status` = 1
- AND gu.change_grade = 0
- AND (SELECT count(*) from user_confirm_info where gu.order_goods_id = order_goods_id) > 0
- AND IFNULL(gu.official_status,0) != 1
- </select>
- <select id="selectPeriodNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- gu.*
- FROM
- class_grade g
- LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
- WHERE
- g.interface_period_id > 0
- AND g.`status` = 1
- AND gu.`status` = 1
- AND gu.change_grade = 0
- AND IFNULL(gu.period_plush,0) != 1
- AND gu.period_status = 1
- </select>
- <select id="selectGoodsGradeList" parameterType="Long" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgg.goods_id,
- cgg.grade_id,
- cgu.user_id,
- cgu.order_goods_id
- FROM
- class_grade_goods cgg
- LEFT JOIN class_grade_user cgu ON cgg.grade_id = cgu.grade_id
- WHERE
- cgg.goods_id = #{goodsId}
- AND cgu.user_id IS NOT NULL
- </select>
- <select id="queryCountList" parameterType="java.lang.Integer" resultMap="ClassGradeUserVoResult">
- SELECT
- cgu.*,
- cg.interface_account_id,
- cg.no_interface_account_id
- 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
- LEFT JOIN goods g on og.goods_id = g.goods_id
- WHERE
- cgu.`status` = 1
- and g.project_id = #{projectId}
- and g.business_id = #{businessId}
- <if test="all != null and all == 0">
- and (cg.interface_account_id is not null or cg.no_interface_account_id is not null)
- </if>
- </select>
- </mapper>
|