package com.moral.controller;
|
|
import java.util.List;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import com.moral.common.bean.PageBean;
|
import com.moral.common.bean.ResultBean;
|
import com.moral.entity.Role;
|
import com.moral.service.RoleService;
|
|
@RestController
|
@RequestMapping("role")
|
@CrossOrigin(origins = "*", maxAge = 3600)
|
public class RoleController {
|
|
@Autowired
|
RoleService roleService;
|
|
@GetMapping("count-by-example")
|
public ResultBean<Integer> countByExample(PageBean pageBean){
|
return new ResultBean<Integer>(roleService.countByExample(pageBean));
|
}
|
|
@GetMapping("page-list")
|
public PageBean pageList(PageBean pageBean) {
|
return roleService.queryByPageBean(pageBean);
|
}
|
|
@PostMapping("add-or-modify")
|
public ResultBean addOrModify(@RequestBody Role role) {
|
roleService.addOrModify(role);
|
ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
|
return resultBean;
|
}
|
|
@PostMapping("delete-by-ids")
|
public ResultBean deleteByIds(@RequestBody List<Integer> ids){
|
roleService.deleteByIds(ids);
|
ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
|
return resultBean;
|
}
|
}
|