|
@@ -1,14 +1,22 @@
|
|
|
package com.ynfy.buss.course.course.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ynfy.buss.course.course.entity.Course;
|
|
|
import com.ynfy.buss.course.course.mapper.CourseMapper;
|
|
|
import com.ynfy.buss.course.course.service.ICourseService;
|
|
|
import com.ynfy.buss.course.coursecatalog.service.ICourseCatalogService;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.modules.system.entity.SysDepart;
|
|
|
+import org.jeecg.modules.system.service.ISysDepartService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
/**
|
|
|
* @Description: course
|
|
|
* @Author: jeecg-boot
|
|
@@ -21,6 +29,12 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
@Autowired
|
|
|
private ICourseCatalogService courseCatalogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CourseMapper courseMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysDepartService sysDepartService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void saveCourse(Course course) {
|
|
@@ -28,4 +42,22 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
// 保存题目答案选项
|
|
|
courseCatalogService.saveAll(course.getId(), course.getCatalogList());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IPage<Course> selectCourseList(IPage<Course> page, Course course) {
|
|
|
+ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ if (StringUtils.isNotBlank(course.getName())) {
|
|
|
+ course.setName(course.getName().replace("*", ""));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(user.getOrgCode())) {
|
|
|
+ SysDepart depart = sysDepartService.queryByOrgCode(user.getOrgCode());
|
|
|
+ if (!Objects.isNull(depart)) {
|
|
|
+ user.setOrgCode(depart.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return courseMapper.selectCourseList(page, course, user);
|
|
|
+ }
|
|
|
}
|