浏览代码

学员班级查询

change 3 年之前
父节点
当前提交
c01441f242

+ 14 - 4
zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassStudentController.java

@@ -17,10 +17,7 @@ import com.zhongzheng.modules.user.bo.UserEditBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
-import com.zhongzheng.modules.user.vo.GoodsStudyRecordVo;
-import com.zhongzheng.modules.user.vo.SectionStudyRecordVo;
-import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
-import com.zhongzheng.modules.user.vo.UserVo;
+import com.zhongzheng.modules.user.vo.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -140,4 +137,17 @@ public class ClassStudentController extends BaseController {
         List<ClassGradeUserGoodsVo> list = iClassGradeUserService.listUser(bo);
         return getDataTable(list);
     }
+
+    /**
+     * 查询学员商品学习记录
+     */
+    @ApiOperation("查询学员商品题库学习记录")
+    @PreAuthorize("@ss.hasPermi('grade:student:list')")
+    @GetMapping("/listExam")
+    public TableDataInfo<ExamStudyRecordVo> listExam(UserQueryBo bo) {
+        startPage();
+        List<ExamStudyRecordVo> list = iUserStudyRecordService.querExamStudy(bo);
+
+        return getDataTable(list);
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSubjectMapper.java

@@ -21,4 +21,6 @@ public interface CourseSubjectMapper extends BaseMapper<CourseSubject> {
     List<CourseProjectTypeVo> selectProject(CourseProjectTypeQueryBo courseProjectTypeQueryBo);
 
     Collection<CourseSubjectVo> queryList(CourseSubjectQueryBo bo);
+
+    List<CourseProjectTypeVo> queryProject(Long id);
 }

+ 5 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSubjectServiceImpl.java

@@ -58,7 +58,11 @@ public class CourseSubjectServiceImpl extends ServiceImpl<CourseSubjectMapper, C
 
     @Override
     public List<CourseSubjectVo> queryList(CourseSubjectQueryBo bo) {
-        return entity2Vo(baseMapper.queryList(bo));
+        List<CourseSubjectVo> courseSubjectVos = entity2Vo(baseMapper.queryList(bo));
+        for (CourseSubjectVo courseSubjectVo : courseSubjectVos) {
+            courseSubjectVo.setCourseProjectTypes(baseMapper.queryProject(courseSubjectVo.getId()));
+        }
+        return courseSubjectVos;
     }
 
     /**

+ 3 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java

@@ -5,10 +5,7 @@ import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
-import com.zhongzheng.modules.user.vo.GoodsStudyRecordVo;
-import com.zhongzheng.modules.user.vo.SectionStudyRecordVo;
-import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
-import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
+import com.zhongzheng.modules.user.vo.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -32,4 +29,6 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
     List<SectionStudyRecordVo> listSection(SubjectStudyRecordQueryBo bo);
 
     List<Long> sectionType(@Param("courseId") Long courseId,@Param("sectionType") Long sectionType);
+
+    List<ExamStudyRecordVo> querExamStudy(UserQueryBo bo);
 }

+ 3 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordService.java

@@ -3,10 +3,7 @@ package com.zhongzheng.modules.user.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
-import com.zhongzheng.modules.user.vo.GoodsStudyRecordVo;
-import com.zhongzheng.modules.user.vo.SectionStudyRecordVo;
-import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
-import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
+import com.zhongzheng.modules.user.vo.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Collection;
@@ -61,4 +58,6 @@ public interface IUserStudyRecordService extends IService<UserStudyRecord> {
 	List<SubjectStudyRecordVo> listSubject(SubjectStudyRecordQueryBo bo);
 
 	List<SectionStudyRecordVo> listSection(SubjectStudyRecordQueryBo bo);
+
+    List<ExamStudyRecordVo> querExamStudy(UserQueryBo bo);
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -190,4 +190,11 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         }
         return sectionStudyRecordVos;
     }
+
+    @Override
+    public List<ExamStudyRecordVo> querExamStudy(UserQueryBo bo) {
+        List<ExamStudyRecordVo> examStudyRecordVos = baseMapper.querExamStudy(bo);
+
+        return examStudyRecordVos;
+    }
 }

+ 90 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/ExamStudyRecordVo.java

@@ -0,0 +1,90 @@
+package com.zhongzheng.modules.user.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 【请填写功能名称】视图对象 mall_package
+ *
+ * @author change
+ * @date 2021-06-24
+ */
+@Data
+@ApiModel("【请填写功能名称】视图对象")
+public class ExamStudyRecordVo {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 商品ID */
+    @ApiModelProperty("商品ID")
+    private Long goodsId;
+
+
+    /** 学员Id */
+    @ApiModelProperty("学员Id")
+    private Long userId;
+
+    /** 商品名称 */
+    @ApiModelProperty("商品名称")
+    private String goodsName;
+
+
+    /** 商品编码 */
+    @ApiModelProperty("商品编码")
+    private String code;
+
+    /** 年份 */
+    @ApiModelProperty("年份")
+    private Long year;
+
+    /** 学时 */
+    @ApiModelProperty("学时")
+    private Long classHours;
+
+    /** 学习有效期开始 */
+    @ApiModelProperty("学习有效期开始")
+    private Long studyStartTime;
+
+    /** 学习有效期结束 */
+    @ApiModelProperty("学习有效期结束")
+    private Long studyEndTime;
+
+    /** 业务名称 */
+    @ApiModelProperty("业务名称")
+    private String businessName;
+
+    /** 项目名称 */
+    @ApiModelProperty("项目名称")
+    private String projectName;
+
+    /** 学校名 */
+    @ApiModelProperty("学校名")
+    private String schoolName;
+
+    /** 教育名 */
+    @ApiModelProperty("教育名")
+    private String educationName;
+
+    /** 学习开始时间 */
+    @ApiModelProperty("学习开始时间")
+    private Long startTime;
+
+
+    /** 学习结束时间 */
+    @ApiModelProperty("学习结束时间")
+    private Long endTime;
+
+
+    /** 已学节数 */
+    @ApiModelProperty("已做卷数")
+    private Long stuAllNum;
+
+    /** 试卷数量 */
+    @ApiModelProperty("试卷数量")
+    private Long examNum;
+
+
+}

+ 16 - 18
zhongzheng-system/src/main/resources/mapper/modules/course/CourseSubjectMapper.xml

@@ -30,7 +30,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="remark" column="remark"/>
         <result property="status" column="status"/>
         <result property="subjectName" column="subject_name"/>
-        <association property="courseProjectTypes" javaType="java.util.List" resultMap="CourseProjectTypeVoTwoResult" />
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.course.vo.CourseProjectTypeVo" id="CourseProjectTypeVoTwoResult">
@@ -65,20 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.CourseSubjectQueryBo"  resultMap="CourseSubjectVoResult">
         SELECT
-        s.*,
-        p.id as pid,
-        p.project_name as pproject_name,
-        p.encoder as pencoder,
-        p.remark as  premark,
-        p.education_id as peducation_id,
-        p.status as pstatus,
-        e.education_name as peducation_name
+        s.*
         FROM
         course_subject s
-        LEFT JOIN course_subject_project c ON s.id = c.subject_id
-        LEFT JOIN course_project_type p ON c.project_id = p.id
-        LEFT JOIN course_education_type e ON p.education_id = e.id
-        LEFT JOIN course_business b on b.project_id =p.id
         WHERE
         1 =1
         <if test="status != null and status.size()!=0 ">
@@ -88,19 +76,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </foreach>
         </if>
         <if test="educationId != null and educationId!=0 ">
-            AND e.id = #{educationId}
+            and (SELECT COUNT(p.id) FROM course_subject_project t LEFT JOIN course_project_type p on t.project_id = p.id where p.education_id = #{educationId} ) > 0
         </if>
         <if test="projectId != null and projectId!=0 ">
-            AND p.id = #{projectId}
+            and (SELECT COUNT(t.id) FROM course_subject_project t  where t.project_id = #{projectId}) > 0
         </if>
         <if test="subjectName != null and subjectName!=0 ">
             AND s.subject_name = #{subjectName}
         </if>
-        <if test="businessId != null and businessId!=0 ">
-            AND b.id = #{businessId}
-        </if>
         <if test="wrong != null and wrong!=0 ">
               and (select COUNT(v.id) FROM course_subject_project v where s.id=v.subject_id) = 0
         </if>
+        order by s.update_time desc
+    </select>
+
+    <select id="queryProject" parameterType="map"  resultMap="CourseProjectTypeVoResult">
+        SELECT
+            p.*,
+            (SELECT e.education_name FROM course_education_type e where p.education_id = e.id) as education_name,
+            (SELECT e.id FROM course_education_type e where p.education_id = e.id) as education_id
+        FROM
+            course_project_type p
+                LEFT JOIN course_subject_project j ON p.id = j.project_id
+        WHERE
+            j.subject_id=#{id}
     </select>
 </mapper>

+ 47 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -62,6 +62,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status" column="status"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.user.vo.ExamStudyRecordVo" id="ExamStudyRecordVoResult">
+        <result property="goodsId" column="goods_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="goodsName" column="goods_name"/>
+        <result property="year" column="year"/>
+        <result property="classHours" column="class_hours"/>
+        <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="businessName" column="business_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="schoolName" column="school_name"/>
+        <result property="educationName" column="education_name"/>
+        <result property="examNum" column="exam_num"/>
+        <result property="stuAllNum" column="stu_all_num"/>
+    </resultMap>
+
     <select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo"  resultMap="UserStudyRecordResult">
         SELECT DISTINCT
         temp.course_id,
@@ -268,4 +286,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and m.course_id=#{courseId}
           and s.section_type=#{sectionType}
     </select>
+
+    <select id="querExamStudy" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo"  resultMap="ExamStudyRecordVoResult">
+        SELECT
+        DISTINCT g.goods_id,
+        #{userId} as user_id,
+        g.goods_name,
+        g.`year`,
+        g.`code`,
+        g.class_hours,
+        g.study_start_time,
+        g.study_end_time,
+        ( SELECT i.business_name FROM course_business i WHERE i.id = g.business_id ) AS business_name,
+        ( SELECT p.project_name FROM course_project_type p WHERE p.id = g.business_id ) AS project_name,
+        ( SELECT s.school_name FROM school s WHERE s.id = g.school_id ) AS school_name,
+        ( SELECT e.education_name FROM course_education_type e WHERE e.id = g.education_type_id ) AS education_name,
+        (SELECT COUNT(a.id)+(SELECT COUNT(a.id) FROM goods_attached e LEFT JOIN question_chapter_exam a on e.major_id = a.chapter_exam_id where e.goods_id = g.goods_id and e.type=2)+(SELECT COUNT(h.id) FROM goods_attached e LEFT JOIN question_module_chapter a on e.major_id = a.module_exam_id LEFT JOIN question_chapter_exam h on a.chapter_exam_id = h.chapter_exam_id  where e.goods_id = g.goods_id and e.type=1) FROM goods_attached a where a.goods_id=g.goods_id and a.type = 3) as exam_num,
+        (SELECT create_time FROM user_bank_record r where r.goods_id=g.goods_id ORDER BY create_time ASC LIMIT 1) as start_time,
+        (SELECT create_time FROM user_bank_record r where r.goods_id=g.goods_id ORDER BY create_time DESC LIMIT 1) as end_time,
+        (SELECT COUNT(DISTINCT exam_id) FROM user_bank_record r where r.goods_id=g.goods_id) as stu_all_num
+        FROM
+        goods g
+        LEFT JOIN order_goods s ON g.goods_id = s.goods_id
+        LEFT JOIN `order` o ON o.order_sn = s.order_sn
+        WHERE
+        g.goods_type =2
+        <if test="userId != null and userId !=''">
+          AND o.user_id = #{userId}
+        </if>
+    </select>
 </mapper>