|
|
@@ -1,17 +1,14 @@ |
|
|
|
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.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.validation.BindingResult; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import com.taauav.front.controller.FrontBaseController; |
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
import java.util.HashMap; |
|
|
@@ -31,7 +28,7 @@ import java.util.Map; |
|
|
|
public class UserAuthRuleController extends FrontBaseController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ISysAuthRuleService iSysAuthRuleService; |
|
|
|
private IUserAuthRuleService userAuthRuleService; |
|
|
|
@Autowired |
|
|
|
private Response response; |
|
|
|
|
|
|
@@ -45,7 +42,7 @@ public class UserAuthRuleController extends FrontBaseController { |
|
|
|
@GetMapping("/index") |
|
|
|
// @RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) |
|
|
|
public Response index(@RequestBody(required = false) Map<String, String> request) { |
|
|
|
return iSysAuthRuleService.getRulePageList(request); |
|
|
|
return userAuthRuleService.getRulePageList(request); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -55,12 +52,12 @@ public class UserAuthRuleController extends FrontBaseController { |
|
|
|
*/ |
|
|
|
@RequestMapping("/edit") |
|
|
|
// @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()) { |
|
|
|
String msg = bindingResult.getFieldError().getDefaultMessage(); |
|
|
|
return response.failure(msg); |
|
|
|
} |
|
|
|
return iSysAuthRuleService.editRule(authRule); |
|
|
|
return userAuthRuleService.editRule(authRule); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -73,8 +70,8 @@ public class UserAuthRuleController extends FrontBaseController { |
|
|
|
// @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) |
|
|
|
public Response getAuthInfo(Integer id) { |
|
|
|
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("name", info.getName()); |
|
|
|
map.put("icon", info.getIcon()); |
|
|
@@ -97,12 +94,12 @@ public class UserAuthRuleController extends FrontBaseController { |
|
|
|
*/ |
|
|
|
@PostMapping("/add") |
|
|
|
// @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()) { |
|
|
|
String msg = bindingResult.getFieldError().getDefaultMessage(); |
|
|
|
return response.failure(msg); |
|
|
|
} |
|
|
|
return iSysAuthRuleService.addRule(authRule); |
|
|
|
return userAuthRuleService.addRule(authRule); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -112,8 +109,8 @@ public class UserAuthRuleController extends FrontBaseController { |
|
|
|
*/ |
|
|
|
@PostMapping("/del") |
|
|
|
// @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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -125,7 +122,7 @@ public class UserAuthRuleController extends FrontBaseController { |
|
|
|
@PostMapping("/editStatus") |
|
|
|
// @RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) |
|
|
|
public Response editStatus(@RequestBody Map<String, String> map) { |
|
|
|
return iSysAuthRuleService.editStatus(map); |
|
|
|
return userAuthRuleService.editStatus(map); |
|
|
|
} |
|
|
|
|
|
|
|
} |