package com.zy.bms.controller.pc; import com.zy.bms.common.ServerResponse; import com.zy.bms.common.io.pc.RoleIO; import com.zy.bms.model.Role; import com.zy.bms.service.IRoleService; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; /** *
* 角色表 前端控制器 *
* * @author chenyi * @since 2021-05-19 */ @RestController @RequestMapping("/builder/role") public class RoleController { @Resource private IRoleService roleService; /** * 分页查询角色项目 */ @PostMapping("listPage") public ServerResponse listPage(RoleIO io) { return ServerResponse.createBySuccess(roleService.listPage(io)); } /** * 添加角色 */ @PostMapping("save.do") public ServerResponse save(Role role) { if (roleService.checkRepeat(role.getName())) return ServerResponse.createByWarning("添加失败:角色名重复"); return ServerResponse.createBySuccess(roleService.save(role)); } /** * 更新角色信息 */ @PostMapping("update.do") public ServerResponse update(Role role) { roleService.updateById(role); return ServerResponse.createBySuccess(); } }