自定义过滤使用
This commit is contained in:
parent
beb6b074f7
commit
d20b2bdf99
@ -6,13 +6,16 @@ import com.example.demo.common.wrapper.Wrapper;
|
||||
import com.example.demo.common.exception.BusinessException;
|
||||
import com.example.demo.parser.model.dto.MapperRuleDTO;
|
||||
import com.example.demo.parser.model.dto.MapperRuleQueryDTO;
|
||||
import com.example.demo.parser.model.vo.MapperRuleNoWithNullVO;
|
||||
import com.example.demo.parser.model.vo.MapperRuleVO;
|
||||
import com.example.demo.parser.model.vo.ParseRuleNoWithNullVO;
|
||||
import com.example.demo.parser.service.MapperRuleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@ -46,7 +49,9 @@ public class MapperRuleController {
|
||||
@RequestBody MapperRuleDTO rule) {
|
||||
try {
|
||||
MapperRuleVO result = mapperRuleService.create(rule);
|
||||
return WrapMapper.ok(result, "映射规则创建成功");
|
||||
MapperRuleNoWithNullVO vo = new MapperRuleNoWithNullVO();
|
||||
BeanUtils.copyProperties(result, vo);
|
||||
return WrapMapper.ok(vo, "映射规则创建成功");
|
||||
} catch (BusinessException e) {
|
||||
log.error("映射规则创建失败: {}", e.getMessage(), e);
|
||||
return WrapMapper.fail(e.getMessage());
|
||||
|
@ -6,6 +6,7 @@ import com.example.demo.common.wrapper.Wrapper;
|
||||
import com.example.demo.common.exception.BusinessException;
|
||||
import com.example.demo.parser.model.dto.ParseRuleDTO;
|
||||
import com.example.demo.parser.model.dto.ParseRuleQueryDTO;
|
||||
import com.example.demo.parser.model.vo.ParseRuleNoWithNullVO;
|
||||
import com.example.demo.parser.model.vo.ParseRuleVO;
|
||||
import com.example.demo.parser.service.ParseRuleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -13,6 +14,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@ -41,12 +43,14 @@ public class ParseRuleController {
|
||||
*/
|
||||
@PostMapping
|
||||
@Operation(summary = "创建解析规则", description = "创建新的解析规则")
|
||||
public Wrapper<ParseRuleVO> createRule(
|
||||
public Wrapper<ParseRuleNoWithNullVO> createRule(
|
||||
@Parameter(description = "解析规则数据", required = true)
|
||||
@RequestBody ParseRuleDTO rule) {
|
||||
try {
|
||||
ParseRuleVO result = parseRuleService.create(rule);
|
||||
return WrapMapper.ok(result, "解析规则创建成功");
|
||||
ParseRuleNoWithNullVO vo = new ParseRuleNoWithNullVO();
|
||||
BeanUtils.copyProperties(result, vo);
|
||||
return WrapMapper.ok(vo, "解析规则创建成功");
|
||||
} catch (BusinessException e) {
|
||||
log.error("解析规则创建失败: {}", e.getMessage(), e);
|
||||
return WrapMapper.fail(e.getMessage());
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.example.demo.parser.model.vo;
|
||||
|
||||
import cn.zhxu.bs.bean.SearchBean;
|
||||
import com.example.demo.common.filter.CustomJsonFilter;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 文件记录视图对象
|
||||
* 用于向前端返回文件记录数据
|
||||
*
|
||||
* @author 岳佳君 (2025年09月23日 16:21:17)
|
||||
* @version 1.0.0
|
||||
*/
|
||||
@Schema(description = "文件记录视图对象")
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
@Accessors(chain=true)
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SearchBean(
|
||||
tables = "file_record a",
|
||||
autoMapTo = "a"
|
||||
)
|
||||
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = CustomJsonFilter.class)
|
||||
public class FileRecordNoWithNullVO extends FileRecordVO {
|
||||
// ignore
|
||||
}
|
@ -30,7 +30,7 @@ import java.util.Date;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SearchBean(
|
||||
tables = "file_record",
|
||||
tables = "file_record a",
|
||||
autoMapTo = "a"
|
||||
)
|
||||
public class FileRecordVO extends BaseVO implements TransPojo, Serializable {
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.example.demo.parser.model.vo;
|
||||
|
||||
import cn.zhxu.bs.bean.SearchBean;
|
||||
import com.example.demo.common.filter.CustomJsonFilter;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 映射规则视图对象
|
||||
* 用于向前端返回映射规则数据
|
||||
*
|
||||
* @author 岳佳君 (2025年09月26日 21:44:29)
|
||||
* @version 1.0.0
|
||||
*/
|
||||
@Schema(description = "映射规则视图对象")
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
@Accessors(chain=true)
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SearchBean(
|
||||
tables = "mapper_rule a",
|
||||
autoMapTo = "a"
|
||||
)
|
||||
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = CustomJsonFilter.class)
|
||||
public class MapperRuleNoWithNullVO extends MapperRuleVO {
|
||||
// ignore
|
||||
}
|
@ -27,7 +27,7 @@ import java.io.Serializable;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SearchBean(
|
||||
tables = "mapper_rule",
|
||||
tables = "mapper_rule a",
|
||||
autoMapTo = "a"
|
||||
)
|
||||
public class MapperRuleVO extends BaseVO implements TransPojo, Serializable {
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.example.demo.parser.model.vo;
|
||||
|
||||
import cn.zhxu.bs.bean.SearchBean;
|
||||
import com.example.demo.common.filter.CustomJsonFilter;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 解析规则视图对象
|
||||
* 用于向前端返回解析规则数据
|
||||
*
|
||||
* @author 岳佳君 (2025年09月26日 14:30:51)
|
||||
* @version 1.0.0
|
||||
*/
|
||||
@Schema(description = "解析规则视图对象")
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
@Accessors(chain=true)
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SearchBean(
|
||||
tables = "parse_rule a",
|
||||
autoMapTo = "a"
|
||||
)
|
||||
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = CustomJsonFilter.class)
|
||||
public class ParseRuleNoWithNullVO extends ParseRuleVO {
|
||||
// ignore
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user