|
@@ -1,7 +1,5 @@
|
|
package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -18,73 +16,78 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.commons.web.security.entity.AccessUser;
|
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.SpecialtyRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.SpecialtyRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Course;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Course;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Specialty;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Specialty;
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.CourseSpeciatlyService;
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.CourseSpeciatlyService;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description 课程专业关联API
|
|
* @Description 课程专业关联API
|
|
* @author Administrator
|
|
* @author Administrator
|
|
- * @Date 2017年8月8号
|
|
|
|
|
|
+ * @Date 2017年8月8号
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("${$rmp.ctr.basic}/CourseSpeciatly")
|
|
@RequestMapping("${$rmp.ctr.basic}/CourseSpeciatly")
|
|
-public class CourseSpeciatlyController extends ControllerSupport{
|
|
|
|
|
|
+public class CourseSpeciatlyController extends ControllerSupport {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
CourseSpeciatlyService courseSpeciatlyService;
|
|
CourseSpeciatlyService courseSpeciatlyService;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
CourseRepo courseRepo;
|
|
CourseRepo courseRepo;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
SpecialtyRepo specialtyRepo;
|
|
SpecialtyRepo specialtyRepo;
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据专业ID查询课程
|
|
* 根据专业ID查询课程
|
|
|
|
+ *
|
|
* @param speciatlyId
|
|
* @param speciatlyId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @ApiOperation(value="根据专业ID取课程",notes="根据专业ID取课程")
|
|
|
|
|
|
+ @ApiOperation(value = "根据专业ID取课程", notes = "根据专业ID取课程")
|
|
@GetMapping("/allCourses/{speciatlyId}")
|
|
@GetMapping("/allCourses/{speciatlyId}")
|
|
- public ResponseEntity getAllCoursesBySpeciatly(@PathVariable String speciatlyId,HttpServletRequest request){
|
|
|
|
|
|
+ public ResponseEntity getAllCoursesBySpeciatly(@PathVariable String speciatlyId,
|
|
|
|
+ HttpServletRequest request) {
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
List<Course> courses = courseSpeciatlyService.getAllCoursesBySpeciatlyId(speciatlyId);
|
|
List<Course> courses = courseSpeciatlyService.getAllCoursesBySpeciatlyId(speciatlyId);
|
|
- //List<Course> list = courseSpeciatlyService.getCoursesNotInSpeciatly(courses);
|
|
|
|
|
|
+ // List<Course> list =
|
|
|
|
+ // courseSpeciatlyService.getCoursesNotInSpeciatly(courses);
|
|
List<Course> list = courseRepo.findByOrgId(accessUser.getRootOrgId());
|
|
List<Course> list = courseRepo.findByOrgId(accessUser.getRootOrgId());
|
|
Map map = new HashMap();
|
|
Map map = new HashMap();
|
|
map.put("courseList", courses);
|
|
map.put("courseList", courses);
|
|
map.put("courseAllList", list);
|
|
map.put("courseAllList", list);
|
|
- return new ResponseEntity(map,HttpStatus.OK);
|
|
|
|
|
|
+ return new ResponseEntity(map, HttpStatus.OK);
|
|
}
|
|
}
|
|
-
|
|
|
|
- @ApiOperation(value="新增关联课程专业",notes="新增关联课程专业")
|
|
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "新增关联课程专业", notes = "新增关联课程专业")
|
|
@PostMapping("/addCourse/{speciallyId}")
|
|
@PostMapping("/addCourse/{speciallyId}")
|
|
- public ResponseEntity addCourseSpeciatly(@RequestBody List<String> list,@PathVariable String speciallyId,HttpServletRequest request){
|
|
|
|
|
|
+ public ResponseEntity addCourseSpeciatly(@RequestBody List<String> list,
|
|
|
|
+ @PathVariable String speciallyId, HttpServletRequest request) {
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
courseSpeciatlyService.addCourseSpecialty(accessUser.getUserId(), list, speciallyId);
|
|
courseSpeciatlyService.addCourseSpecialty(accessUser.getUserId(), list, speciallyId);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
}
|
|
}
|
|
-
|
|
|
|
- @ApiOperation(value="根据课程ID取专业",notes="根据课程ID取专业")
|
|
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "根据课程ID取专业", notes = "根据课程ID取专业")
|
|
@GetMapping("/allSpecialty/{courseId}")
|
|
@GetMapping("/allSpecialty/{courseId}")
|
|
- public ResponseEntity getAllSpeciatly(@PathVariable Long courseId,HttpServletRequest request){
|
|
|
|
|
|
+ public ResponseEntity getAllSpeciatly(@PathVariable Long courseId, HttpServletRequest request) {
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
List<Specialty> specialtys = courseSpeciatlyService.getAllSpecialtyByCourseId(courseId);
|
|
List<Specialty> specialtys = courseSpeciatlyService.getAllSpecialtyByCourseId(courseId);
|
|
List<Specialty> list = specialtyRepo.findByOrgId(accessUser.getRootOrgId());
|
|
List<Specialty> list = specialtyRepo.findByOrgId(accessUser.getRootOrgId());
|
|
Map map = new HashMap();
|
|
Map map = new HashMap();
|
|
map.put("specialtyList", specialtys);
|
|
map.put("specialtyList", specialtys);
|
|
map.put("specialtyAllList", list);
|
|
map.put("specialtyAllList", list);
|
|
- return new ResponseEntity(map,HttpStatus.OK);
|
|
|
|
|
|
+ return new ResponseEntity(map, HttpStatus.OK);
|
|
}
|
|
}
|
|
-
|
|
|
|
- @ApiOperation(value="新增关联课程专业",notes="新增关联课程专业")
|
|
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "新增关联课程专业", notes = "新增关联课程专业")
|
|
@PostMapping("/addSpeciatly/{courseId}")
|
|
@PostMapping("/addSpeciatly/{courseId}")
|
|
- public ResponseEntity addSpeciatly(@RequestBody List<String> list,@PathVariable Long courseId,HttpServletRequest request){
|
|
|
|
|
|
+ public ResponseEntity addSpeciatly(@RequestBody List<String> list, @PathVariable Long courseId,
|
|
|
|
+ HttpServletRequest request) {
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
courseSpeciatlyService.addCourse(accessUser.getUserId(), list, courseId);
|
|
courseSpeciatlyService.addCourse(accessUser.getUserId(), list, courseId);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
return new ResponseEntity(HttpStatus.OK);
|