| | |
| | | package com.qianwen.smartman.modules.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import java.util.List; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | 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.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.List; |
| | | import javax.validation.Valid; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | 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.mp.support.Condition; |
| | |
| | | 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.constant.ExtCacheConstant; |
| | | import com.qianwen.smartman.modules.system.entity.ApiScope; |
| | | import com.qianwen.smartman.modules.system.mapper.ResourceDefinitionMapper; |
| | | import com.qianwen.smartman.modules.system.service.IApiScopeService; |
| | | import com.qianwen.smartman.modules.system.vo.ApiScopeVO; |
| | | import com.qianwen.smartman.modules.system.wrapper.ApiScopeWrapper; |
| | | 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.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | |
| | | @Api(value = "接口权限", tags = {"接口权限"}) |
| | | @RestController |
| | |
| | | private final IApiScopeService apiScopeService; |
| | | private final ResourceDefinitionMapper resourceDefinitionMapper; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = false; |
| | | 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/core/scanner/modular/model/ResourceDefinition") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public ApiScopeController(final IApiScopeService apiScopeService, final ResourceDefinitionMapper resourceDefinitionMapper) { |
| | | this.apiScopeService = apiScopeService; |
| | |
| | | @ApiOperation(value = "分页", notes = "传入dataScope") |
| | | @PreAuth |
| | | public R<IPage<ApiScopeVO>> list(ApiScope dataScope, Query query) { |
| | | IPage<ApiScope> pages = this.apiScopeService.page(Condition.getPage(query), Condition.getQueryWrapper(dataScope)); |
| | | IPage<ApiScope> pages = this.apiScopeService.page(Condition.getPage(query), Condition.getQueryWrapper(dataScope)); |
| | | /* |
| | | IPage<ApiScope> pages = this.apiScopeService.page(Condition.getPage(query), Condition.getQueryWrapper(dataScope));*/ |
| | | IPage<ApiScopeVO> data = ApiScopeWrapper.build().pageVO(pages); |
| | | data.getRecords().forEach(apiScopeVO -> { |
| | | ResourceDefinition resourceDefinition = this.resourceDefinitionMapper.selectOne(Wrappers.<ResourceDefinition>lambdaQuery() |
| | | .eq(ResourceDefinition::getCode, apiScopeVO.getResourceCode())); |
| | | /* |
| | | ResourceDefinition resourceDefinition = (ResourceDefinition) this.resourceDefinitionMapper.selectOne((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, apiScopeVO.getResourceCode())); |
| | | }, apiScopeVO.getResourceCode()));*/ |
| | | if (Func.isNotEmpty(resourceDefinition)) { |
| | | apiScopeVO.setControllerCode(resourceDefinition.getControllerCode()); |
| | | apiScopeVO.setModuleCode(resourceDefinition.getModuleCode()); |