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));
|
}
|
}
|