package com.qianwen.smartman.modules.system.controller;
|
|
import java.util.List;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
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.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.Post;
|
import com.qianwen.smartman.modules.system.service.IDataScopeManagerService;
|
import com.qianwen.smartman.modules.system.service.IPostService;
|
import com.qianwen.smartman.modules.system.service.IRoleService;
|
import com.qianwen.smartman.modules.system.vo.DeptVO;
|
import com.qianwen.smartman.modules.system.vo.PostVO;
|
import com.qianwen.smartman.modules.system.vo.RoleVO;
|
import com.qianwen.smartman.modules.system.wrapper.PostWrapper;
|
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
|
@Api(value = "查询", tags = {"查询"})
|
@RestController
|
@ApiResource({"blade-system/search"})
|
@NonDS
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/controller/SearchController.class */
|
public class SearchController {
|
private final IRoleService roleService;
|
private final IDataScopeManagerService deptService;
|
private final IPostService postService;
|
|
public SearchController(final IRoleService roleService, final IDataScopeManagerService deptService, final IPostService postService) {
|
this.roleService = roleService;
|
this.deptService = deptService;
|
this.postService = postService;
|
}
|
|
@ApiOperationSupport(order = 1)
|
@GetResource({"/role"})
|
@ApiOperation(value = "角色信息查询", notes = "传入roleName或者parentId")
|
public R<List<RoleVO>> roleSearch(String roleName, Long parentId) {
|
return R.data(this.roleService.search(roleName, parentId));
|
}
|
|
@ApiOperationSupport(order = 2)
|
@GetResource({"/dept"})
|
@ApiOperation(value = "部门信息查询", notes = "传入deptName或者parentId")
|
public R<List<DeptVO>> deptSearch(String deptName, Long parentId) {
|
return R.data(this.deptService.search(deptName, parentId));
|
}
|
|
@ApiOperationSupport(order = 3)
|
@GetResource({"/post"})
|
@ApiOperation(value = "岗位信息查询", notes = "传入postName")
|
public R<IPage<PostVO>> postSearch(String postName, Query query) {
|
|
LambdaQueryWrapper<Post> queryWrapper = Wrappers.<Post>query().lambda();
|
if (Func.isNotBlank(postName)) {
|
queryWrapper.like((v0) -> {
|
return v0.getPostName();
|
}, postName);
|
}
|
IPage<Post> pages = this.postService.page(Condition.getPage(query), queryWrapper);
|
return R.data(PostWrapper.build().pageVO(pages));
|
}
|
}
|