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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
package com.qianwen.smartman.modules.system.controller;
 
import com.baomidou.mybatisplus.core.conditions.Wrapper;
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 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.CommonConstant;
import com.qianwen.core.boot.ctrl.BladeController;
import com.qianwen.core.mp.support.Condition;
import com.qianwen.core.mp.support.Query;
import com.qianwen.core.scanner.modular.annotation.DeleteResource;
import com.qianwen.core.scanner.modular.annotation.GetResource;
import com.qianwen.core.scanner.modular.annotation.PostResource;
import com.qianwen.core.scanner.modular.annotation.PutResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.secure.annotation.PreAuth;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.modules.system.convert.CustomTemplateFieldConvert;
import com.qianwen.smartman.modules.system.entity.CustomTemplateField;
import com.qianwen.smartman.modules.system.service.ICustomTemplateFieldService;
import com.qianwen.smartman.modules.system.vo.CustomFieldRelationListVO;
import com.qianwen.smartman.modules.system.vo.CustomFieldRelationSelectVO;
import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldColumnVO;
import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldSubmitVO;
import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldUpdateVO;
import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@Api(value = "自定义字段表管理", tags = {"自定义字段表管理"})
@ApiResource({"blade-system/custom-template-field"})
@RestController
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/controller/CustomTemplateFieldController.class */
public class CustomTemplateFieldController extends BladeController {
    private final ICustomTemplateFieldService customTemplateFieldService;
 
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -1021252424:
                if (implMethodName.equals("getViewShow")) {
                    z = true;
                    break;
                }
                break;
            case -593710244:
                if (implMethodName.equals("getUpdateShow")) {
                    z = false;
                    break;
                }
                break;
            case -111752440:
                if (implMethodName.equals("getAddShow")) {
                    z = true;
                    break;
                }
                break;
            case 98245393:
                if (implMethodName.equals("getId")) {
                    z = true;
                    break;
                }
                break;
            case 953775504:
                if (implMethodName.equals("getBusinessType")) {
                    z = true;
                    break;
                }
                break;
            case 1071464927:
                if (implMethodName.equals("getCreateTime")) {
                    z = true;
                    break;
                }
                break;
            case 2096138965:
                if (implMethodName.equals("getSystemField")) {
                    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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getUpdateShow();
                    };
                }
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/util/Date;")) {
                    return (v0) -> {
                        return v0.getCreateTime();
                    };
                }
                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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSystemField();
                    };
                }
                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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSystemField();
                    };
                }
                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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getViewShow();
                    };
                }
                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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getBusinessType();
                    };
                }
                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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getBusinessType();
                    };
                }
                break;
            case RegionCache.VILLAGE_LEVEL /* 5 */:
                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/mp/base/BaseEntity") && 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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getAddShow();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
 
    public CustomTemplateFieldController(final ICustomTemplateFieldService customTemplateFieldService) {
        this.customTemplateFieldService = customTemplateFieldService;
    }
 
    @ApiOperationSupport(order = 1)
    @GetResource({"/get/{id}"})
    @ApiOperation(value = "自定义字段表详情", notes = "传入customTemplateField")
    @PreAuth
    public R<CustomTemplateFieldVO> detail(@PathVariable Long id) {
        CustomTemplateField customTemplateField = this.customTemplateFieldService.findFieldById(id);
        return R.data(CustomTemplateFieldConvert.INSTANCE.convert(customTemplateField));
    }
 
    @ApiOperationSupport(order = 2)
    @GetResource({"/list"})
    @ApiOperation(value = "自定义字段表列表", notes = "传入业务类型")
    @PreAuth
    public R<List<CustomTemplateFieldVO>> list(@RequestParam @ApiParam("业务类型") Integer businessType) {
        List<CustomTemplateField> list = this.customTemplateFieldService.list((Wrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> {
            return v0.getBusinessType();
        }, businessType)).and(i -> {
            LambdaQueryWrapper lambdaQueryWrapper = (LambdaQueryWrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) i.ne((v0) -> {
                return v0.getAddShow();
            }, CommonConstant.DISABLE)).or()).ne((v0) -> {
                return v0.getUpdateShow();
            }, CommonConstant.DISABLE)).or()).ne((v0) -> {
                return v0.getViewShow();
            }, CommonConstant.DISABLE);
        })).orderByDesc((v0) -> {
            return v0.getSystemField();
        })).orderByDesc((v0) -> {
            return v0.getId();
        }));
        return R.data(CustomTemplateFieldConvert.INSTANCE.convert(list));
    }
 
    @ApiOperationSupport(order = 2)
    @GetResource({"/listField"})
    @ApiOperation(value = "已配置自定义字段表列表", notes = "传入map")
    public R<CustomFieldRelationListVO> listField(@RequestParam @ApiParam("模板id") Long templateId, @RequestParam @ApiParam("配置类型") Integer configType) {
        CustomFieldRelationListVO result = this.customTemplateFieldService.listField(templateId, configType);
        return R.data(result);
    }
 
    @ApiOperationSupport(order = 3)
    @GetResource({"/page"})
    @ApiOperation(value = "自定义字段表分页", notes = "传入map")
    public R<IPage<CustomTemplateFieldVO>> page(@RequestParam @ApiParam("业务类型") Integer businessType, Query query) {
        IPage<CustomTemplateField> pages = this.customTemplateFieldService.page(Condition.getPage(query), (Wrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> {
            return v0.getBusinessType();
        }, businessType)).orderByDesc((v0) -> {
            return v0.getSystemField();
        })).orderByDesc((v0) -> {
            return v0.getCreateTime();
        }));
        return R.data(CustomTemplateFieldConvert.INSTANCE.convert(pages));
    }
 
    @ApiOperationSupport(order = 4)
    @PostResource({"/insert"})
    @ApiOperation(value = "自定义字段表新增", notes = "传入customTemplateFieldVO")
    @PreAuth
    public R<CustomTemplateFieldVO> insert(@Valid @RequestBody CustomTemplateFieldSubmitVO customTemplateFieldSubmitVO) {
        CustomTemplateField customTemplateField = this.customTemplateFieldService.saveField(customTemplateFieldSubmitVO);
        return R.data(CustomTemplateFieldConvert.INSTANCE.convert(customTemplateField));
    }
 
    @ApiOperationSupport(order = RegionCache.VILLAGE_LEVEL)
    @PutResource({"/update"})
    @ApiOperation(value = "自定义字段表修改", notes = "传入customTemplateFieldVO")
    @PreAuth
    public R<CustomTemplateFieldVO> update(@Valid @RequestBody CustomTemplateFieldUpdateVO customTemplateFieldUpdateVO) {
        CustomTemplateField customTemplateField = this.customTemplateFieldService.updateField(customTemplateFieldUpdateVO);
        return R.data(CustomTemplateFieldConvert.INSTANCE.convert(customTemplateField));
    }
 
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "自定义字段表删除", notes = "传入ids")
    @PreAuth
    @DeleteResource({"/remove"})
    public R remove(@ApiParam(value = "主键", required = true) @RequestBody List<Long> ids) {
        if (ids.isEmpty()) {
            return R.status(false);
        }
        return this.customTemplateFieldService.removeFields(ids);
    }
 
    @ApiOperationSupport(order = 7)
    @GetResource({"/getSelectBox"})
    @ApiOperation(value = "自定义字段选择-用于添加字段", notes = "传入map")
    public R<CustomFieldRelationSelectVO> getSelectBox(@RequestParam @ApiParam("模板id") Long templateId, @RequestParam @ApiParam("配置类型") Integer configType) {
        CustomFieldRelationSelectVO list = this.customTemplateFieldService.getSelectBox(templateId, configType);
        return R.data(list);
    }
 
    @ApiOperationSupport(order = 8)
    @GetResource({"/fields"})
    @ApiOperation(value = "根据模版id获取该模版下字段详情 -- 关联业务CRUD时使用", notes = "传入map")
    public R<List<CustomTemplateFieldColumnVO>> getColumns(@RequestParam(value = "templateId", required = false) Long templateId, @RequestParam(value = "configType", required = false) Integer configType) {
        return R.data(this.customTemplateFieldService.getColumns(templateId, configType));
    }
}