12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720 |
- <?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"/>
- <result property="toOldStatus" column="to_old_status"/>
- <result property="toOldResult" column="to_old_result"/>
- <result property="toOldTime" column="to_old_time"/>
- <result property="sevenPushCheck" column="seven_push_check"/>
- <result property="sevenPushReason" column="seven_push_reason"/>
- </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" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="createBy" column="create_by"/>
- <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <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"/>
- <result property="toOldStatus" column="to_old_status"/>
- <result property="toOldResult" column="to_old_result"/>
- <result property="toOldTime" column="to_old_time"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="sex" column="sex"/>
- <result property="eduLevel" column="edu_level"/>
- <result property="companyName" column="company_name"/>
- <result property="sevenPushCheck" column="seven_push_check"/>
- <result property="sevenPushReason" column="seven_push_reason"/>
- </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" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <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"/>
- <result property="periodTime" column="period_time"/>
- <result property="sectionName" column="section_name"/>
- <result property="companyName" column="company_name"/>
- <result property="durationTime" column="duration_time"/>
- <result property="recordStartTime" column="record_start_time"/>
- <result property="recordEndTime" column="record_end_time"/>
- <result property="onLineTime" column="on_line_time"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="sevenYear" column="seven_year"/>
- <result property="businessName" column="business_name"/>
- <result property="projectName" column="project_name"/>
- <result property="educationName" column="education_name"/>
- <result property="categoryName" column="category_name"/>
- <result property="goodsYear" column="goods_year"/>
- <result property="createTime" column="create_time"/>
- <result property="profileStatus" column="profile_status"/>
- <result property="orderSn" column="order_sn"/>
- <result property="majorId" column="major_id"/>
- </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" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <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"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="classStartTime" column="class_start_time"/>
- <result property="classEndTime" column="class_end_time"/>
- <result property="officialName" column="official_name"/>
- <result property="sevenYear" column="seven_year"/>
- <result property="gradeStatus" column="grade_status"/>
- <result property="sex" column="sex"/>
- </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"/>
- <result property="commonSign" column="common_sign"/>
- </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"/>
- <result property="doType" column="do_type"/>
- <result property="moduleId" column="module_id"/>
- <result property="commonSign" column="common_sign"/>
- </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"/>
- <result property="recordingUrl" column="recording_url"/>
- <result property="doType" column="do_type"/>
- <result property="chapterId" column="chapter_id"/>
- <result property="moduleId" column="module_id"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterVo" id="CourseChapterResultVo">
- <result property="chapterId" column="chapter_id"/>
- <result property="name" column="name"/>
- <result property="commonSign" column="common_sign"/>
- <result property="sectionNum" column="section_num"/>
- </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,
- u.sex,
- u.edu_level,
- u.company_name,
- 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}
- AND g.order_goods_id = #{orderGoodsId}
- </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
- * ,
- g.code as goods_code,
- g.`year`,
- g.goods_name,
- (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
- (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
- (select b.school_name FROM school b where b.id = g.school_id) as school_name,
- (select b.education_name FROM course_education_type b where b.id = g.education_type_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
- LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
- LEFT JOIN goods g on g.goods_id = og.goods_id
- 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="listUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- * ,
- g.code as goods_code,
- g.`year`,
- g.goods_name,
- (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
- (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
- (select b.school_name FROM school b where b.id = g.school_id) as school_name,
- (select b.education_name FROM course_education_type b where b.id = g.education_type_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
- LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
- LEFT JOIN goods g on g.goods_id = og.goods_id
- 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="listUserVideoRecord" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- up.* ,cg.class_name,cs.duration_time,u.id_card,u.realname,u.one_inch_photos,u.company_name,cs.`name` as section_name,ups.record_start_time,ups.record_end_time,ups.update_time as on_line_time
- FROM
- user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id
- LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
- LEFT JOIN goods g ON up.goods_id = g.goods_id
- LEFT JOIN course_section cs ON up.section_id = cs.section_id
- LEFT JOIN `user` u ON up.user_id = u.user_id
- WHERE
- up.grade_id > 0 and up.type = 1
- <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="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </if>
- <if test="realname != null and realname != ''">
- AND u.realname like concat('%', #{realname}, '%')
- </if>
- <if test="telphone != null and telphone != ''">
- AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
- </if>
- <if test="idCard != null and idCard != ''">
- AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="companyName != null and companyName != ''">
- AND u.company_name like concat('%', #{companyName}, '%')
- </if>
- order by up.create_time desc
- </select>
- <select id="listUserVideoRecordNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- up.* ,cg.class_name,cs.duration_time,u.id_card,u.realname,u.one_inch_photos,u.company_name,cs.`name` as section_name,ups.record_start_time,ups.record_end_time,ups.update_time as on_line_time
- FROM
- user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id
- LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
- LEFT JOIN goods g ON up.goods_id = g.goods_id
- LEFT JOIN course_section cs ON up.section_id = cs.section_id
- LEFT JOIN `user` u ON up.user_id = u.user_id
- WHERE
- up.grade_id > 0 and up.type = 1
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="projectIds != null and projectIds.size()!=0 ">
- AND g.project_id in
- <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
- AND g.education_type_id in
- <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="realname != null and realname != ''">
- AND u.realname like concat('%', #{realname}, '%')
- </if>
- <if test="telphone != null and telphone != ''">
- AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
- </if>
- <if test="idCard != null and idCard != ''">
- AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="companyName != null and companyName != ''">
- AND u.company_name like concat('%', #{companyName}, '%')
- </if>
- <if test="tenantIds != null and tenantIds.size()!=0 ">
- AND up.tenant_id in
- <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- order by up.create_time desc
- </select>
- <select id="listUserVideoRecordNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultType="java.lang.Long">
- SELECT
- count(up.id)
- FROM
- user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id
- LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
- LEFT JOIN goods g ON up.goods_id = g.goods_id
- LEFT JOIN course_section cs ON up.section_id = cs.section_id
- LEFT JOIN `user` u ON up.user_id = u.user_id
- WHERE
- up.grade_id > 0 and up.type = 1
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="projectIds != null and projectIds.size()!=0 ">
- AND g.project_id in
- <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
- AND g.education_type_id in
- <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="realname != null and realname != ''">
- AND u.realname like concat('%', #{realname}, '%')
- </if>
- <if test="telphone != null and telphone != ''">
- AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
- </if>
- <if test="idCard != null and idCard != ''">
- AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="companyName != null and companyName != ''">
- AND u.company_name like concat('%', #{companyName}, '%')
- </if>
- <if test="tenantIds != null and tenantIds.size()!=0 ">
- AND up.tenant_id in
- <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- order by up.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,
- og.goods_id,
- u.id_card,
- cgu.grade_id,
- u.telphone,
- u.one_inch_photos,
- u.company_name,
- 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,
- cgu.period_time,
- cgu.order_goods_id,
- og.order_sn,
- g.major_id,
- /* IFNULL(ge.exam_num,0) as exam_num, */
- <if test="userPhoto != null and userPhoto == 1">
- up.key_value,
- </if>
- cgu.period_wait_time as end_time,
- (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
- (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.order_goods_id = cgu.order_goods_id 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 = og.goods_id and up.grade_id = cgu.grade_id and up.order_goods_id = cgu.order_goods_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 order_goods og ON cgu.order_goods_id = og.order_goods_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 = og.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 og.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 og.goods_id = ge.goods_id */
- where 1=1
- and cgu.`status` =1
- and cb.`period_check_sign` = 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="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </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,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
- or g.goods_name like concat('%', #{searchKey}, '%')
- or cg.class_name like concat('%', #{searchKey}, '%')
- or u.company_name like concat('%', #{searchKey}, '%'))
- </if>
- <if test="inputOrderSn != null and inputOrderSn != '' ">
- and (select count(*) from `order` o where o.order_sn =og.order_sn and o.input_order_sn = #{inputOrderSn})>0
- </if>
- <if test="companyName != null and companyName != '' ">
- and u.company_name like concat('%', #{companyName}, '%')
- </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="searchStartTime != null and searchStartTime !='' ">
- AND cgu.create_time >=#{searchStartTime}
- </if>
- <if test="searchEndTime != null and searchEndTime !='' ">
- AND #{searchEndTime} >= cgu.create_time
- </if>
- <if test="periodStartTime != null and periodStartTime !='' ">
- AND cgu.period_time >=#{periodStartTime}
- </if>
- <if test="periodEndTime != null and periodEndTime !='' ">
- AND #{periodEndTime} >= cgu.period_time
- </if>
- <if test="periodStatus != 2 and periodStatus != 3 and ascSort == 0">
- order by cgu.update_time desc
- </if>
- <if test="periodStatus == 2 and ascSort == 0">
- order by cgu.period_wait_time,cgu.create_time
- </if>
- <if test="periodStatus == 3 and ascSort == 0">
- order by cgu.period_ing_time,cgu.create_time
- </if>
- <if test="ascSort == 1 ">
- order by cgu.update_time desc
- </if>
- </select>
- <select id="listUserPeriodNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultType="java.lang.Long">
- SELECT
- count(cgu.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 `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 = og.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 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
- where 1=1
- and cgu.`status` =1
- and cb.`period_check_sign` = 1
- <if test="projectIds != null and projectIds.size()!=0 ">
- AND g.project_id in
- <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
- AND g.education_type_id in
- <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="periodStatus != null ">
- and cgu.period_status = #{periodStatus}
- </if>
- <if test="searchKey != null and searchKey != '' ">
- and u.realname like concat('%', #{searchKey}, '%')
- </if>
- <if test="idCard != null and idCard !='' ">
- AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="tenantIds != null and tenantIds.size()!=0 ">
- AND cgu.tenant_id in
- <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- order by cgu.update_time desc
- </select>
- <select id="listUserPeriodNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultType="com.zhongzheng.modules.grade.vo.ClassPeriodStudentNewVo">
- SELECT
- u.user_id,
- u.realname,
- og.goods_id,
- u.id_card,
- cgu.grade_id,
- u.telphone,
- up.`status` as profile_status,
- g.goods_name,
- cg.class_name,
- cgu.order_goods_id,
- (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
- cgu.period_wait_time as end_time,
- cgu.tenant_id,
- CONCAT(cet.education_name,cpt.project_name,cb.business_name) AS fullName
- 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 `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 = og.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 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
- where 1=1
- and cgu.`status` =1
- and cb.`period_check_sign` = 1
- <if test="projectIds != null and projectIds.size()!=0 ">
- AND g.project_id in
- <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
- AND g.education_type_id in
- <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="periodStatus != null ">
- and cgu.period_status = #{periodStatus}
- </if>
- <if test="searchKey != null and searchKey != '' ">
- and u.realname like concat('%', #{searchKey}, '%')
- </if>
- <if test="idCard != null and idCard !='' ">
- AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="tenantIds != null and tenantIds.size()!=0 ">
- AND cgu.tenant_id in
- <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- order by cgu.update_time desc
- </select>
- <select id="getEduIdByTenant" parameterType="map" resultType="java.lang.Long">
- SELECT id FROM course_education_type WHERE tenant_id = #{tenantId} AND education_name = #{eduName} AND `status` = 1 LIMIT 1
- </select>
- <select id="getProIdByTenant" parameterType="map" resultType="java.lang.Long">
- SELECT id FROM course_project_type WHERE tenant_id = #{tenantId} AND project_name = #{proName} AND education_id = #{eduId} AND `status` = 1 LIMIT 1
- </select>
- <select id="exportUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- u.user_account,
- u.user_id,
- cgu.`status`,
- u.realname,
- og.goods_id,
- u.id_card,
- cgu.grade_id,
- u.telphone,
- u.one_inch_photos,
- u.company_name,
- 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,
- cgu.period_time,
- cgu.order_goods_id,
- og.order_sn,
- g.major_id,
- IFNULL(ge.exam_num,0) as exam_num,
- <if test="userPhoto != null and userPhoto == 1">
- up.key_value,
- </if>
- cgu.period_wait_time as end_time,
- (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
- (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.order_goods_id = cgu.order_goods_id 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 = og.goods_id and up.grade_id = cgu.grade_id and up.order_goods_id = cgu.order_goods_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 order_goods og ON cgu.order_goods_id = og.order_goods_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 = og.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 og.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 og.goods_id = ge.goods_id
- where 1=1
- and cgu.`status` =1
- and cb.`period_check_sign` = 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="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </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,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
- or g.goods_name like concat('%', #{searchKey}, '%')
- or cg.class_name like concat('%', #{searchKey}, '%')
- or u.company_name like concat('%', #{searchKey}, '%'))
- </if>
- <if test="inputOrderSn != null and inputOrderSn != '' ">
- and (select count(*) from `order` o where o.order_sn =og.order_sn and o.input_order_sn = #{inputOrderSn})>0
- </if>
- <if test="companyName != null and companyName != '' ">
- and u.company_name like concat('%', #{companyName}, '%')
- </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="searchStartTime != null and searchStartTime !='' ">
- AND cgu.create_time >=#{searchStartTime}
- </if>
- <if test="searchEndTime != null and searchEndTime !='' ">
- AND #{searchEndTime} >= cgu.create_time
- </if>
- <if test="periodStartTime != null and periodStartTime !='' ">
- AND cgu.period_time >=#{periodStartTime}
- </if>
- <if test="periodEndTime != null and periodEndTime !='' ">
- AND #{periodEndTime} >= cgu.period_time
- </if>
- <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="listUserPeriodTotal" parameterType="java.lang.Integer" resultType="java.lang.Long">
- SELECT
- COUNT( cgu.id )
- FROM
- class_grade_user cgu
- 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
- LEFT JOIN course_business cb ON g.business_id = cb.id
- WHERE
- cgu.`status` = 1
- AND cb.period_check_sign = 1
- AND cgu.period_status = #{periodStatus}
- </select>
- <select id="exportNoPassRecord" resultType="com.zhongzheng.modules.grade.vo.ClassNoPassExportVo">
- SELECT
- u.realname AS realName,
- AES_DECRYPT( UNHEX( u.id_card ), 'base20230213zzkj' ) AS idCard,
- AES_DECRYPT( UNHEX( u.telphone ), 'base20230213zzkj' ) AS telPhone,
- u.company_name AS companyName,
- m.category_name AS categoryName,
- g.goods_name AS goodsName,
- (SELECT FROM_UNIXTIME( ups.audit_time, '%Y-%m-%d %H:%i:%s' ) FROM user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id LIMIT 1 ) AS noPassTime,
- '否' AS restart,
- '' AS restartTime
- FROM
- class_grade_user cgu
- LEFT JOIN `user` u ON cgu.user_id = u.user_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
- LEFT JOIN major m ON g.major_id = m.id
- WHERE
- cgu.`status` = 1
- AND cgu.period_status = 0
- </select>
- <select id="exportRestartRecord" resultType="com.zhongzheng.modules.grade.vo.ClassNoPassExportVo">
- SELECT
- u.realname AS realName,
- AES_DECRYPT( UNHEX( u.id_card ), 'base20230213zzkj' ) AS idCard,
- AES_DECRYPT( UNHEX( u.telphone ), 'base20230213zzkj' ) AS telPhone,
- u.company_name AS companyName,
- m.category_name AS categoryName,
- g.goods_name AS goodsName,
- (SELECT FROM_UNIXTIME( ups.audit_time, '%Y-%m-%d %H:%i:%s' ) FROM user_period up
- LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id LIMIT 1 ) AS noPassTime,
- '是' AS restart,
- (SELECT FROM_UNIXTIME( ups.record_start_time , '%Y-%m-%d %H:%i:%s' ) FROM user_period up LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id AND ups.`status` = 2
- AND ups.record_start_time IS NOT NULL ORDER BY ups.record_start_time LIMIT 1) AS restartTime
- FROM
- class_grade_user cgu
- LEFT JOIN `user` u ON cgu.user_id = u.user_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
- LEFT JOIN major m ON g.major_id = m.id
- WHERE
- cgu.`status` = 1
- AND cgu.period_status = -1
- AND (SELECT COUNT(*) FROM user_period up LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id AND ups.`status` = 3 ) > 0
- </select>
- <select id="listUserWeekStudyTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultType="Long">
- SELECT
- IFNULL( SUM( cs.duration_time ), 0 )
- FROM
- (
- SELECT
- section_id
- FROM
- user_study_record
- WHERE
- user_id = #{userId}
- AND grade_id = #{gradeId}
- AND order_goods_id = #{orderGoodsId}
- AND current_status = 1
- AND `status` = 1
- <if test="searchWeekStartTime != null and searchWeekStartTime != '' ">
- AND update_time >= #{searchWeekStartTime}
- </if>
- <if test="searchWeekEndTime != null and searchWeekEndTime != '' ">
- AND #{searchWeekEndTime} >= update_time
- </if>
- GROUP BY
- course_id,
- module_id,
- chapter_id,
- section_id
- ) usr
- LEFT JOIN course_section cs ON usr.section_id = cs.section_id
- </select>
- <select id="listUserWeekPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- u.user_account,
- u.user_id,
- cgu.`status`,
- u.realname,
- og.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,
- cgu.period_time,
- cgu.order_goods_id,
- <if test="userPhoto != null and userPhoto == 1">
- up.key_value,
- </if>
- cgu.period_wait_time as end_time
- <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 = og.goods_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 order_goods og ON cgu.order_goods_id = og.order_goods_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 = og.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 og.goods_id = g.goods_id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- where 1=1
- and cgu.`status` =1
- <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
- AND (SELECT count(*) from user_study_record usr where usr.user_id = cgu.user_id AND usr.grade_id = cgu.grade_id AND usr.current_status = 1 AND #{searchWeekEndTime} >= usr.update_time AND usr.update_time >=#{searchWeekStartTime}) >0
- </if>
- <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 g.goods_name like concat('%', #{searchKey}, '%') or cg.class_name like concat('%', #{searchKey}, '%'))
- </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="searchStartTime != null and searchStartTime !='' ">
- AND cgu.create_time >=#{searchStartTime}
- </if>
- <if test="searchEndTime != null and searchEndTime !='' ">
- AND #{searchEndTime} >= cgu.create_time
- </if>
- <if test="periodStartTime != null and periodStartTime !='' ">
- AND cgu.period_time >=#{periodStartTime}
- </if>
- <if test="periodEndTime != null and periodEndTime !='' ">
- AND #{periodEndTime} >= cgu.period_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,
- og.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,
- cgu.order_goods_id,
- (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 order_goods og ON cgu.order_goods_id = og.order_goods_id
- LEFT JOIN `user` u ON u.user_id = cgu.user_id
- LEFT JOIN goods g on og.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
- <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
- AND (SELECT count(*) from user_study_record usr where usr.user_id = cgu.user_id AND usr.grade_id = cgu.grade_id AND usr.current_status = 1 AND #{searchWeekEndTime} >= usr.update_time AND usr.update_time >=#{searchWeekStartTime}) >0
- </if>
- 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}, '%')
- or u.company_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 where ubr.`status`=1 and ubr.report_status=1 and ubr.`type` in (1,3) 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.user_id,
- og.goods_id
- FROM
- class_grade_user cgu
- LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
- LEFT JOIN order_goods og on og.order_goods_id=cgu.order_goods_id
- LEFT JOIN goods g on g.goods_id=og.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 og.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>
- <if test="orderGoodsId != null ">
- and cgu.order_goods_id = #{orderGoodsId}
- </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,
- u.sex,
- g.goods_id,
- g.goods_name,
- cg.class_name,
- cg.official_name,
- cg.class_start_time,
- cg.class_end_time,
- cg.official_name,
- cg.status as grade_status,
- g.class_hours,
- u.one_inch_photos,
- u.id_card_img1,
- u.id_card_img2,
- cgu.period_status,
- cgu.order_goods_id,
- (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
- order_goods og on og.goods_id = c.goods_id where og.order_goods_id=cgu.order_goods_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.order_goods_id=cgu.order_goods_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.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) 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.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) 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.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) and up.user_id = #{userId} and up.`type` = 1) as cheat,
- (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.exam_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.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) 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.exam_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.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) 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.exam_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.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) 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,
- (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year
- <if test="userId != null and userId !='' ">
- ,(SELECT MIN(first_start_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId} and order_goods_id=#{orderGoodsId}) as study_start_time,
- (SELECT MAX(end_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId} and order_goods_id=#{orderGoodsId}) 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 order_goods og ON cgu.order_goods_id = og.order_goods_id
- LEFT JOIN goods g ON g.goods_id = og.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>
- <if test="orderGoodsId != null and orderGoodsId !='' ">
- and cgu.order_goods_id = #{orderGoodsId}
- </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,
- 0 as common_sign,
- (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 cc.common_sign FROM course_chapter cc where cm.menu_id = cc.chapter_id) as common_sign,
- (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} and usr.order_goods_id = #{orderGoodsId} 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} and usr.order_goods_id = #{orderGoodsId} 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 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,
- cc.common_sign,
- 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 usr.course_id=#{courseId}
- </if>
- <if test="moduleId != null">
- 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>
- <if test="orderGoodsId != null and orderGoodsId !='' ">
- AND usr.order_goods_id=#{orderGoodsId}
- </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 usr.course_id=#{courseId}
- </if>
- <if test="moduleId != null">
- 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>
- <if test="orderGoodsId != null and orderGoodsId !='' ">
- AND usr.order_goods_id=#{orderGoodsId}
- </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
- AND ubr.report_status = 1
- <if test="moduleId != null ">
- AND ubr.module_id=#{moduleId}
- </if>
- <if test="goodsId != null">
- AND ubr.goods_id=#{goodsId}
- </if>
- <if test="moduleId != null ">
- AND cme.module_id=#{moduleId}
- </if>
- <if test="courseId != null">
- AND cme.course_id =#{courseId}
- </if>
- <if test="userId != null and userId !='' ">
- AND ubr.user_id=#{userId}
- </if>
- <if test="orderGoodsId != null and orderGoodsId !='' ">
- AND ubr.order_goods_id=#{orderGoodsId}
- </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 and cm.type = 1
- LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
- WHERE
- 1 = 1
- <if test="moduleId != null ">
- AND cmc.module_id=#{moduleId}
- </if>
- <if test="courseId != null">
- AND cm.course_id =#{courseId}
- </if>
- </select>
- <select id="listperiodExam" parameterType="map" resultMap="ClassPeriodSectionVo">
- SELECT
- cme.exam_id as id,
- cme.course_id,
- e.do_type,
- <if test="userId != null and userId !='' ">
- (SELECT u.realname FROM `user` u where 1=1
- and u.user_id = #{userId}
- ) as realname,
- </if>
- <if test="userId != null and userId !='' ">
- #{userId} as user_id,
- </if>
- (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
- null as class_hours,
- 4 as type,
- cme.chapter_id,
- cme.module_id
- 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 cme.course_id=#{courseId}
- </if>
- <if test="chapterId != null">
- AND cme.chapter_id =#{chapterId}
- </if>
- <if test="moduleId != null">
- AND cme.module_id =#{moduleId}
- </if>
- </select>
- <select id="listperiodModuleExam" parameterType="map" resultMap="ClassPeriodChapterVo">
- SELECT
- cme.exam_id as id,
- cme.course_id,
- e.do_type,
- <if test="userId != null and userId !='' ">
- (SELECT u.realname FROM `user` u where 1=1
- and u.user_id = #{userId}
- ) as realname,
- </if>
- <if test="userId != null and userId !='' ">
- #{userId} as user_id,
- </if>
- (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
- null as class_hours,
- 5 as type,
- cme.module_id
- FROM
- course_menu_exam cme
- LEFT JOIN exam e ON cme.exam_id = e.exam_id
- WHERE 1=1
- AND cme.type=3
- <if test="courseId != null">
- AND cme.course_id=#{courseId}
- </if>
- <if test="moduleId != null">
- 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,
- <if test="userId != null and userId !='' ">
- (SELECT u.realname FROM `user` u where 1=1
- and u.user_id = #{userId}
- ) as realname,
- </if>
- <if test="userId != null and userId !='' ">
- #{userId} as user_id,
- </if>
- 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,
- cs.recording_url,
- 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 ccs.chapter_id = #{chapterId}
- </if>
- ORDER BY
- ccs.sort
- </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 cme.course_id=#{courseId}
- </if>
- <if test="chapterId != null ">
- AND cme.chapter_id = #{chapterId}
- </if>
- </select>
- <select id="selectStart" parameterType="map" resultType="long">
- SELECT
- rp.create_time
- FROM
- user_study_record_photo rp
- LEFT JOIN user_period_status ups ON rp.period_id = ups.id
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- 1=1
- <if test="orderGoodsId != null ">
- AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
- </if>
- AND ups.period_status = 1
- AND up.grade_id = #{gradeId}
- AND up.user_id = #{userId}
- ORDER BY
- rp.create_time ASC
- </select>
- <select id="selectStartNew" parameterType="map" resultType="long">
- SELECT
- rp.create_time
- FROM
- user_study_record_photo rp
- LEFT JOIN user_period_status ups ON rp.period_id = ups.id
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- 1=1
- <if test="orderGoodsId != null ">
- AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
- </if>
- AND ups.period_status = 1
- AND up.grade_id = #{gradeId}
- AND up.user_id = #{userId}
- ORDER BY
- rp.create_time ASC
- </select>
- <select id="selectStartNoPhoto" parameterType="map" resultType="long">
- SELECT
- ups.record_start_time
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- 1=1
- <if test="orderGoodsId != null ">
- AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
- </if>
- AND ups.period_status = 1
- AND up.grade_id = #{gradeId}
- AND up.user_id = #{userId}
- ORDER BY
- ups.record_start_time ASC
- limit 1
- </select>
- <select id="selectStartNoPhotoNew" parameterType="map" resultType="long">
- SELECT
- ups.record_start_time
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- 1=1
- <if test="orderGoodsId != null ">
- AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
- </if>
- AND ups.period_status = 1
- AND up.grade_id = #{gradeId}
- AND up.user_id = #{userId}
- ORDER BY
- ups.record_start_time ASC
- limit 1
- </select>
- <select id="selectEnd" parameterType="map" resultType="long">
- SELECT
- usr.end_time
- FROM
- user_study_record usr
- WHERE
- usr.goods_id = #{goodsId}
- AND usr.grade_id = #{gradeId}
- AND usr.user_id = #{userId} UNION
- SELECT
- ubr.update_time as end_time
- FROM
- user_bank_record ubr
- WHERE
- ubr.goods_id =#{goodsId}
- AND ubr.grade_id = #{gradeId}
- AND ubr.user_id = #{userId}
- ORDER BY end_time DESC
- </select>
- <select id="sendClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgu.user_id,
- cgu.order_goods_id,
- cg.class_start_time,
- cg.class_end_time,
- og.goods_id,
- cg.grade_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
- 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,
- cgu.order_goods_id,
- cg.class_start_time,
- cg.class_end_time,
- og.goods_id,
- cg.grade_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
- 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="sendTenAndFifteenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgu.user_id,
- cgu.order_goods_id,
- cg.class_start_time,
- cg.class_end_time,
- og.goods_id,
- cg.grade_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
- where 1=1
- and cgu.status = 1
- AND (unix_timestamp(now()) BETWEEN cg.class_end_time-950400 and cg.class_end_time-864000 or
- unix_timestamp(now()) BETWEEN cg.class_end_time-1382400 and cg.class_end_time-1296000)
- </select>
- <select id="checkTenClassGradeUser" parameterType="map" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgu.user_id,
- cgu.order_goods_id,
- cg.class_end_time,
- og.goods_id,
- g.goods_name,
- cg.class_name as grade_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
- LEFT JOIN goods g ON g.goods_id = og.goods_id
- where 1=1
- and cg.status = 1
- and cgu.status = 1
- and cgu.user_id = #{userId}
- and (cgu.period_status = -1 or cgu.period_status = 0)
- AND unix_timestamp(now()) BETWEEN cg.class_end_time-#{startTime} and cg.class_end_time-#{endTime}
- </select>
- <select id="sendFiveClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- cgu.user_id,
- cgu.order_goods_id,
- cg.class_start_time,
- cg.class_end_time,
- og.goods_id,
- cg.grade_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
- 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,typeHandler=com.zhongzheng.common.type.EncryptHandler} 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 ui.* from (SELECT
- cc.chapter_id,
- cc.`name`,
- m.sort,
- cm.common_sign,
- (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
- 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
- LEFT JOIN course_module cm ON p.module_id = cm.module_id
- WHERE
- gc.goods_id = #{goodsId}
- <if test="moduleId != null and moreCertificateStatus == 2 ">
- AND p.module_id = #{moduleId}
- </if>
- AND m.type = 1 UNION ALL
- SELECT
- cc.chapter_id,
- cc.`name`,
- m.sort,
- 0 as common_sign,
- (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
- 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}
- <if test="moduleId != null and moreCertificateStatus == 2 ">
- AND 1 = 0
- </if>
- AND m.type = 2)ui
- ORDER BY ui.sort
- </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 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
- AND gu.official_status = 1
- <if test="gradeId != null and gradeId != ''">
- AND gu.grade_id = #{gradeId}
- </if>
- </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>
- <select id="checkFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
- SELECT
- IFNULL(count(*),0)
- FROM
- class_grade_user cgu
- 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
- LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
- WHERE
- cgu.user_id = #{userId}
- AND cgu.period_status = -1
- AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
- and g.business_id = #{businessId}
- and g.goods_id != #{goodsId}
- AND (
- SELECT
- IFNULL( count(*), 0 )
- FROM
- user_period up
- WHERE
- 1 = 1
- AND up.user_id = cgu.user_id
- AND up.grade_id = cgu.grade_id
- )>0
- </select>
- <select id="getFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
- SELECT
- g.goods_id
- FROM
- class_grade_user cgu
- 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
- LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
- WHERE
- cgu.user_id = #{userId}
- AND cgu.period_status = -1
- AND cgu.period_wait_time is null
- AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
- and g.business_id = #{businessId}
- and g.goods_id != #{goodsId}
- and cgu.`status` = 1
- AND (
- SELECT
- IFNULL( count(*), 0 )
- FROM
- user_period up
- WHERE
- 1 = 1
- AND up.order_goods_id = cgu.order_goods_id
- )>0
- </select>
- <select id="getOrderGoods" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.order.domain.OrderGoods">
- SELECT
- og.*
- FROM
- order_goods og
- LEFT JOIN `order` o ON og.order_sn = o.order_sn
- WHERE
- o.user_id = #{userId}
- AND og.goods_id = #{goodsId}
- AND og.refund_status != 2
- AND og.pay_status != 1
- AND og.`status` = 1
- AND o.`status` = 1
- </select>
- <select id="getSevenPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
- SELECT
- p.create_time
- FROM
- user_study_record usr
- LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
- LEFT JOIN course_module cm ON usr.module_id = cm.module_id
- WHERE
- usr.current_status = 1
- AND usr.user_id = #{userId}
- AND usr.grade_id = #{gradeId}
- AND cm.common_sign = 0
- <if test="orderGoodsId != null and orderGoodsId !='' ">
- AND usr.order_goods_id = #{orderGoodsId}
- </if>
- AND P.create_time IS NOT NULL
- ORDER BY
- P.create_time
- LIMIT 1
- </select>
- <select id="getPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
- SELECT
- p.create_time
- FROM
- user_study_record usr
- LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
- WHERE
- usr.current_status = 1
- AND usr.user_id = #{userId}
- AND usr.grade_id = #{gradeId}
- <if test="orderGoodsId != null and orderGoodsId !='' ">
- AND usr.order_goods_id = #{orderGoodsId}
- </if>
- AND P.create_time IS NOT NULL
- ORDER BY
- P.create_time
- LIMIT 1
- </select>
- <select id="getPeriodEndTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
- SELECT
- ups.record_end_time
- FROM
- user_period_status ups
- LEFT JOIN user_period up ON up.id = ups.period_id
- WHERE
- 1 = 1
- AND up.user_id = #{userId}
- AND up.grade_id = #{gradeId}
- <if test="orderGoodsId != null and orderGoodsId !='' ">
- AND up.order_goods_id = #{orderGoodsId}
- </if>
- AND ups.period_status = 1
- ORDER BY
- ups.record_end_time DESC
- LIMIT 1
- </select>
- <select id="getClassInfoByUser" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
- SELECT
- cgu.*
- 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 cgu.grade_id = cg.grade_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
- WHERE
- cgu.`status` = 1
- AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "继续教育" ) > 0
- AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "施工现场专业人员" ) > 0
- AND og.`status` = 1
- AND og.refund_status != 2
- AND og.pay_status IN ( 2, 3, 4 )
- AND cgu.period_status != 1
- AND cgu.finish_status = 0
- AND cg.class_start_time <= UNIX_TIMESTAMP(NOW())
- AND cg.class_end_time >= UNIX_TIMESTAMP(NOW())
- AND (
- SELECT
- COUNT( usr.record_id )
- FROM
- user_study_record usr
- WHERE
- usr.order_goods_id = cgu.order_goods_id
- AND usr.user_id = cgu.user_id
- AND usr.current_status = 1
- ) > 0
- AND cgu.user_id = #{userId}
- </select>
- <select id="listVideoUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- u.user_account,
- u.user_id,
- cgu.`status`,
- u.realname,
- og.goods_id,
- u.id_card,
- cgu.grade_id,
- u.telphone,
- u.one_inch_photos,
- 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,
- g.goods_id,
- cgu.period_status,
- cg.class_start_time,
- cg.class_end_time,
- cg.class_name,
- cgu.period_plush,
- cgu.period_status_num,
- cgu.period_time,
- cgu.order_goods_id,
- IFNULL(ge.exam_num,0) as exam_num,
- cgu.period_wait_time as end_time,
- (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
- (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.order_goods_id = cgu.order_goods_id and ubr.grade_id = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
- cet.education_name,
- cpt.project_name,
- m.category_name,
- cb.business_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
- LEFT JOIN `user` u ON u.user_id = cgu.user_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 major m ON g.major_id = m.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 og.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="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </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,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
- or g.goods_name like concat('%', #{searchKey}, '%')
- or cg.class_name like concat('%', #{searchKey}, '%'))
- </if>
- <if test="userId != null and userId !='' ">
- AND cgu.user_id = #{userId}
- </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="searchStartTime != null and searchStartTime != '' ">
- and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND r.create_time >= #{searchStartTime} )>0
- </if>
- <if test="searchEndTime != null and searchEndTime != '' ">
- and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND #{searchEndTime} >= r.create_time )>0
- </if>
- <if test="periodStartTime != null and periodStartTime !='' ">
- AND cgu.period_time >=#{periodStartTime}
- </if>
- <if test="periodEndTime != null and periodEndTime !='' ">
- AND #{periodEndTime} >= cgu.period_time
- </if>
- order by cgu.create_time desc
- </select>
- <select id="listBKUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- g.goods_name,
- cgu.create_time,
- g.year as goods_year,
- cet.education_name,
- cpt.project_name,
- m.category_name,
- cb.business_name,
- up.`status` as profile_status
- 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 `user` u ON u.user_id = cgu.user_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 major m ON g.major_id = m.id
- LEFT JOIN user_profile up on 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="profileStatus != null and profileStatus != ''">
- AND up.`status` = #{profileStatus}
- </if>
- <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="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </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,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
- or g.goods_name like concat('%', #{searchKey}, '%')
- or cg.class_name like concat('%', #{searchKey}, '%'))
- </if>
- <if test="userId != null and userId !='' ">
- AND u.user_id = #{userId}
- </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="searchStartTime != null and searchStartTime !='' ">
- AND cgu.create_time >= #{searchStartTime}
- </if>
- <if test="searchEndTime != null and searchEndTime !='' ">
- AND #{searchEndTime} >= cgu.create_time
- </if>
- <if test="periodStartTime != null and periodStartTime !='' ">
- AND cgu.period_time >= #{periodStartTime}
- </if>
- <if test="periodEndTime != null and periodEndTime !='' ">
- AND #{periodEndTime} >= cgu.period_time
- </if>
- order by cgu.create_time desc
- </select>
- <select id="getListUserSubscribe" resultType="com.zhongzheng.modules.user.vo.UserUsbRecordVo" parameterType="com.zhongzheng.modules.user.bo.UserUsbRecordBo">
- SELECT
- us.subscribe_id,
- us.create_time,
- g.goods_name,
- CONCAT(cet.education_name,'-',cb.business_name,cpt.project_name) AS businessName,
- m.category_name AS majorName,
- us.subscribe_status,
- us.apply_site_exam_time AS applyTime,
- us.apply_site_start_time AS applyStarTime,
- us.apply_site_end_time AS applyEndTime,
- us.apply_site_address AS applyAddress,
- '自带文具、身份证' AS remark
- FROM user_subscribe us
- LEFT JOIN order_goods og ON us.order_goods_id = og.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 major m ON g.major_id = m.id
- WHERE 1=1 AND us.exam_status = 0
- <if test="userId != null and userId !='' ">
- AND us.user_id = #{userId}
- </if>
- <if test="subStartTime != null and subStartTime !='' ">
- AND us.create_time >= #{subStartTime}
- </if>
- <if test="subEndTime != null and subStartTime !='' ">
- AND us.create_time <= #{subEndTime}
- </if>
- <if test="educationTypeId != null and educationTypeId !='' ">
- AND cet.id = #{educationTypeId}
- </if>
- <if test="businessId != null and businessId !='' ">
- AND cb.id = #{businessId}
- </if>
- <if test="majorId != null and majorId !='' ">
- AND m.id = #{majorId}
- </if>
- <if test="goodsName != null and goodsName !='' ">
- AND g.goods_name like concat('%', #{goodsName}, '%')
- </if>
- <if test="subscribeStatus != null and subscribeStatus == 1">
- AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) > UNIX_TIMESTAMP()
- </if>
- <if test="subscribeStatus != null and subscribeStatus == 2">
- AND us.subscribe_status = #{subscribeStatus}
- </if>
- <if test="subscribeStatus != null and subscribeStatus == 3">
- AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) < UNIX_TIMESTAMP()
- </if>
- <if test="applySiteExamTime != null and applySiteExamTime != '' ">
- and us.apply_site_exam_time = #{applySiteExamTime}
- </if>
- <if test="monthStartTime != null and monthStartTime != '' ">
- and us.apply_site_exam_time >= #{monthStartTime}
- </if>
- <if test="monthEndTime != null and monthEndTime != '' ">
- and us.apply_site_exam_time <= #{monthEndTime}
- </if>
- <if test="applySiteStartTime != null and applySiteStartTime != '' ">
- and us.apply_site_start_time = #{applySiteStartTime}
- </if>
- <if test="applySiteEndTime != null and applySiteEndTime != '' ">
- and us.apply_site_end_time = #{applySiteEndTime}
- </if>
- order by us.create_time DESC
- </select>
- <update id="updateGradeUser" parameterType="com.zhongzheng.modules.grade.domain.ClassGradeUser" >
- update class_grade_user
- <set>
- <if test="sevenPushCheck != null">
- seven_push_check = #{sevenPushCheck},
- </if>
- <if test="sevenPushReason != null ">
- seven_push_reason=#{sevenPushReason},
- </if>
- <if test="updateTime != null ">
- update_time=#{updateTime},
- </if>
- <if test="sevenPushDate != null ">
- seven_push_date=#{sevenPushDate},
- </if>
- </set>
- where id = #{id}
- </update>
- <select id="selectUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
- SELECT
- g.*
- FROM
- class_grade_user g
- WHERE
- 1 = 1
- <if test="id != null ">
- AND g.id = #{id}
- </if>
- <if test="sevenPushReason != null ">
- AND g.seven_push_reason = #{sevenPushReason}
- </if>
- </select>
- <update id="updateListUserNoTenant" parameterType="map" >
- UPDATE class_grade_user SET seven_push_check = 0 WHERE seven_push_check > 2 and
- seven_push_reason = #{sevenPushReason}
- </update>
- </mapper>
|