| | |
| | | package com.qianwen.smartman.modules.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.validation.Valid; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.cache.SysCache; |
| | | import com.qianwen.smartman.common.constant.ExtCacheConstant; |
| | | import com.qianwen.core.boot.ctrl.BladeController; |
| | | import com.qianwen.core.cache.utils.CacheUtil; |
| | | import com.qianwen.core.log.annotation.ApiLog; |
| | |
| | | import com.qianwen.core.tenant.annotation.NonDS; |
| | | import com.qianwen.core.tool.api.R; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.cache.SysCache; |
| | | import com.qianwen.smartman.common.constant.ExtCacheConstant; |
| | | import com.qianwen.smartman.modules.system.entity.Role; |
| | | import com.qianwen.smartman.modules.system.service.IRoleService; |
| | | import com.qianwen.smartman.modules.system.vo.GrantVO; |
| | | import com.qianwen.smartman.modules.system.vo.RoleVO; |
| | | import com.qianwen.smartman.modules.system.wrapper.RoleWrapper; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | @Api(value = "角色", tags = {"角色"}) |
| | |
| | | public class RoleController extends BladeController { |
| | | private final IRoleService roleService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -1041904421: |
| | | if (implMethodName.equals("getParentId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75145708: |
| | | if (implMethodName.equals("getSort")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 771206363: |
| | | if (implMethodName.equals("getTenantId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/Role") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getSort(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/Role") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getSort(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/Role") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getSort(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/Role") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/Role") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getTenantId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/Role") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getParentId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public RoleController(final IRoleService roleService) { |
| | | this.roleService = roleService; |
| | |
| | | @ApiOperation(value = "列表", notes = "传入role") |
| | | public R<List<RoleVO>> list(@RequestParam @ApiIgnore Map<String, Object> role, BladeUser bladeUser) { |
| | | QueryWrapper<Role> queryWrapper = Condition.getQueryWrapper(role, Role.class); |
| | | List<Role> list = this.roleService.list(!bladeUser.getTenantId().equals("000000") ? queryWrapper.lambda() |
| | | .eq(Role::getTenantId, bladeUser.getTenantId()).orderByAsc(Role::getSort) : queryWrapper |
| | | .lambda().orderByAsc(Role::getSort)); |
| | | /* |
| | | List<Role> list = this.roleService.list(!bladeUser.getTenantId().equals("000000") ? (Wrapper) ((LambdaQueryWrapper) queryWrapper.lambda().eq((v0) -> { |
| | | return v0.getTenantId(); |
| | | }, bladeUser.getTenantId())).orderByAsc((v0) -> { |
| | | return v0.getSort(); |
| | | }) : (Wrapper) queryWrapper.lambda().orderByAsc((v0) -> { |
| | | return v0.getSort(); |
| | | })); |
| | | }));*/ |
| | | return R.data(RoleWrapper.build().listNodeVO(list)); |
| | | } |
| | | |
| | |
| | | @PreAuth |
| | | public R remove(@RequestParam @ApiParam(value = "主键集合", required = true) String ids) { |
| | | CacheUtil.clear("blade:sys", ExtCacheConstant.TENANT_MODE); |
| | | |
| | | this.roleService.remove(Wrappers.<Role>lambdaQuery().in(Role::getParentId, Func.toLongList(ids))); |
| | | /* |
| | | this.roleService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getParentId(); |
| | | }, Func.toLongList(ids))); |
| | | }, Func.toLongList(ids)));*/ |
| | | return R.status(this.roleService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | |
| | | @GetResource({"/select"}) |
| | | @ApiOperation(value = "下拉数据源", notes = "传入id集合") |
| | | public R<List<Role>> select(String roleId) { |
| | | List<Role> list = this.roleService.list(Wrappers.<Role>lambdaQuery().in(Role::getId, Func.toLongList(roleId)).orderByAsc(Role::getSort)); |
| | | /* |
| | | List<Role> list = this.roleService.list((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getId(); |
| | | }, Func.toLongList(roleId))).orderByAsc((v0) -> { |
| | | return v0.getSort(); |
| | | })); |
| | | }));*/ |
| | | return R.data(list); |
| | | } |
| | | } |