|
@@ -7,6 +7,7 @@ import com.macro.mall.tiny.common.api.CommonResult;
|
|
|
import com.macro.mall.tiny.modules.ums.dto.UmsAdminLoginParam;
|
|
|
import com.macro.mall.tiny.modules.ums.dto.UmsAdminParam;
|
|
|
import com.macro.mall.tiny.modules.ums.dto.UpdateAdminPasswordParam;
|
|
|
+import com.macro.mall.tiny.modules.ums.dto.UpdateAdminRoleParam;
|
|
|
import com.macro.mall.tiny.modules.ums.model.UmsAdmin;
|
|
|
import com.macro.mall.tiny.modules.ums.model.UmsRole;
|
|
|
import com.macro.mall.tiny.modules.ums.service.UmsAdminService;
|
|
@@ -87,7 +88,7 @@ public class UmsAdminController {
|
|
|
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public CommonResult getAdminInfo(Principal principal) {
|
|
|
- if(principal==null){
|
|
|
+ if (principal == null) {
|
|
|
return CommonResult.unauthorized(null);
|
|
|
}
|
|
|
String username = principal.getName();
|
|
@@ -97,9 +98,9 @@ public class UmsAdminController {
|
|
|
data.put("menus", roleService.getMenuList(umsAdmin.getId()));
|
|
|
data.put("icon", umsAdmin.getIcon());
|
|
|
List<UmsRole> roleList = adminService.getRoleList(umsAdmin.getId());
|
|
|
- if(CollUtil.isNotEmpty(roleList)){
|
|
|
+ if (CollUtil.isNotEmpty(roleList)) {
|
|
|
List<String> roles = roleList.stream().map(UmsRole::getName).collect(Collectors.toList());
|
|
|
- data.put("roles",roles);
|
|
|
+ data.put("roles", roles);
|
|
|
}
|
|
|
return CommonResult.success(data);
|
|
|
}
|
|
@@ -172,10 +173,10 @@ public class UmsAdminController {
|
|
|
@ApiOperation("修改帐号状态")
|
|
|
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public CommonResult updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status) {
|
|
|
+ public CommonResult updateStatus(@PathVariable Long id, @RequestParam(value = "status") Integer status) {
|
|
|
UmsAdmin umsAdmin = new UmsAdmin();
|
|
|
umsAdmin.setStatus(status);
|
|
|
- boolean success = adminService.update(id,umsAdmin);
|
|
|
+ boolean success = adminService.update(id, umsAdmin);
|
|
|
if (success) {
|
|
|
return CommonResult.success(null);
|
|
|
}
|
|
@@ -185,9 +186,8 @@ public class UmsAdminController {
|
|
|
@ApiOperation("给用户分配角色")
|
|
|
@RequestMapping(value = "/role/update", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public CommonResult updateRole(@RequestParam("adminId") Long adminId,
|
|
|
- @RequestParam("roleIds") List<Long> roleIds) {
|
|
|
- int count = adminService.updateRole(adminId, roleIds);
|
|
|
+ public CommonResult updateRole(@RequestBody UpdateAdminRoleParam updateAdminRoleParam) {
|
|
|
+ int count = adminService.updateRole(updateAdminRoleParam.getAdminId(), updateAdminRoleParam.getRoleIds());
|
|
|
if (count >= 0) {
|
|
|
return CommonResult.success(count);
|
|
|
}
|