com.macro.mall.model.UmsPermission Java Examples

The following examples show how to use com.macro.mall.model.UmsPermission. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UmsPermissionServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Override
public int create(UmsPermission permission) {
    permission.setStatus(1);
    permission.setCreateTime(new Date());
    permission.setSort(0);
    return permissionMapper.insert(permission);
}
 
Example #2
Source File: UmsAdminController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取用户所有权限(包括+-权限)")
@RequestMapping(value = "/permission/{adminId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsPermission>> getPermissionList(@PathVariable Long adminId) {
    List<UmsPermission> permissionList = adminService.getPermissionList(adminId);
    return CommonResult.success(permissionList);
}
 
Example #3
Source File: UmsPermissionController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取所有权限列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsPermission>> list() {
    List<UmsPermission> permissionList = permissionService.list();
    return CommonResult.success(permissionList);
}
 
Example #4
Source File: UmsPermissionController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #5
Source File: UmsPermissionController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #6
Source File: SecurityConfig.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Bean
public UserDetailsService userDetailsService() {
    //获取登录用户信息
    return username -> {
        UmsAdmin admin = adminService.getAdminByUsername(username);
        if (admin != null) {
            List<UmsPermission> permissionList = adminService.getPermissionList(admin.getId());
            return new AdminUserDetails(admin,permissionList);
        }
        throw new UsernameNotFoundException("用户名或密码错误");
    };
}
 
Example #7
Source File: UmsPermissionServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public int create(UmsPermission permission) {
    permission.setStatus(1);
    permission.setCreateTime(new Date());
    permission.setSort(0);
    return permissionMapper.insert(permission);
}
 
Example #8
Source File: UmsPermissionServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Override
public List<UmsPermissionNode> treeList() {
    List<UmsPermission> permissionList = permissionMapper.selectByExample(new UmsPermissionExample());
    List<UmsPermissionNode> result = permissionList.stream()
            .filter(permission -> permission.getPid().equals(0L))
            .map(permission -> covert(permission,permissionList)).collect(Collectors.toList());
    return result;
}
 
Example #9
Source File: UmsPermissionServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public int create(UmsPermission permission) {
    permission.setStatus(1);
    permission.setCreateTime(new Date());
    permission.setSort(0);
    return permissionMapper.insert(permission);
}
 
Example #10
Source File: UmsPermissionServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public List<UmsPermissionNode> treeList() {
    List<UmsPermission> permissionList = permissionMapper.selectByExample(new UmsPermissionExample());
    List<UmsPermissionNode> result = permissionList.stream()
            .filter(permission -> permission.getPid().equals(0L))
            .map(permission -> covert(permission,permissionList)).collect(Collectors.toList());
    return result;
}
 
Example #11
Source File: UmsPermissionServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
/**
 * 将权限转换为带有子级的权限对象
 * 当找不到子级权限的时候map操作不会再递归调用covert
 */
private UmsPermissionNode covert(UmsPermission permission,List<UmsPermission> permissionList){
    UmsPermissionNode node = new UmsPermissionNode();
    BeanUtils.copyProperties(permission,node);
    List<UmsPermissionNode> children = permissionList.stream()
            .filter(subPermission -> subPermission.getPid().equals(permission.getId()))
            .map(subPermission -> covert(subPermission,permissionList)).collect(Collectors.toList());
    node.setChildren(children);
    return node;
}
 
Example #12
Source File: UmsAdminController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取用户所有权限(包括+-权限)")
@RequestMapping(value = "/permission/{adminId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsPermission>> getPermissionList(@PathVariable Long adminId) {
    List<UmsPermission> permissionList = adminService.getPermissionList(adminId);
    return CommonResult.success(permissionList);
}
 
Example #13
Source File: UmsPermissionController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取所有权限列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsPermission>> list() {
    List<UmsPermission> permissionList = permissionService.list();
    return CommonResult.success(permissionList);
}
 
Example #14
Source File: UmsPermissionController.java    From mall with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #15
Source File: UmsPermissionServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
/**
 * 将权限转换为带有子级的权限对象
 * 当找不到子级权限的时候map操作不会再递归调用covert
 */
