-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lanxinghua
committed
Oct 25, 2019
1 parent
c60a572
commit c48eb24
Showing
4 changed files
with
204 additions
and
12 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
mall-admin/src/main/java/com/mall/controller/UmsMemberLevelController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.mall.controller; | ||
|
||
import com.mall.common.share.result.CommonResult; | ||
import com.mall.model.UmsMemberLevel; | ||
import com.mall.service.UmsMemberLevelService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 会员等级管理Controller | ||
*/ | ||
@Controller | ||
@Api(tags = "UmsMemberLevelController", description = "会员等级管理") | ||
@RequestMapping("/memberLevel") | ||
public class UmsMemberLevelController { | ||
@Autowired | ||
private UmsMemberLevelService memberLevelService; | ||
|
||
@RequestMapping(value = "/list", method = RequestMethod.GET) | ||
@ApiOperation("查询所有会员等级") | ||
@ResponseBody | ||
public CommonResult<List<UmsMemberLevel>> list(@RequestParam("defaultStatus") Integer defaultStatus) { | ||
List<UmsMemberLevel> memberLevelList = memberLevelService.list(defaultStatus); | ||
return CommonResult.success(memberLevelList); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
mall-admin/src/main/java/com/mall/controller/UmsPermissionController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.mall.controller; | ||
|
||
import com.mall.common.share.result.CommonResult; | ||
import com.mall.dto.UmsPermissionNode; | ||
import com.mall.model.UmsPermission; | ||
import com.mall.service.UmsPermissionService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 后台用户权限管理 | ||
*/ | ||
@Controller | ||
@Api(tags = "UmsPermissionController", description = "后台用户权限管理") | ||
@RequestMapping("/permission") | ||
public class UmsPermissionController { | ||
@Autowired | ||
private UmsPermissionService permissionService; | ||
@ApiOperation("添加权限") | ||
@RequestMapping(value = "/create", method = RequestMethod.POST) | ||
@ResponseBody | ||
public CommonResult create(@RequestBody UmsPermission permission) { | ||
int count = permissionService.create(permission); | ||
if(count>0){ | ||
return CommonResult.success(count); | ||
} | ||
return CommonResult.failed(); | ||
} | ||
|
||
@ApiOperation("修改权限") | ||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST) | ||
@ResponseBody | ||
public CommonResult update(@PathVariable Long id, @RequestBody UmsPermission permission) { | ||
int count = permissionService.update(id,permission); | ||
if(count>0){ | ||
return CommonResult.success(count); | ||
} | ||
return CommonResult.failed(); | ||
} | ||
|
||
@ApiOperation("根据id批量删除权限") | ||
@RequestMapping(value = "/delete", method = RequestMethod.POST) | ||
@ResponseBody | ||
public CommonResult delete(@RequestParam("ids") List<Long> ids) { | ||
int count = permissionService.delete(ids); | ||
if(count>0){ | ||
return CommonResult.success(count); | ||
} | ||
return CommonResult.failed(); | ||
} | ||
|
||
@ApiOperation("以层级结构返回所有权限") | ||
@RequestMapping(value = "/treeList", method = RequestMethod.GET) | ||
@ResponseBody | ||
public CommonResult<List<UmsPermissionNode>> treeList() { | ||
List<UmsPermissionNode> permissionNodeList = permissionService.treeList(); | ||
return CommonResult.success(permissionNodeList); | ||
} | ||
|
||
@ApiOperation("获取所有权限列表") | ||
@RequestMapping(value = "/list", method = RequestMethod.GET) | ||
@ResponseBody | ||
public CommonResult<List<UmsPermission>> list() { | ||
List<UmsPermission> permissionList = permissionService.list(); | ||
return CommonResult.success(permissionList); | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
mall-admin/src/main/java/com/mall/controller/UmsRoleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.mall.controller; | ||
|
||
import com.mall.common.share.result.CommonResult; | ||
import com.mall.model.UmsPermission; | ||
import com.mall.model.UmsRole; | ||
import com.mall.service.UmsRoleService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 后台用户角色管理 | ||
*/ | ||
@Controller | ||
@Api(tags = "UmsRoleController", description = "后台用户角色管理") | ||
@RequestMapping("/role") | ||
public class UmsRoleController { | ||
@Autowired | ||
private UmsRoleService roleService; | ||
|
||
@ApiOperation("添加角色") | ||
@RequestMapping(value = "/create", method = RequestMethod.POST) | ||
@ResponseBody | ||
public CommonResult create(@RequestBody UmsRole role) { | ||
int count = roleService.create(role); | ||
if (count > 0) { | ||
return CommonResult.success(count); | ||
} | ||
return CommonResult.failed(); | ||
} | ||
|
||
@ApiOperation("修改角色") | ||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST) | ||
@ResponseBody | ||
public CommonResult update(@PathVariable Long id, @RequestBody UmsRole role) { | ||
int count = roleService.update(id, role); | ||
if (count > 0) { | ||
return CommonResult.success(count); | ||
} | ||
return CommonResult.failed(); | ||
} | ||
|
||
@ApiOperation("批量删除角色") | ||
@RequestMapping(value = "/delete", method = RequestMethod.POST) | ||
@ResponseBody | ||
public CommonResult delete(@RequestParam("ids") List<Long> ids) { | ||
int count = roleService.delete(ids); | ||
if (count > 0) { | ||
return CommonResult.success(count); | ||
} | ||
return CommonResult.failed(); | ||
} | ||
|
||
@ApiOperation("获取相应角色权限") | ||
@RequestMapping(value = "/permission/{roleId}", method = RequestMethod.GET) | ||
@ResponseBody | ||
public CommonResult<List<UmsPermission>> getPermissionList(@PathVariable Long roleId) { | ||
List<UmsPermission> permissionList = roleService.getPermissionList(roleId); | ||
return CommonResult.success(permissionList); | ||
} | ||
|
||
@ApiOperation("修改角色权限") | ||
@RequestMapping(value = "/permission/update", method = RequestMethod.POST) | ||
@ResponseBody | ||
public CommonResult updatePermission(@RequestParam Long roleId, | ||
@RequestParam("permissionIds") List<Long> permissionIds) { | ||
int count = roleService.updatePermission(roleId, permissionIds); | ||
if (count > 0) { | ||
return CommonResult.success(count); | ||
} | ||
return CommonResult.failed(); | ||
} | ||
|
||
@ApiOperation("获取所有角色") | ||
@RequestMapping(value = "/list", method = RequestMethod.GET) | ||
@ResponseBody | ||
public Object list() { | ||
List<UmsRole> roleList = roleService.list(); | ||
return CommonResult.success(roleList); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters