|
|
@@ -7,6 +7,7 @@ import com.fs.common.annotation.RepeatSubmit;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
@@ -64,17 +65,13 @@ public class FsUserCourseController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('course:userCourse:list')")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(FsUserCourse fsUserCourse) {
|
|
|
-// startPage();
|
|
|
-// com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
-// Long userId = (loginUser.getCompanyUser() != null ? loginUser.getCompanyUser().getUserId() : null);
|
|
|
-// String json = configService.selectConfigByKey("course.config");
|
|
|
-// CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
-// if (ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
-// fsUserCourse.setUserId(userId);
|
|
|
-// }
|
|
|
-// List<FsUserCourseListPVO> list = fsUserCourseService.selectFsUserCourseListPVO(fsUserCourse);
|
|
|
-// return getDataTable(list);
|
|
|
- throw new RuntimeException("not implemented");
|
|
|
+ startPage();
|
|
|
+ applyCourseOwnerScope(fsUserCourse);
|
|
|
+ if (fsUserCourse.getIsPrivate() == null) {
|
|
|
+ fsUserCourse.setIsPrivate(1);
|
|
|
+ }
|
|
|
+ List<FsUserCourseListPVO> list = fsUserCourseService.selectFsUserCourseListPVO(fsUserCourse);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -83,17 +80,31 @@ public class FsUserCourseController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('course:userCourse:publicList')")
|
|
|
@GetMapping("/publicList")
|
|
|
public TableDataInfo publicList(FsUserCourse fsUserCourse) {
|
|
|
-// startPage();
|
|
|
-// com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
-// Long userId = (loginUser.getCompanyUser() != null ? loginUser.getCompanyUser().getUserId() : null);
|
|
|
-// String json = configService.selectConfigByKey("course.config");
|
|
|
-// CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
-// if (ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
-// fsUserCourse.setUserId(userId);
|
|
|
-// }
|
|
|
-// List<FsUserCourseListPVO> list = fsUserCourseService.selectFsUserCourseListPVO(fsUserCourse);
|
|
|
-// return getDataTable(list);
|
|
|
- throw new RuntimeException("not implemented");
|
|
|
+ startPage();
|
|
|
+ applyCourseOwnerScope(fsUserCourse);
|
|
|
+ if (fsUserCourse.getIsPrivate() == null) {
|
|
|
+ fsUserCourse.setIsPrivate(0);
|
|
|
+ }
|
|
|
+ List<FsUserCourseListPVO> list = fsUserCourseService.selectFsUserCourseListPVO(fsUserCourse);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 课程配置开启「绑定创建人」时,按当前登录后台用户过滤课程归属
|
|
|
+ */
|
|
|
+ private void applyCourseOwnerScope(FsUserCourse query) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ if (loginUser == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ if (ObjectUtil.isEmpty(json)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
+ query.setUserId(loginUser.getUserId());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|