|
|
@@ -2,10 +2,13 @@ package com.education.business.service.education;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.education.auth.AuthUtil;
|
|
|
+import com.education.auth.session.UserSession;
|
|
|
import com.education.business.mapper.education.CourseInfoMapper;
|
|
|
import com.education.business.service.BaseService;
|
|
|
import com.education.common.constants.EnumConstants;
|
|
|
import com.education.common.constants.LockKey;
|
|
|
+import com.education.common.enums.LoginEnum;
|
|
|
import com.education.common.exception.BusinessException;
|
|
|
import com.education.common.model.PageInfo;
|
|
|
import com.education.common.utils.ResultCode;
|
|
|
@@ -142,4 +145,27 @@ public class CourseInfoService extends BaseService<CourseInfoMapper, CourseInfo>
|
|
|
throw new BusinessException("课程已上架,无法删除");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public List<CourseInfoDto> myCourseList() {
|
|
|
+
|
|
|
+ UserSession userSession = AuthUtil.getSession(LoginEnum.STUDENT.getValue());
|
|
|
+ List<CourseInfoDto> list = baseMapper.myCourseList(userSession.getId().intValue());
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PageInfo<CourseInfoDto> selectList(PageParam pageParam, Integer subjectId,Integer status) {
|
|
|
+ UserSession userSession = AuthUtil.getSession(LoginEnum.STUDENT.getValue());
|
|
|
+ Page<CourseInfoDto> page = new Page<>(pageParam.getPageNumber(), pageParam.getPageSize());
|
|
|
+ Page<CourseInfoDto> resultPage = baseMapper.selectListBySubjectId(page, subjectId, status,userSession.getId().intValue());
|
|
|
+ List<CourseInfoDto> list = resultPage.getRecords();
|
|
|
+ list.forEach(item -> {
|
|
|
+ Integer studentId = item.getStudentId();
|
|
|
+ if (studentId == null) {
|
|
|
+ item.setCollectFlag(ResultCode.FAIL);
|
|
|
+ } else {
|
|
|
+ item.setCollectFlag(ResultCode.SUCCESS);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return selectPage(resultPage);
|
|
|
+ }
|
|
|
}
|