private UmsPermissionNode covert(UmsPermission permission,List<UmsPermission> permissionList){
    UmsPermissionNode node = new UmsPermissionNode();
    BeanUtils.copyProperties(permission,node);
    List<UmsPermissionNode> children = permissionList.stream()
            .filter(subPermission -> subPermission.getPid().equals(permission.getId()))
            .map(subPermission -> covert(subPermission,permissionList)).collect(Collectors.toList());
    node.setChildren(children);
    return node;
}
 
Example #16
Source File: UmsPermissionController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation("获取所有权限列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list() {
    List<UmsPermission> permissionList = permissionService.list();
    return new CommonResult().success(permissionList);
}
 
Example #17
Source File: UmsAdminController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取用户所有权限(包括+-权限)")
@RequestMapping(value = "/permission/{adminId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsPermission>> getPermissionList(@PathVariable Long adminId) {
    List<UmsPermission> permissionList = adminService.getPermissionList(adminId);
    return CommonResult.success(permissionList);
}
 
Example #18
Source File: UmsRoleController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #19
Source File: UmsPermissionController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@ApiOperation("获取所有权限列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsPermission>> list() {
    List<UmsPermission> permissionList = permissionService.list();
    return CommonResult.success(permissionList);
}
 
Example #20
Source File: UmsPermissionController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #21
Source File: UmsPermissionController.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #22
Source File: UmsPermissionServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
/**
 * 将权限转换为带有子级的权限对象
 * 当找不到子级权限的时候map操作不会再递归调用covert
 */
private UmsPermissionNode covert(UmsPermission permission,List<UmsPermission> permissionList){
    UmsPermissionNode node = new UmsPermissionNode();
    BeanUtils.copyProperties(permission,node);
    List<UmsPermissionNode> children = permissionList.stream()
            .filter(subPermission -> subPermission.getPid().equals(permission.getId()))
            .map(subPermission -> covert(subPermission,permissionList)).collect(Collectors.toList());
    node.setChildren(children);
    return node;
}
 
Example #23
Source File: SecurityConfig.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Bean
public UserDetailsService userDetailsService() {
    //获取登录用户信息
    return username -> {
        UmsAdmin admin = adminService.getAdminByUsername(username);
        if (admin != null) {
            List<UmsPermission> permissionList = adminService.getPermissionList(admin.getId());
            return new AdminUserDetails(admin,permissionList);
        }
        throw new UsernameNotFoundException("用户名或密码错误");
    };
}
 
Example #24
Source File: UmsPermissionController.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@ApiOperation("修改权限")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable Long id, @RequestBody UmsPermission permission) {
    int count = permissionService.update(id,permission);
    if(count>0){
        return new CommonResult().success(count);
    }
    return new CommonResult().failed();
}
 
Example #25
Source File: UmsPermissionController.java    From mall with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #26
Source File: UmsPermissionServiceImpl.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public int update(Long id, UmsPermission permission) {
    permission.setId(id);
    return permissionMapper.updateByPrimaryKey(permission);
}
 
Example #27
Source File: UmsPermissionServiceImpl.java    From macrozheng with Apache License 2.0 4 votes vote down vote up
@Override
public List<UmsPermission> list() {
    return permissionMapper.selectByExample(new UmsPermissionExample());
}
 
Example #28
Source File: UmsPermissionServiceImpl.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public List<UmsPermission> list() {
    return permissionMapper.selectByExample(new UmsPermissionExample());
}
 
Example #29
Source File: UmsPermissionServiceImpl.java    From macrozheng with Apache License 2.0 4 votes vote down vote up
@Override
public int update(Long id, UmsPermission permission) {
    permission.setId(id);
    return permissionMapper.updateByPrimaryKey(permission);
}
 
Example #30
Source File: UmsPermissionServiceImpl.java    From mall-swarm with Apache License 2.0 4 votes vote down vote up
@Override
public List<UmsPermission> list() {
    return permissionMapper.selectByExample(new UmsPermissionExample());
}