yangys
2024-03-31 53c8d3e3bd3596132b362f20e52aef380d493a84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package com.qianwen.smartman.modules.system.controller;
 
import com.baomidou.mybatisplus.core.conditions.Wrapper;
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 java.lang.invoke.SerializedLambda;
import java.util.List;
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 org.springframework.web.bind.annotation.RestController;
 
@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;
 
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -1460243263:
                if (implMethodName.equals("getPostName")) {
                    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/modules/system/entity/Post") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getPostName();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
 
    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) {
        Wrapper lambda = Wrappers.query().lambda();
        if (Func.isNotBlank(postName)) {
            lambda.like((v0) -> {
                return v0.getPostName();
            }, postName);
        }
        IPage<Post> pages = this.postService.page(Condition.getPage(query), lambda);
        return R.data(PostWrapper.build().pageVO(pages));
    }
}