package com.qianwen.smartman.modules.system.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; 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.mp.support.Query; import com.qianwen.core.scanner.modular.annotation.GetResource; import com.qianwen.core.scanner.modular.annotation.PostResource; import com.qianwen.core.scanner.modular.stereotype.ApiResource; 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.modules.system.entity.DataScope; import com.qianwen.smartman.modules.system.service.IDataScopeService; import com.qianwen.smartman.modules.system.vo.DataScopeVO; import com.qianwen.smartman.modules.system.wrapper.DataScopeWrapper; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @Api(value = "数据权限", tags = {"数据权限"}) @RestController @ApiResource({"blade-system/data-scope"}) @NonDS /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/controller/DataScopeController.class */ public class DataScopeController extends BladeController { private final IDataScopeService dataScopeService; public DataScopeController(final IDataScopeService dataScopeService) { this.dataScopeService = dataScopeService; } @ApiOperationSupport(order = 1) @GetResource({"/detail"}) @ApiOperation(value = "详情", notes = "传入dataScope") public R detail(DataScope dataScope) { DataScope detail = (DataScope) this.dataScopeService.getOne(Condition.getQueryWrapper(dataScope)); return R.data(detail); } @ApiOperationSupport(order = 2) @GetResource({"/list"}) @ApiOperation(value = "分页", notes = "传入dataScope") public R> list(DataScope dataScope, Query query) { IPage pages = this.dataScopeService.page(Condition.getPage(query), Condition.getQueryWrapper(dataScope)); return R.data(DataScopeWrapper.build().pageVO(pages)); } @ApiOperationSupport(order = 3) @PostResource({"/save"}) @ApiOperation(value = "新增", notes = "传入dataScope") public R save(@Valid @RequestBody DataScope dataScope) { CacheUtil.clear("blade:sys", ExtCacheConstant.TENANT_MODE); return R.status(this.dataScopeService.save(dataScope)); } @ApiOperationSupport(order = 4) @PostResource({"/update"}) @ApiOperation(value = "修改", notes = "传入dataScope") public R update(@Valid @RequestBody DataScope dataScope) { CacheUtil.clear("blade:sys", ExtCacheConstant.TENANT_MODE); return R.status(this.dataScopeService.updateById(dataScope)); } @ApiOperationSupport(order = RegionCache.VILLAGE_LEVEL) @PostResource({"/submit"}) @ApiOperation(value = "新增或修改", notes = "传入dataScope") public R submit(@Valid @RequestBody DataScope dataScope) { CacheUtil.clear("blade:sys", ExtCacheConstant.TENANT_MODE); return R.status(this.dataScopeService.saveOrUpdate(dataScope)); } @ApiOperationSupport(order = 6) @PostResource({"/remove"}) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@RequestParam @ApiParam(value = "主键集合", required = true) String ids) { CacheUtil.clear("blade:sys", ExtCacheConstant.TENANT_MODE); return R.status(this.dataScopeService.deleteLogic(Func.toLongList(ids))); } }