change пре 3 година
родитељ
комит
6225c0ff48

+ 26 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseEducationTypeServiceImpl.java

@@ -87,6 +87,14 @@ public class CourseEducationTypeServiceImpl extends ServiceImpl<CourseEducationT
 
     @Override
     public Boolean insertByAddBo(CourseEducationTypeAddBo bo) {
+
+        LambdaQueryWrapper<CourseEducationType> lqw = Wrappers.lambdaQuery();
+        lqw.like(StrUtil.isNotBlank(bo.getEducationName()), CourseEducationType::getEducationName, bo.getEducationName());
+        List<CourseEducationType> list = this.list(lqw);
+        if (CollectionUtils.isNotEmpty(list)){
+            throw new IllegalArgumentException("教育类型名称重复");
+        }
+
         CourseEducationType add = BeanUtil.toBean(bo, CourseEducationType.class);
         validEntityBeforeSave(add);
         add.setEncoder(ServletUtils.getEncoded("JY"));
@@ -102,13 +110,28 @@ public class CourseEducationTypeServiceImpl extends ServiceImpl<CourseEducationT
 
     @Override
     public Boolean updateByEditBo(CourseEducationTypeEditBo bo) {
+
+        LambdaQueryWrapper<CourseEducationType> lqw = Wrappers.lambdaQuery();
+        lqw.like(StrUtil.isNotBlank(bo.getEducationName()), CourseEducationType::getEducationName, bo.getEducationName());
+        lqw.like(bo.getId()!= null, CourseEducationType::getId, bo.getId());
+        List<CourseEducationType> list = this.list(lqw);
+        if (CollectionUtils.isEmpty(list)){
+            lqw.clear();
+            lqw.like(StrUtil.isNotBlank(bo.getEducationName()), CourseEducationType::getEducationName, bo.getEducationName());
+            lqw.eq(bo.getStatus() != null, CourseEducationType::getStatus, 1);
+            List<CourseEducationType> list1 = this.list(lqw);
+            if (CollectionUtils.isNotEmpty(list)){
+                throw new IllegalArgumentException("教育类型名称重复");
+            }
+        }
+
         CourseEducationType update = BeanUtil.toBean(bo, CourseEducationType.class);
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
 
-        LambdaQueryWrapper<CourseEducationTier> lqw = Wrappers.lambdaQuery();
-        lqw.eq(CourseEducationTier::getEducationId,bo.getId());
-        courseEducationTierService.remove(lqw);
+        LambdaQueryWrapper<CourseEducationTier> lqwTier = Wrappers.lambdaQuery();
+        lqwTier.eq(CourseEducationTier::getEducationId,bo.getId());
+        courseEducationTierService.remove(lqwTier);
         if (!StringUtils.isEmpty(bo.getTireStatus())) {
             CourseEducationTierAddBo courseEducationTierAddBo = new CourseEducationTierAddBo();
             courseEducationTierAddBo.setTireStatus(bo.getTireStatus());

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeUserGoodsVo.java

@@ -34,6 +34,10 @@ public class ClassGradeUserGoodsVo {
 	@Excel(name = "商品编码")
 	@ApiModelProperty("商品编码")
 	private String goodsCode;
+
+	@Excel(name = "商品编码")
+	@ApiModelProperty("商品编码")
+	private String goodsName;
 	/** 1 进入 0移除 */
 	@Excel(name = "1 进入 0移除")
 	@ApiModelProperty("1 进入 0移除")

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java

@@ -30,4 +30,6 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
     List<SubjectStudyRecordVo> listSubject(SubjectStudyRecordQueryBo bo);
 
     List<SectionStudyRecordVo> listSection(SubjectStudyRecordQueryBo bo);
+
+    String sectionType(Long courseId);
 }

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

@@ -132,7 +132,13 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
 
     @Override
     public List<SubjectStudyRecordVo> listSubject(SubjectStudyRecordQueryBo bo) {
-        return baseMapper.listSubject(bo);
+        List<SubjectStudyRecordVo> subjectStudyRecordVos = baseMapper.listSubject(bo);
+        for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
+            String sectionType = new String();
+            sectionType = baseMapper.sectionType(subjectStudyRecordVo.getCourseId());
+
+        }
+        return subjectStudyRecordVos;
     }
 
     @Override

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/SectionStudyRecordVo.java

@@ -46,7 +46,7 @@ public class SectionStudyRecordVo {
     private Long endTime;
 
     /** 是否完成 1完成 0 未完成 */
-    @ApiModelProperty("是否完成 1完成 0 未完成")
+    @ApiModelProperty("是否完成 1完成 0 未完成 2學習中")
     private Long status;
 
 

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/SubjectStudyRecordVo.java

@@ -55,6 +55,10 @@ public class SubjectStudyRecordVo {
     @ApiModelProperty("节数")
     private Long sectionNum;
 
+    /** 节数 */
+    @ApiModelProperty("1 直播 2回放 3錄播 (1,2代表直播,回放)")
+    private Long sectionType;
+
     /** 已学节数 */
     @ApiModelProperty("已学节数")
     private Long recordNum;

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -32,6 +32,7 @@
         <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"/>

+ 87 - 13
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -143,23 +143,97 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="listSection" parameterType="com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo"  resultMap="SectionStudyRecordVoResult">
         SELECT
-        DISTINCT r.section_id,
-        (select m.module_name FROM course_module m where r.module_id = m.module_id) as module_name,
-        (select m.name FROM course_chapter m where r.chapter_id = m.chapter_id) as chapter_name,
-        (select m.`name` FROM course_section m where r.section_id = m.section_id) as section_name,
-        (select m.duration_time FROM course_section m where r.section_id = m.section_id) as duration_time,
-        (select i.start_time FROM user_study_record i where r.section_id = i.section_id ORDER BY i.start_time ASC LIMIT 1) as start_time,
-        (select i.end_time FROM user_study_record i where r.section_id = i.section_id ORDER BY i.start_time DESC LIMIT 1) as end_time,
-        r.status
+            s.section_id,
+            s.name as section_name,
+            NULL as chapter_name,
+            NULL as module_name,
+            s.duration_time,
+            (select i.start_time FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+            ORDER BY i.start_time ASC LIMIT 1) as start_time,
+            (select i.end_time FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+            ORDER BY i.start_time DESC LIMIT 1) as end_time,
+            (select i.`status` FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+        LIMIT 1) as `status`
         FROM
-        user_study_record r
-        LEFT JOIN course c ON c.course_id = r.course_id
-        where 1=1
+            course_menu m
+            LEFT JOIN course_section s ON m.menu_id = s.section_id
+        WHERE
+            m.type =3
+        <if test="courseId != null and courseId !=''">
+            and m.course_id={courseId}
+        </if>
+        UNION
+        SELECT
+            s.section_id,
+            s.name as section_name,
+            (SELECT t.`name` FROM course_chapter t where m.menu_id = t.chapter_id ) as chapter_name,
+            NULL as module_name,
+            s.duration_time,
+        (select i.start_time FROM user_study_record i where m.menu_id = i.section_id
         <if test="userId != null and userId !=''">
-            and r.user_id = #{userId}
+            and u.user_id = #{userId}
         </if>
+        ORDER BY i.start_time ASC LIMIT 1) as start_time,
+        (select i.end_time FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+        ORDER BY i.start_time DESC LIMIT 1) as end_time,
+        (select i.`status` FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+        LIMIT 1) as `status`
+        FROM
+            course_chapter_section c
+            LEFT JOIN course_menu m on m.menu_id = c.chapter_id
+            LEFT JOIN course_section s ON c.section_id = s.section_id
+        WHERE
+            m.type =2
         <if test="courseId != null and courseId !=''">
-            and r.course_id =#{courseId}
+            and m.course_id={courseId}
         </if>
+        UNION
+        SELECT
+            s.section_id,
+            s.name as section_name,
+            (SELECT t.`name` FROM course_chapter t where e.chapter_id = t.chapter_id ) as chapter_name,
+            (SELECT t.module_name FROM course_module t where e.module_id = t.module_id ) as module_name,
+            s.duration_time,
+        (select i.start_time FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+        ORDER BY i.start_time ASC LIMIT 1) as start_time,
+        (select i.end_time FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+        ORDER BY i.start_time DESC LIMIT 1) as end_time,
+        (select i.`status` FROM user_study_record i where m.menu_id = i.section_id
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+        LIMIT 1) as `status`
+        FROM
+            course_chapter_section c
+            LEFT JOIN course_module_chapter e on c.chapter_id = e.chapter_id
+            LEFT JOIN course_menu m on m.menu_id = e.module_id
+            LEFT JOIN course_section s ON c.section_id = s.section_id
+        WHERE
+            m.type =1
+        <if test="courseId != null and courseId !=''">
+            and m.course_id={courseId}
+        </if>
+
     </select>
 </mapper>