Browse Source

更新

master
牧羊人 4 years ago
parent
commit
5359a19274
1 changed files with 13 additions and 16 deletions
  1. +13
    -16
      src/main/java/com/taauav/front/controller/UserAuthRuleController.java

+ 13
- 16
src/main/java/com/taauav/front/controller/UserAuthRuleController.java View File

package com.taauav.front.controller; package com.taauav.front.controller;




import com.taauav.admin.entity.SysAuthRule;
import com.taauav.admin.service.ISysAuthRuleService;
import com.taauav.common.bean.Menu; import com.taauav.common.bean.Menu;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.constant.PermissionConstants;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.taauav.front.entity.UserAuthRule;
import com.taauav.front.service.IUserAuthRuleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import com.taauav.front.controller.FrontBaseController;


import javax.validation.Valid; import javax.validation.Valid;
import java.util.HashMap; import java.util.HashMap;
public class UserAuthRuleController extends FrontBaseController { public class UserAuthRuleController extends FrontBaseController {


@Autowired @Autowired
private ISysAuthRuleService iSysAuthRuleService;
private IUserAuthRuleService userAuthRuleService;
@Autowired @Autowired
private Response response; private Response response;


@GetMapping("/index") @GetMapping("/index")
// @RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) // @RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION)
public Response index(@RequestBody(required = false) Map<String, String> request) { public Response index(@RequestBody(required = false) Map<String, String> request) {
return iSysAuthRuleService.getRulePageList(request);
return userAuthRuleService.getRulePageList(request);
} }


/** /**
*/ */
@RequestMapping("/edit") @RequestMapping("/edit")
// @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) // @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION)
public Response edit(@RequestBody @Valid SysAuthRule authRule, BindingResult bindingResult) {
public Response edit(@RequestBody @Valid UserAuthRule authRule, BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
String msg = bindingResult.getFieldError().getDefaultMessage(); String msg = bindingResult.getFieldError().getDefaultMessage();
return response.failure(msg); return response.failure(msg);
} }
return iSysAuthRuleService.editRule(authRule);
return userAuthRuleService.editRule(authRule);
} }


/** /**
// @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) // @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION)
public Response getAuthInfo(Integer id) { public Response getAuthInfo(Integer id) {
Map<String, Object> map = new HashMap<>(12); Map<String, Object> map = new HashMap<>(12);
SysAuthRule info = iSysAuthRuleService.getInfoById(id);
List<Menu> menuList = iSysAuthRuleService.buildTreeMenu();
UserAuthRule info = userAuthRuleService.getInfoById(id);
List<Menu> menuList = userAuthRuleService.buildTreeMenu();
map.put("title", info.getTitle()); map.put("title", info.getTitle());
map.put("name", info.getName()); map.put("name", info.getName());
map.put("icon", info.getIcon()); map.put("icon", info.getIcon());
*/ */
@PostMapping("/add") @PostMapping("/add")
// @RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) // @RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION)
public Response add(@RequestBody @Valid SysAuthRule authRule, BindingResult bindingResult) {
public Response add(@RequestBody @Valid UserAuthRule authRule, BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
String msg = bindingResult.getFieldError().getDefaultMessage(); String msg = bindingResult.getFieldError().getDefaultMessage();
return response.failure(msg); return response.failure(msg);
} }
return iSysAuthRuleService.addRule(authRule);
return userAuthRuleService.addRule(authRule);
} }


/** /**
*/ */
@PostMapping("/del") @PostMapping("/del")
// @RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) // @RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION)
public Response del(@RequestBody SysAuthRule authRule) {
return iSysAuthRuleService.delRule(authRule);
public Response del(@RequestBody UserAuthRule authRule) {
return userAuthRuleService.delRule(authRule);
} }


/** /**
@PostMapping("/editStatus") @PostMapping("/editStatus")
// @RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) // @RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION)
public Response editStatus(@RequestBody Map<String, String> map) { public Response editStatus(@RequestBody Map<String, String> map) {
return iSysAuthRuleService.editStatus(map);
return userAuthRuleService.editStatus(map);
} }


} }

Loading…
Cancel
Save