| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.PowerDto; |
| | | import com.zy.common.model.enums.HtmlNavIconType; |
| | | import com.zy.common.utils.RandomValidateCodeUtil; |
| | |
| | | private RolePermissionService rolePermissionService; |
| | | |
| | | @RequestMapping("/login.action") |
| | | @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "登录") |
| | | public R loginAction(String mobile, String password){ |
| | | if (mobile.equals("super") && password.equals(Cools.md5(superPwd))) { |
| | | Map<String, Object> res = new HashMap<>(); |
| | |
| | | UserLogin userLogin = new UserLogin(); |
| | | userLogin.setUserId(user.getId()); |
| | | userLogin.setToken(token); |
| | | userLogin.setCreateTime(new Date()); |
| | | userLoginService.insert(userLogin); |
| | | Map<String, Object> res = new HashMap<>(); |
| | | res.put("username", user.getUsername()); |
| | |
| | | return R.ok(res); |
| | | } |
| | | |
| | | @RequestMapping("/code/switch.action") |
| | | public R code() { |
| | | return R.ok().add(Parameter.get().getCodeSwitch()); |
| | | } |
| | | |
| | | @RequestMapping("/code.action") |
| | | public void code(@RequestParam String sd, HttpServletResponse response) { |
| | | RandomValidateCodeUtil.getRandcode(sd, response); |
| | | } |
| | | |
| | | @RequestMapping("/code.do") |
| | | public String codeDo(@RequestParam String sd) throws Exception { |
| | | String code = null; |
| | |
| | | |
| | | // 是否拥有查看权限 |
| | | if (getUserId() != 9527) { |
| | | Resource view = resourceService.selectOne(new EntityWrapper<Resource>().eq("resource_id", resource.getId()).like("code", "view")); |
| | | Resource view = resourceService.selectOne(new EntityWrapper<Resource>().eq("resource_id", resource.getId()).like("code", "#view")); |
| | | if (!Cools.isEmpty(view)){ |
| | | RoleResource param = new RoleResource(); |
| | | param.setResourceId(view.getId()); |
| | |
| | | } |
| | | |
| | | @RequestMapping("/power/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "授权") |
| | | @Transactional |
| | | public R power(Long roleId, String powers){ |
| | | Role role = roleService.selectById(roleId); |