班级管理
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package com.peanut.modules.common.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.ClassEntity;
|
||||
import com.peanut.modules.common.entity.ClassModel;
|
||||
import com.peanut.modules.common.service.ClassEntityService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController("commonClass")
|
||||
@RequestMapping("common/class")
|
||||
public class ClassController {
|
||||
|
||||
@Autowired
|
||||
private ClassEntityService classEntityService;
|
||||
|
||||
@RequestMapping("/getClassModelList")
|
||||
public R getClassModelList(@RequestBody Map<String,Object> params){
|
||||
Page classModelList = classEntityService.getClassModelList(params);
|
||||
return R.ok().put("page",classModelList);
|
||||
}
|
||||
|
||||
@RequestMapping("/addClassModel")
|
||||
public R addClassModel(@RequestBody ClassModel classModel){
|
||||
if (classEntityService.addClassModel(classModel)){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error("保存出错");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/getClassModelByUserid")
|
||||
public R getClassModelByUserid(@RequestBody Map<String,Object> params){
|
||||
List<ClassModel> classModelList = classEntityService.getClassModelByUserid(params);
|
||||
return R.ok().put("classModelList",classModelList);
|
||||
}
|
||||
|
||||
@RequestMapping("/getClassList")
|
||||
public R getClassList(@RequestBody Map<String,Object> params){
|
||||
Page classList = classEntityService.getClassList(params);
|
||||
return R.ok().put("page",classList);
|
||||
}
|
||||
|
||||
@RequestMapping("/addClass")
|
||||
public R addClass(@RequestBody ClassEntity classEntity){
|
||||
if (classEntityService.save(classEntity)){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error("保存出错");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/editClass")
|
||||
public R editClass(@RequestBody ClassEntity classEntity){
|
||||
if (classEntityService.updateById(classEntity)){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error("编辑出错");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/delClass")
|
||||
public R delClass(@RequestBody Map<String,Object> params){
|
||||
if (classEntityService.removeById((Integer)params.get("classId"))){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error("删除出错");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user