12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025 |
- <?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="fromType" column="from_type"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- </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="status" column="status"/>
- <result property="code" column="student_code"/>
- <result property="realName" column="realname"/>
- <result property="idCard" column="id_card"/>
- <result property="createBy" column="create_by"/>
- <result property="telPhone" column="telphone"/>
- </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"/>
- </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="student_code"/>
- <result property="realName" column="realname"/>
- <result property="idCard" column="id_card"/>
- <result property="telPhone" column="telphone"/>
- <result property="status" column="status"/>
- <result property="classHours" column="class_hours"/>
- <result property="periodStatus" column="period_status"/>
- <result property="secAllNum" column="sec_all_num"/>
- <result property="examNum" column="exam_num"/>
- <result property="recordNum" column="record_num"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">
- <result property="userId" column="user_id"/>
- <result property="studentCode" column="student_code"/>
- <result property="realName" column="realname"/>
- <result property="oneInchPhotos" column="one_inch_photos"/>
- <result property="idCardImg1" column="id_card_img1"/>
- <result property="idCardImg2" column="id_card_img2"/>
- <result property="idCard" column="id_card"/>
- <result property="telPhone" column="telphone"/>
- <result property="secAllNum" column="sec_all_num"/>
- <result property="examNum" column="exam_num"/>
- <result property="recordNum" column="record_num"/>
- <result property="pass" column="pass"/>
- <result property="cheat" column="cheat"/>
- </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="courseId" column="course_id"/>
- <result property="studyEndTime" column="study_end_time"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodChapterVo" id="ClassPeriodChapterVo">
- <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="studyEndTime" column="study_end_time"/>
- <result property="performance" column="performance"/>
- </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="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"/>
- </resultMap>
- <select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassGradeUserVoResult">
- SELECT
- g.*,
- u.student_code,
- 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>
- order by g.update_time desc
- </select>
- <select id="listUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassGradeUserGoodsVoResult">
- SELECT
- * ,
- (select `code` FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
- u.grade_id) as goods_code,
- (select `year` FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
- u.grade_id) as year,
- (select goods_name FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
- u.grade_id) as goods_name,
- (select b.business_name FROM course_business b LEFT JOIN goods g on b.id = g.business_id LEFT JOIN
- class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as business_name,
- (select b.project_name FROM course_project_type b LEFT JOIN goods g on b.id = g.project_id LEFT JOIN
- class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as project_name,
- (select b.school_name FROM school b LEFT JOIN goods g on b.id = g.school_id LEFT JOIN class_grade_goods c on
- g.goods_id = c.goods_id where c.grade_id = u.grade_id) as school_name,
- (select b.education_name FROM course_education_type b LEFT JOIN goods g on b.id = g.education_type_id LEFT JOIN
- class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as education_name,
- (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
- (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
- (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
- FROM
- class_grade_user u
- where 1=1
- <if test="status != null and status.size()!=0 ">
- AND u.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="userId != null and userId != ''">
- and u.user_id= #{userId}
- </if>
- order by u.update_time desc
- </select>
- <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodStudentVo">
- SELECT
- u.student_code,
- u.user_id,
- cgu.`status`,
- u.realname,
- (SELECT cgg.goods_id FROM class_grade_goods cgg where cg.grade_id=cgg.grade_id) as goods_id,
- u.id_card,
- cgu.grade_id,
- u.telphone,
- (SELECT g.class_hours FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where
- cg.grade_id = cgg.grade_id) as class_hours,
- cgu.period_status,
- (SELECT g.study_start_time FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where
- cg.grade_id = cgg.grade_id) as study_start_time,
- (SELECT g.study_end_time FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where
- cg.grade_id = cgg.grade_id) as study_end_time,
- cg.class_start_time,
- cg.class_end_time,
- (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
- class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
- (SELECT COUNT(DISTINCT ubr.record_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
- = ubr.goods_id where ubr.`status`=1) as record_num
- 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
- where 1=1
- and cgu.`status` =1
- <if test="gradeId != null and gradeId !='' ">
- and cgu.grade_id = #{gradeId}
- </if>
- <if test="periodStatus != null and periodStatus !='' ">
- and cgu.period_status = #{periodStatus}
- </if>
- order by cgu.update_time
- </select>
- <select id="listPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodUserVo">
- SELECT
- u.student_code,
- u.realname,
- u.id_card,
- u.user_id,
- u.telphone,
- (SELECT cgg.goods_id FROM class_grade_goods cgg where cg.grade_id=cgg.grade_id) as goods_id,
- u.one_inch_photos,
- u.id_card_img1,
- u.id_card_img2,
- (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
- class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
- (SELECT COUNT(DISTINCT ubr.record_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
- = ubr.goods_id where ubr.`status`=1) as record_num,
- (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
- ups.`status` =1) as pass,
- (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id) - (SELECT
- COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
- =1) as cheat
- 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
- where 1=1
- and u.user_id = 2
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- <if test="gradeId != null and gradeId !='' ">
- and cgu.grade_id = #{gradeId}
- </if>
- </select>
- <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodVo">
- SELECT
- cm.menu_id as id,
- cm.course_id,
- (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as realname,
- (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as user_id,
- (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
- (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on
- cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
- 1 as type,
- NULL as study_start_time,
- NULL as study_end_time
- FROM
- course_menu cm
- LEFT JOIN goods_course gc on gc.course_id = cm.course_id
- where 1=1
- <if test="goodsId != null and goodsId !='' ">
- and gc.goods_id=#{goodsId}
- </if>
- AND cm.type=1
- UNION
- SELECT
- cm.menu_id as id,
- cm.course_id,
- (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as realname,
- (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>) as user_id,
- (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
- (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
- 2 as type,
- (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
- ccs.section_id where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id 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 where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id 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> AND cm.type=2
- </select>
- <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodVo">
- SELECT
- 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 cs.`name` FROM course_section cs where cm.menu_id = cs.section_id) as type_name,
- null as class_hours,
- 3 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 up.section_id = cm.menu_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.section_id = cm.menu_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 up.section_id = cm.menu_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 up.section_id = cm.menu_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 up.section_id = cm.menu_id
- ) AS audit_num
- 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>
- AND cm.type=3
- </select>
- <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
- resultMap="ClassPeriodVo">
- SELECT
- 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 cs.`name` FROM course_section cs where cm.menu_id = cs.section_id) as type_name,
- null as class_hours,
- 3 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 up.section_id = cm.menu_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.section_id = cm.menu_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 up.section_id = cm.menu_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 up.section_id = cm.menu_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 up.section_id = cm.menu_id
- ) AS audit_num
- 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>
- 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
- and gc.goods_id=11
- 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
- cc.chapter_id as id,
- cm.course_id,
- ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if> ) 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,
- 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
- WHERE
- ccs.chapter_id = cc.chapter_id
- <if test="goodsId != null and goodsId !='' ">
- AND usr.goods_id=#{goodsId}
- </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
- WHERE
- ccs.chapter_id = cc.chapter_id
- <if test="goodsId != null and goodsId !='' ">
- AND usr.goods_id=#{goodsId}
- </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
- WHERE 1=1
- <if test="goodsId != null and goodsId !='' ">
- AND ubr.goods_id=#{goodsId}
- </if>
- <if test="moduleId != null and moduleId !='' ">
- AND cme.module_id=#{moduleId}
- </if>
- <if test="courseId != null and courseId !='' ">
- AND cme.course_id =#{courseId}
- </if>
- AND cme.chapter_id = cmc.chapter_id
- ) AS performance
- FROM
- course_menu cm
- LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
- LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
- WHERE
- 1 = 1
- <if test="moduleId != null and moduleId !='' ">
- AND cmc.module_id=#{moduleId}
- </if>
- <if test="courseId != null and courseId !='' ">
- AND cm.course_id =#{courseId}
- </if>
- </select>
- <select id="listperiodExam" parameterType="map" resultMap="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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id = up.module_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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id = up.module_id
- 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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id = up.module_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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id = up.module_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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id = up.module_id
- AND up.exam_id = cme.exam_id
- ) AS audit_num
- FROM
- course_menu_exam cme
- LEFT JOIN exam e ON cme.exam_id = e.exam_id
- WHERE 1=1
- <if test="courseId != null and courseId !='' ">
- AND cme.course_id=#{courseId}
- </if>
- <if test="moduleId != null and moduleId !='' ">
- AND cme.module_id =#{moduleId}
- </if>
- </select>
- <select id="listPeriodSection" parameterType="map" resultMap="ClassPeriodSectionVo">
- SELECT
- cs.section_id AS id,
- #{courseId} AS course_id,
- ( SELECT u.realname FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if> ) AS realname,
- ( SELECT u.user_id FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if> ) AS user_id,
- cs.NAME AS type_name,
- NULL AS class_hours,
- 3 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
- <if test="courseId != null and courseId !='' ">
- AND up.course_id = #{courseId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- AND up.section_id = cs.section_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
- <if test="courseId != null and courseId !='' ">
- AND up.course_id = #{courseId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- AND up.section_id = cs.section_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
- <if test="courseId != null and courseId !='' ">
- AND up.course_id = #{courseId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- AND up.section_id = cs.section_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
- <if test="courseId != null and courseId !='' ">
- AND up.course_id = #{courseId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- AND up.section_id = cs.section_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
- <if test="courseId != null and courseId !='' ">
- AND up.course_id = #{courseId}
- </if>
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- AND up.section_id = cs.section_id
- ) AS audit_num
- FROM
- course_chapter_section ccs
- LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
- WHERE
- 1 = 1
- <if test="chapterId != null and chapterId !='' ">
- AND ccs.chapter_id = #{chapterId}
- </if>
- </select>
- <select id="listPeriodSectionExam" parameterType="map" resultMap="ClassPeriodSectionVo">
- SELECT
- cme.exam_id as id,
- cme.course_id,
- (SELECT u.realname FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as realname,
- (SELECT u.user_id FROM `user` u where 1=1
- <if test="userId != null and userId !='' ">
- and u.user_id = #{userId}
- </if>
- ) as user_id,
- (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
- null as class_hours,
- 4 as type,
- (
- 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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id =0
- and cme.chapter_id = up.chapter_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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id =0
- and cme.chapter_id = up.chapter_id
- 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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id =0
- and cme.chapter_id = up.chapter_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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id =0
- and cme.chapter_id = up.chapter_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 = cme.course_id
- <if test="goodsId != null and goodsId !='' ">
- AND up.goods_id = #{goodsId}
- </if>
- and cme.module_id =0
- and cme.chapter_id = up.chapter_id
- AND up.exam_id = cme.exam_id
- ) AS audit_num
- FROM
- course_menu_exam cme
- LEFT JOIN exam e ON cme.exam_id = e.exam_id
- WHERE 1=1
- and cme.module_id =0
- <if test="courseId != null and courseId !='' ">
- AND cme.course_id=#{courseId}
- </if>
- <if test="chapterId != null and chapterId !='' ">
- AND cme.chapter_id = #{chapterId}
- </if>
- </select>
- </mapper>
|