package com.lyms.cm.controller.sys; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.lyms.cm.entity.sys.SysRoles; import com.lyms.cm.service.sys.SysRolesService; import com.lyms.constants.OperationName; import com.lyms.util.StrUtils; import com.lyms.web.bean.AjaxResult; import com.lyms.web.controller.BaseController; /** *
* 角色表 前端控制器 *
* * @author maliang * @since 2017-03-02 */ @Controller @RequestMapping("/sysRoles") public class SysRolesController extends BaseController { @Autowired private SysRolesService sysRolesService; @RequestMapping("/toList") public String list() { return "/role/role_list"; } @RequestMapping(value = "/getRoleList", method = { RequestMethod.POST }) @ResponseBody public java.util.Map* TODO * * @param user * @return */ @RequestMapping(value = "/create", method = RequestMethod.POST) @ResponseBody public AjaxResult create(SysRoles role, AjaxResult ajaxResult) { role.setId(StrUtils.uuid()); role.setIfdel(0); boolean tag = sysRolesService.insert(role); return handleAjaxResult(ajaxResult, tag, OperationName.CREATE); } /** * 修改信息 */ @RequestMapping(value = "/update", method = { RequestMethod.POST }) @ResponseBody public AjaxResult update(SysRoles role, AjaxResult ajaxResult) { boolean tag = sysRolesService.updateById(role); return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE); } /** * 删除用户 * * @return */ @RequestMapping(value = "/{id}/delete", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody public AjaxResult delete(@PathVariable String id, AjaxResult ajaxResult) { int tag = sysRolesService.deleteLogicById(id); return handleAjaxResult(ajaxResult, tag, OperationName.DELETE); } }