|
|
|
@ -1,9 +1,26 @@ |
|
|
|
|
package org.jeecg.modules.course.controller; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
|
import org.jeecg.modules.course.entity.SeCoureseType; |
|
|
|
|
import org.jeecg.modules.course.entity.SeCourseobjectives; |
|
|
|
|
import org.jeecg.modules.course.service.ISeCourseobjectivesService; |
|
|
|
|
import org.jeecg.modules.course.service.ISeCourseobjectivesService1; |
|
|
|
|
import org.jeecg.modules.course.service.ISecourseMethodService; |
|
|
|
|
import org.jeecg.modules.course.vo.SeCourseobjectives1; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
@Api(tags = "新课程") |
|
|
|
|
@RestController |
|
|
|
@ -11,5 +28,99 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
@Slf4j |
|
|
|
|
public class XinsecourseController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ISeCourseobjectivesService1 seCourseobjectivesService1; |
|
|
|
|
@Autowired |
|
|
|
|
private ISecourseMethodService iSecourseMethodService; |
|
|
|
|
@AutoLog(value = "课程目标-分页列表查询") |
|
|
|
|
@ApiOperation(value = "课程目标-分页列表查询", notes = "课程目标-分页列表查询") |
|
|
|
|
@GetMapping(value = "/rootList") |
|
|
|
|
public Result<?> queryPageList(SeCourseobjectives seCourseobjectives, |
|
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
System.out.println(seCourseobjectives.toString()); |
|
|
|
|
SeCourseobjectives sp=seCourseobjectivesService1.findParent(seCourseobjectives.getCourseid(),seCourseobjectives.getPid()); |
|
|
|
|
HashMap<Object,Object> hashMap=new HashMap<>(); |
|
|
|
|
hashMap.put("parent",sp); |
|
|
|
|
if(sp==null){ |
|
|
|
|
hashMap.put("child",null); |
|
|
|
|
return Result.ok(hashMap); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<SeCourseobjectives1> list=seCourseobjectivesService1.findchild(sp.getId()); |
|
|
|
|
hashMap.put("child",list); |
|
|
|
|
return Result.ok(hashMap); |
|
|
|
|
} |
|
|
|
|
@AutoLog(value = "Main-添加or修改") |
|
|
|
|
@ApiOperation(value = "Main-添加or修改", notes = "Main-添加or修改") |
|
|
|
|
@PostMapping(value = "/mainadd") |
|
|
|
|
public Result<?> mainadd(@RequestBody SeCourseobjectives1 seCourseobjectives1){ |
|
|
|
|
System.out.println(seCourseobjectives1.toString()); |
|
|
|
|
if(seCourseobjectives1.getId()==null||seCourseobjectives1.getId().equals("")){ |
|
|
|
|
int a=seCourseobjectivesService1.selectcout(seCourseobjectives1.getCourseid()); |
|
|
|
|
if(a>=1) |
|
|
|
|
return Result.error("数据库已存在,新增失败"); |
|
|
|
|
seCourseobjectivesService1.save(seCourseobjectives1); |
|
|
|
|
return Result.ok("新增成功"); |
|
|
|
|
}else{ |
|
|
|
|
seCourseobjectivesService1.updateById(seCourseobjectives1); |
|
|
|
|
return Result.ok("修改成功"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@AutoLog(value = "Child-添加or修改") |
|
|
|
|
@ApiOperation(value = "Child-添加or修改", notes = "Child-添加or修改") |
|
|
|
|
@PostMapping(value = "/childadd") |
|
|
|
|
public Result<?> childadd(@RequestBody SeCourseobjectives1 seCourseobjectives1){ |
|
|
|
|
System.out.println(seCourseobjectives1.toString()); |
|
|
|
|
if(seCourseobjectives1.getId()==null||seCourseobjectives1.getId().equals("")){ |
|
|
|
|
if(seCourseobjectives1.getPid()==null||seCourseobjectives1.getPid().equals("")) |
|
|
|
|
return Result.error("总体目标尚未确定,请先添加总体目标!!"); |
|
|
|
|
seCourseobjectivesService1.save(seCourseobjectives1); |
|
|
|
|
seCourseobjectivesService1.updateChildSize(seCourseobjectives1.getPid()); |
|
|
|
|
return Result.ok("新增成功"); |
|
|
|
|
}else{ |
|
|
|
|
seCourseobjectivesService1.updateById(seCourseobjectives1); |
|
|
|
|
return Result.ok("修改成功"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@AutoLog(value = "Child-删除") |
|
|
|
|
@ApiOperation(value = "Child-删除", notes = "Child-删除") |
|
|
|
|
@DeleteMapping(value = "/childdelete") |
|
|
|
|
public Result<?> childdelete(@RequestParam(name = "id", required = true)String id){ |
|
|
|
|
seCourseobjectivesService1.deleteChild(id); |
|
|
|
|
return Result.ok("删除成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//考核方式*************************
|
|
|
|
|
@AutoLog(value = "考核-添加or修改") |
|
|
|
|
@ApiOperation(value = "考核-添加or修改", notes = "考核-添加or修改") |
|
|
|
|
@PostMapping(value = "/methodadd") |
|
|
|
|
public Result<?> methodAdd(@RequestBody SeCoureseType seCoureseType){ |
|
|
|
|
System.out.println(seCoureseType.toString()); |
|
|
|
|
if(Integer.valueOf(seCoureseType.getFinalExam())+Integer.valueOf(seCoureseType.getProcessAssessment())!=100) |
|
|
|
|
return Result.error("比例划分错误"); |
|
|
|
|
if(seCoureseType.getId()==null||seCoureseType.getId().equals("")){ |
|
|
|
|
QueryWrapper<SeCoureseType> queryWrapper=new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("name",seCoureseType.getName()); |
|
|
|
|
int a=iSecourseMethodService.count(queryWrapper); |
|
|
|
|
if(a>0) |
|
|
|
|
return Result.error("已存在比例划分"); |
|
|
|
|
iSecourseMethodService.save(seCoureseType); |
|
|
|
|
return Result.ok("新增成功!!!"); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
iSecourseMethodService.updateById(seCoureseType); |
|
|
|
|
return Result.ok("修改成功!!!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@AutoLog(value = "考核目标-分页列表查询") |
|
|
|
|
@ApiOperation(value = "考核目标-分页列表查询", notes = "考核目标-分页列表查询") |
|
|
|
|
@GetMapping(value = "/methodList") |
|
|
|
|
public Result<?> queryMethod(@RequestParam(name = "id", required = true)String id) { |
|
|
|
|
QueryWrapper<SeCoureseType> queryWrapper=new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("name",id); |
|
|
|
|
SeCoureseType seCoureseType=iSecourseMethodService.getOne(queryWrapper); |
|
|
|
|
return Result.ok(seCoureseType); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|