中台添加稽查规则相关功能

This commit is contained in:
baggio19852005 2025-10-09 17:42:41 +08:00
parent 9fc8da40ce
commit 914bcec797
21 changed files with 2005 additions and 0 deletions

View File

@ -47,6 +47,13 @@ public abstract class BaseEntity implements Serializable, TransPojo {
*/
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR)
private String updater;
private Long creatorId;
private String createBy;
private Long updatorId;
private String updateBy;
/**
* 是否删除
*/

View File

@ -0,0 +1,114 @@
package cn.iocoder.yudao.module.mdpf.controller.rule;
import cn.hutool.core.date.DateUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRuleRespVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRuleSaveReqVO;
import cn.iocoder.yudao.module.mdpf.core.page.PageParam;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttAuditRuleDO;
import cn.iocoder.yudao.module.mdpf.service.rule.IAttAuditRuleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
/**
* 稽查规则Controller
*
* @author qdata
* @date 2025-01-20
*/
@Tag(name = "稽查规则")
@RestController
@RequestMapping("/att/attAuditRule")
@Validated
public class AttAuditRuleController {
@Resource
private IAttAuditRuleService attAuditRuleService;
@Operation(summary = "查询稽查规则列表")
@PreAuthorize("@ss.hasPermi('att:rule:auditrule:list')")
@GetMapping("/list")
public CommonResult<PageResult<AttAuditRuleRespVO>> list(AttAuditRulePageReqVO attAuditRule) {
PageResult<AttAuditRuleDO> page = attAuditRuleService.getAttAuditRulePage(attAuditRule);
return CommonResult.success(BeanUtils.toBean(page, AttAuditRuleRespVO.class));
}
// @Operation(summary = "导出稽查规则列表")
// @PreAuthorize("@ss.hasPermi('att:rule:auditrule:export')")
// @PostMapping("/export")
// public void export(HttpServletResponse response, AttAuditRulePageReqVO exportReqVO) {
// exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
// List<AttAuditRuleDO> list = (List<AttAuditRuleDO>) attAuditRuleService.getAttAuditRulePage(exportReqVO)
// .getList();
// ExcelUtil<AttAuditRuleRespVO> util = new ExcelUtil<>(AttAuditRuleRespVO.class);
// util.exportExcel(response, AttAuditRuleConvert.INSTANCE.convertToRespVOList(list), "应用管理数据");
// }
//
// @Operation(summary = "导入稽查规则列表")
// @PreAuthorize("@ss.hasPermi('att:rule:auditrule:import')")
// @Log(title = "稽查规则", businessType = BusinessType.IMPORT)
// @PostMapping("/importData")
// public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
// ExcelUtil<AttAuditRuleRespVO> util = new ExcelUtil<>(AttAuditRuleRespVO.class);
// List<AttAuditRuleRespVO> importExcelList = util.importExcel(file.getInputStream());
// String operName = getUsername();
// String message = attAuditRuleService.importAttAuditRule(importExcelList, updateSupport, operName);
// return success(message);
// }
@Operation(summary = "获取稽查规则详细信息")
@PreAuthorize("@ss.hasPermi('att:rule:auditrule:query')")
@GetMapping(value = "/{ID}")
public CommonResult<AttAuditRuleRespVO> getInfo(@PathVariable("ID") Long ID) {
AttAuditRuleDO attAuditRuleDO = attAuditRuleService.getAttAuditRuleById(ID);
return CommonResult.success(BeanUtils.toBean(attAuditRuleDO, AttAuditRuleRespVO.class));
}
@Operation(summary = "新增稽查规则")
@PreAuthorize("@ss.hasPermi('att:rule:auditrule:add')")
@PostMapping
public CommonResult<Long> add(@Valid @RequestBody AttAuditRuleSaveReqVO attAuditRule) {
// attAuditRule.setCreatorId(getUserId());
// attAuditRule.setCreateBy(getNickName());
attAuditRule.setCreateTime(LocalDateTime.now());
return CommonResult.success(attAuditRuleService.createAttAuditRule(attAuditRule));
}
@Operation(summary = "修改稽查规则")
@PreAuthorize("@ss.hasPermi('att:rule:auditrule:edit')")
@PutMapping
public CommonResult<Integer> edit(@Valid @RequestBody AttAuditRuleSaveReqVO attAuditRule) {
// attAuditRule.setUpdatorId(getUserId());
// attAuditRule.setUpdateBy(getNickName());
attAuditRule.setUpdateTime(LocalDateTime.now());
return CommonResult.success(attAuditRuleService.updateAttAuditRule(attAuditRule));
}
@Operation(summary = "删除稽查规则")
@PreAuthorize("@ss.hasPermi('att:rule:auditrule:remove')")
@DeleteMapping("/{ids}")
public CommonResult<Integer> remove(@PathVariable Long[] ids) {
return CommonResult.success(attAuditRuleService.removeAttAuditRule(Arrays.asList(ids)));
}
@Operation(summary = "获取稽查规则树形结构")
@GetMapping("/tree")
public CommonResult<List<AttAuditRuleRespVO>> tree(@RequestParam Long dataElemId) {
List<AttAuditRuleRespVO> tree = attAuditRuleService.getAttAuditRuleTree(dataElemId);
return CommonResult.success(tree);
}
}

View File

@ -0,0 +1,128 @@
package cn.iocoder.yudao.module.mdpf.controller.rule;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRuleRespVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRuleSaveReqVO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttCleanRuleDO;
import cn.iocoder.yudao.module.mdpf.service.rule.IAttCleanRuleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
/**
* 清洗规则Controller
*
* @author qdata
* @date 2025-01-20
*/
@Tag(name = "清洗规则")
@RestController
@RequestMapping("/att/attCleanRule")
@Validated
public class AttCleanRuleController {
@Resource
private IAttCleanRuleService attCleanRuleService;
@Operation(summary = "查询清洗规则列表")
@PreAuthorize("@ss.hasPermi('att:rule:attcleanrule:list')")
@GetMapping("/list")
public CommonResult<PageResult<AttCleanRuleRespVO>> list(AttCleanRulePageReqVO attCleanRule) {
PageResult<AttCleanRuleDO> page = attCleanRuleService.getAttCleanRulePage(attCleanRule);
return CommonResult.success(BeanUtils.toBean(page, AttCleanRuleRespVO.class));
}
@Operation(summary = "查询清洗规则列表")
@GetMapping("/listAll")
public CommonResult<List<AttCleanRuleRespVO>> listAll(AttCleanRulePageReqVO attCleanRule) {
List<AttCleanRuleRespVO> page = attCleanRuleService.getAttCleanRuleList(attCleanRule);
return CommonResult.success(page);
}
// @Operation(summary = "导出清洗规则列表")
// @PreAuthorize("@ss.hasPermi('att:rule:attcleanrule:export')")
// @Log(title = "清洗规则", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, AttCleanRulePageReqVO exportReqVO) {
// exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
// List<AttCleanRuleDO> list = (List<AttCleanRuleDO>) attCleanRuleService.getAttCleanRulePage(exportReqVO)
// .getRows();
// ExcelUtil<AttCleanRuleRespVO> util = new ExcelUtil<>(AttCleanRuleRespVO.class);
// util.exportExcel(response, AttCleanRuleConvert.INSTANCE.convertToRespVOList(list), "应用管理数据");
// }
//
// @Operation(summary = "导入清洗规则列表")
// @PreAuthorize("@ss.hasPermi('att:rule:attcleanrule:import')")
// @Log(title = "清洗规则", businessType = BusinessType.IMPORT)
// @PostMapping("/importData")
// public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
// ExcelUtil<AttCleanRuleRespVO> util = new ExcelUtil<>(AttCleanRuleRespVO.class);
// List<AttCleanRuleRespVO> importExcelList = util.importExcel(file.getInputStream());
// String operName = getUsername();
// String message = attCleanRuleService.importAttCleanRule(importExcelList, updateSupport, operName);
// return success(message);
// }
@Operation(summary = "获取清洗规则详细信息")
@PreAuthorize("@ss.hasPermi('att:rule:attcleanrule:query')")
@GetMapping(value = "/{ID}")
public CommonResult<AttCleanRuleRespVO> getInfo(@PathVariable("ID") Long ID) {
AttCleanRuleDO attCleanRuleDO = attCleanRuleService.getAttCleanRuleById(ID);
return CommonResult.success(BeanUtils.toBean(attCleanRuleDO, AttCleanRuleRespVO.class));
}
@Operation(summary = "新增清洗规则")
@PreAuthorize("@ss.hasPermi('att:rule:attcleanrule:add')")
@PostMapping
public CommonResult<Long> add(@Valid @RequestBody AttCleanRuleSaveReqVO attCleanRule) {
// attCleanRule.setCreatorId(getUserId());
// attCleanRule.setCreateBy(getNickName());
attCleanRule.setCreateTime(LocalDateTime.now());
return CommonResult.success(attCleanRuleService.createAttCleanRule(attCleanRule));
}
@Operation(summary = "修改清洗规则")
@PreAuthorize("@ss.hasPermi('att:rule:attcleanrule:edit')")
@PutMapping
public CommonResult<Integer> edit(@Valid @RequestBody AttCleanRuleSaveReqVO attCleanRule) {
// attCleanRule.setUpdatorId(getUserId());
// attCleanRule.setUpdateBy(getNickName());
attCleanRule.setUpdateTime(LocalDateTime.now());
return CommonResult.success(attCleanRuleService.updateAttCleanRule(attCleanRule));
}
@Operation(summary = "删除清洗规则")
@PreAuthorize("@ss.hasPermi('att:rule:attcleanrule:remove')")
@DeleteMapping("/{ids}")
public CommonResult<Integer> remove(@PathVariable Long[] ids) {
return CommonResult.success(attCleanRuleService.removeAttCleanRule(Arrays.asList(ids)));
}
@Operation(summary = "获取清洗规则树形结构")
@GetMapping("/tree")
public CommonResult<List<AttCleanRuleRespVO>> tree(@RequestParam Long dataElemId) {
List<AttCleanRuleRespVO> tree = attCleanRuleService.getAttCleanRuleTree(dataElemId);
return CommonResult.success(tree);
}
@Operation(summary = "获取清洗规则树形结构")
@GetMapping("/getCleaningRuleTree")
public CommonResult<List<AttCleanRuleRespVO>> getCleaningRuleTree(@RequestParam(name = "ids", required = false) Long[] ids) {
List<AttCleanRuleRespVO> tree = attCleanRuleService.getCleaningRuleTree(ids);
return CommonResult.success(tree);
}
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.mdpf.controller.rule.vo;
import cn.iocoder.yudao.module.mdpf.core.page.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 稽查规则 Request VO 对象 ATT_AUDIT_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Schema(description = "稽查规则 Request VO")
@Data
public class AttAuditRulePageReqVO extends PageParam {
private static final long serialVersionUID = 1L;
@Schema(description = "规则名称", example = "")
private String name;
@Schema(description = "质量维度", example = "")
private String qualityDim;
@Schema(description = "规则类型", example = "")
private String type;
@Schema(description = "规则级别", example = "")
private String level;
@Schema(description = "规则编码", example = "101")
private String code;
@Schema(description = "使用场景", example = "用于身份证号非空检查")
private String useCase;
@Schema(description = "示例", example = "字段值不能为空ID=123456")
private String example;
@Schema(description = "图标地址", example = "/images/icon.png")
private String iconPath;
@Schema(description = "策略标识", example = "NOT_NULL_ID_CHECK")
private String strategyKey;
/** 是否有效 */
private String validFlag;
}

View File

@ -0,0 +1,123 @@
package cn.iocoder.yudao.module.mdpf.controller.rule.vo;
import cn.iocoder.yudao.module.mdpf.util.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 稽查规则 Response VO 对象 ATT_AUDIT_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Schema(description = "稽查规则 Response VO")
@Data
public class AttAuditRuleRespVO implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "规则ID")
@Schema(description = "规则ID", example = "")
private Long id;
@Excel(name = "规则名称")
@Schema(description = "规则名称", example = "")
private String name;
@Excel(name = "质量维度")
@Schema(description = "质量维度", example = "")
private String qualityDim;
@Excel(name = "规则类型")
@Schema(description = "规则类型", example = "")
private String type;
@Excel(name = "规则级别")
@Schema(description = "规则级别", example = "")
private String level;
@Excel(name = "规则描述")
@Schema(description = "规则描述", example = "")
private String description;
@Excel(name = "是否有效")
@Schema(description = "是否有效", example = "")
private Boolean validFlag;
@Excel(name = "删除标志")
@Schema(description = "删除标志", example = "")
private Boolean delFlag;
@Excel(name = "创建人")
@Schema(description = "创建人", example = "")
private String createBy;
@Excel(name = "创建人id")
@Schema(description = "创建人id", example = "")
private Long creatorId;
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间", example = "")
private Date createTime;
@Excel(name = "更新人")
@Schema(description = "更新人", example = "")
private String updateBy;
@Excel(name = "更新人id")
@Schema(description = "更新人id", example = "")
private Long updaterId;
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新时间", example = "")
private Date updateTime;
@Excel(name = "备注")
@Schema(description = "备注", example = "")
private String remark;
/**
* 数据元规则关联id
*/
private Long ruleRelId;
/**
* tree数据类型 1:规则类型 2:规则
*/
private String dataType;
/**
* 父级ID
*/
private Long parentId;
/**
* 规则配置
*/
private String ruleConfig;
/**
* 子节点列表
*/
private List<AttAuditRuleRespVO> children;
@Schema(description = "规则编码", example = "101")
private String code;
@Schema(description = "使用场景", example = "用于身份证号非空检查")
private String useCase;
@Schema(description = "示例", example = "字段值不能为空ID=123456")
private String example;
@Schema(description = "图标地址", example = "/images/icon.png")
private String iconPath;
@Schema(description = "策略标识", example = "NOT_NULL_ID_CHECK")
private String strategyKey;
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.mdpf.controller.rule.vo;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Size;
/**
* 稽查规则 创建/修改 Request VO ATT_AUDIT_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Schema(description = "稽查规则 Response VO")
@Data
public class AttAuditRuleSaveReqVO extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "ID")
private Long id;
@Schema(description = "规则名称", example = "")
@Size(max = 256, message = "规则名称长度不能超过256个字符")
private String name;
@Schema(description = "质量维度", example = "")
@Size(max = 256, message = "质量维度长度不能超过256个字符")
private String qualityDim;
@Schema(description = "规则类型", example = "")
@Size(max = 256, message = "规则类型长度不能超过256个字符")
private String type;
@Schema(description = "规则级别", example = "")
@Size(max = 256, message = "规则级别长度不能超过256个字符")
private String level;
@Schema(description = "规则描述", example = "")
@Size(max = 256, message = "规则描述长度不能超过256个字符")
private String description;
@Schema(description = "备注", example = "")
@Size(max = 256, message = "备注长度不能超过256个字符")
private String remark;
@Schema(description = "规则编码", example = "101")
private String code;
@Schema(description = "使用场景", example = "用于身份证号非空检查")
private String useCase;
@Schema(description = "示例", example = "字段值不能为空ID=123456")
private String example;
@Schema(description = "图标地址", example = "/images/icon.png")
private String iconPath;
@Schema(description = "策略标识", example = "NOT_NULL_ID_CHECK")
private String strategyKey;
}

View File

@ -0,0 +1,50 @@
package cn.iocoder.yudao.module.mdpf.controller.rule.vo;
import cn.iocoder.yudao.module.mdpf.core.page.PageParam;
import cn.iocoder.yudao.module.mdpf.util.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 清洗规则 Request VO 对象 ATT_CLEAN_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Schema(description = "清洗规则 Request VO")
@Data
public class AttCleanRulePageReqVO extends PageParam {
private static final long serialVersionUID = 1L;
@Schema(description = "规则名称", example = "")
private String name;
@Schema(description = "规则编码", example = "")
private String code;
@Schema(description = "规则类型", example = "")
private String type;
@Schema(description = "规则级别", example = "")
private String level;
@Schema(description = "策略标识", example = "")
private String strategyKey;
@Excel(name = "是否有效")
@Schema(description = "是否有效", example = "")
private Boolean validFlag;
/** 类目编码 */
private String catCode;
@TableField(exist = false)
private String catID;
@TableField(exist = false)
private String catName;
}

View File

@ -0,0 +1,129 @@
package cn.iocoder.yudao.module.mdpf.controller.rule.vo;
import cn.iocoder.yudao.module.mdpf.util.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 清洗规则 Response VO 对象 ATT_CLEAN_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Schema(description = "清洗规则 Response VO")
@Data
public class AttCleanRuleRespVO implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "规则ID")
@Schema(description = "规则ID", example = "")
private Long id;
@Excel(name = "规则名称")
@Schema(description = "规则名称", example = "")
private String name;
@Schema(description = "规则编码", example = "101")
private String code;
@Schema(description = "使用场景", example = "用于身份证号非空检查")
private String useCase;
@Schema(description = "示例", example = "字段值不能为空ID=123456")
private String example;
@Schema(description = "策略标识", example = "NOT_NULL_ID_CHECK")
private String strategyKey;
@Excel(name = "规则类型")
@Schema(description = "规则类型", example = "")
private String type;
private String parentName;
private String parentType;
@Excel(name = "规则级别")
@Schema(description = "规则级别", example = "")
private String level;
@Excel(name = "规则描述")
@Schema(description = "规则描述", example = "")
private String description;
@Excel(name = "是否有效")
@Schema(description = "是否有效", example = "")
private Boolean validFlag;
@Excel(name = "删除标志")
@Schema(description = "删除标志", example = "")
private Boolean delFlag;
@Excel(name = "创建人")
@Schema(description = "创建人", example = "")
private String createBy;
@Excel(name = "创建人id")
@Schema(description = "创建人id", example = "")
private Long creatorId;
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间", example = "")
private Date createTime;
@Excel(name = "更新人")
@Schema(description = "更新人", example = "")
private String updateBy;
@Excel(name = "更新人id")
@Schema(description = "更新人id", example = "")
private Long updaterId;
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新时间", example = "")
private Date updateTime;
@Excel(name = "备注")
@Schema(description = "备注", example = "")
private String remark;
/**
* 数据元规则关联id
*/
private Long ruleRelId;
/**
* tree数据类型 1:规则类型 2:规则
*/
private String dataType;
/**
* 父级ID
*/
private Long parentId;
/**
* 规则配置
*/
private String ruleConfig;
/**
* 子节点列表
*/
private List<AttCleanRuleRespVO> children;
/** 类目编码 */
private String catCode;
@TableField(exist = false)
private String catID;
@TableField(exist = false)
private String catName;
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.mdpf.controller.rule.vo;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Size;
/**
* 清洗规则 创建/修改 Request VO ATT_CLEAN_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Schema(description = "清洗规则 Response VO")
@Data
public class AttCleanRuleSaveReqVO extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "ID")
private Long id;
@Schema(description = "规则名称", example = "")
@Size(max = 256, message = "规则名称长度不能超过256个字符")
private String name;
@Schema(description = "规则类型", example = "")
@Size(max = 256, message = "规则类型长度不能超过256个字符")
private String type;
@Schema(description = "规则级别", example = "")
@Size(max = 256, message = "规则级别长度不能超过256个字符")
private String level;
@Schema(description = "规则描述", example = "")
@Size(max = 256, message = "规则描述长度不能超过256个字符")
private String description;
@Schema(description = "备注", example = "")
@Size(max = 256, message = "备注长度不能超过256个字符")
private String remark;
@Schema(description = "规则编码", example = "101")
private String code;
@Schema(description = "使用场景", example = "用于身份证号非空检查")
private String useCase;
@Schema(description = "示例", example = "字段值不能为空ID=123456")
private String example;
@Schema(description = "策略标识", example = "NOT_NULL_ID_CHECK")
private String strategyKey;
@Schema(description = "是否有效", example = "")
private Boolean validFlag;
/** 类目编码 */
private String catCode;
@TableField(exist = false)
private String catID;
@TableField(exist = false)
private String catName;
}

View File

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.mdpf.dal.dataobject.rule;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
* 稽查规则 DO 对象 ATT_AUDIT_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Data
@TableName(value = "ATT_AUDIT_RULE")
// 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
// @KeySequence("ATT_AUDIT_RULE_seq")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AttAuditRuleDO extends BaseEntity {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 规则ID */
private Long id;
/** 规则名称 */
private String name;
/** 质量维度 */
private String qualityDim;
/** 规则类型 */
private String type;
/**
* 规则级别
* 1字段级2表级
*/
private String level;
/** 规则描述 */
private String description;
/** 是否有效 */
private Boolean validFlag;
/** 删除标志 */
@TableLogic
private Boolean delFlag;
/**
* 数据元规则关联id
*/
@TableField(exist = false)
private Long ruleRelId;
/**
* 规则配置
*/
@TableField(exist = false)
private String ruleConfig;
@Schema(description = "规则编码", example = "101")
private String code;
@Schema(description = "使用场景", example = "用于身份证号非空检查")
private String useCase;
@Schema(description = "示例", example = "字段值不能为空ID=123456")
private String example;
@Schema(description = "图标地址", example = "/images/icon.png")
private String iconPath;
@Schema(description = "策略标识", example = "NOT_NULL_ID_CHECK")
private String strategyKey;
}

View File

@ -0,0 +1,85 @@
package cn.iocoder.yudao.module.mdpf.dal.dataobject.rule;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
* 清洗规则 DO 对象 ATT_CLEAN_RULE
*
* @author qdata
* @date 2025-01-20
*/
@Data
@TableName(value = "ATT_CLEAN_RULE")
// 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
// @KeySequence("ATT_CLEAN_RULE_seq")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AttCleanRuleDO extends BaseEntity {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 规则ID */
private Long id;
/** 规则名称 */
private String name;
/** 规则类型 */
private String type;
/**
* 规则级别;1字段级2表级
*/
private String level;
/** 规则描述 */
private String description;
/** 是否有效 */
private Boolean validFlag;
/** 删除标志 */
@TableLogic
private Boolean delFlag;
/**
* 数据元规则关联id
*/
@TableField(exist = false)
private Long ruleRelId;
/**
* 规则配置
*/
@TableField(exist = false)
private String ruleConfig;
@Schema(description = "规则编码", example = "101")
private String code;
@Schema(description = "使用场景", example = "用于身份证号非空检查")
private String useCase;
@Schema(description = "示例", example = "字段值不能为空ID=123456")
private String example;
@Schema(description = "策略标识", example = "NOT_NULL_ID_CHECK")
private String strategyKey;
/** 类目编码 */
private String catCode;
@TableField(exist = false)
private String catID;
@TableField(exist = false)
private String catName;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 清洗规则类型枚举
*/
@Getter
@AllArgsConstructor
public enum CleanRuleTypeEnum {
STRING_TRANSFORM("1", "字符串转化"),
NUMBER_PROCESS("2", "数值处理"),
TIME_PROCESS("3", "时间处理"),
DUPLICATE_PROCESS("4", "重复值处理"),
NULL_PROCESS("5", "空值处理");
private final String type;
private final String name;
public static String getNameByType(String type) {
for (CleanRuleTypeEnum value : CleanRuleTypeEnum.values()) {
if (value.getType().equals(type)) {
return value.getName();
}
}
return type;
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 规则类型枚举
*/
@Getter
@AllArgsConstructor
public enum RuleTypeEnum {
CHARACTER_CHECK("1", "字符校验"),
NUMBER_CHECK("2", "数值校验"),
NULL_CHECK("3", "空值校验"),
LENGTH_CHECK("4", "长度校验"),
DUPLICATE_CHECK("5", "重复检查"),
FORMAT_CHECK("6", "格式检查");
private final String type;
private final String name;
public static String getNameByType(String type) {
for (RuleTypeEnum value : RuleTypeEnum.values()) {
if (value.getType().equals(type)) {
return value.getName();
}
}
return type;
}
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.mdpf.dal.mapper.rule;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttAuditRuleDO;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 稽查规则Mapper接口
*
* @author qdata
* @date 2025-01-20
*/
@Mapper
@DS("slave")
public interface AttAuditRuleMapper extends BaseMapperX<AttAuditRuleDO> {
default PageResult<AttAuditRuleDO> selectPage(AttAuditRulePageReqVO reqVO) {
// 定义排序的字段防止 SQL 注入与数据库字段名称一致
Set<String> allowedColumns = new HashSet<>(Arrays.asList("id", "create_time", "update_time"));
LambdaQueryWrapperX<AttAuditRuleDO> queryparam = new LambdaQueryWrapperX<>();
queryparam.likeIfPresent(AttAuditRuleDO::getName, reqVO.getName())
.eqIfPresent(AttAuditRuleDO::getQualityDim, reqVO.getQualityDim())
.eqIfPresent(AttAuditRuleDO::getType, reqVO.getType())
.eqIfPresent(AttAuditRuleDO::getLevel, reqVO.getLevel())
.eqIfPresent(AttAuditRuleDO::getValidFlag, reqVO.getValidFlag())
.eqIfPresent(AttAuditRuleDO::getCode, reqVO.getCode())
.likeIfPresent(AttAuditRuleDO::getUseCase, reqVO.getUseCase())
.likeIfPresent(AttAuditRuleDO::getExample, reqVO.getExample())
// 如果 reqVO.getName() 不为空则添加 name 的精确匹配条件name = '<name>'
// .likeIfPresent(AttAuditRuleDO::getName, reqVO.getName())
// 按照 createTime 字段降序排序
// .orderBy(reqVO.getOrderByColumn(), reqVO.getIsAsc(), allowedColumns));
.orderByDesc(AttAuditRuleDO::getCreateTime);
// 构造动态查询条件
return selectPage(reqVO);
}
List<AttAuditRuleDO> selectAttAuditRuleList(@Param("dataElemId") Long dataElemId);
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.mdpf.dal.mapper.rule;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttCleanRuleDO;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 清洗规则Mapper接口
*
* @author qdata
* @date 2025-01-20
*/
@Mapper
@DS("slave")
public interface AttCleanRuleMapper extends BaseMapperX<AttCleanRuleDO> {
// default PageResult<AttCleanRuleDO> selectPage(AttCleanRulePageReqVO reqVO) {
// // 定义排序的字段防止 SQL 注入与数据库字段名称一致
// Set<String> allowedColumns = new HashSet<>(Arrays.asList("id", "create_time", "update_time"));
//
// MPJLambdaWrapper<AttCleanRuleDO> lambdaWrapper = new MPJLambdaWrapper();
// lambdaWrapper.selectAll(AttCleanRuleDO.class)
// .select("t2.NAME AS catName")
// .leftJoin("ATT_CLEAN_CAT t2 on t.CAT_CODE = t2.CODE AND t2.DEL_FLAG = '0'")
// .likeRight(StringUtils.isNotBlank(reqVO.getCatCode()), AttCleanRuleDO::getCatCode, reqVO.getCatCode())
// .like(StringUtils.isNotBlank(reqVO.getName()), AttCleanRuleDO::getName, reqVO.getName())
// .eq(StringUtils.isNotBlank(reqVO.getType()), AttCleanRuleDO::getType, reqVO.getType())
// .eq(StringUtils.isNotBlank(reqVO.getCode()), AttCleanRuleDO::getCode, reqVO.getCode())
// .eq(StringUtils.isNotBlank(reqVO.getLevel()), AttCleanRuleDO::getLevel, reqVO.getLevel())
// .orderByStr(StringUtils.isNotBlank(reqVO.getOrderByColumn()), StringUtils.equals("asc", reqVO.getIsAsc()), StringUtils.isNotBlank(reqVO.getOrderByColumn()) ? Arrays.asList(reqVO.getOrderByColumn().split(",")) : null);
//
// return selectJoinPage(reqVO, AttCleanRuleDO.class, lambdaWrapper);
// }
PageResult<AttCleanRuleDO> selectPage(AttCleanRulePageReqVO reqVO);
List<AttCleanRuleDO> selectAttCleanRuleList(@Param("dataElemId") Long dataElemId);
List<AttCleanRuleDO> getCleaningRuleTreeIds(Long[] dataElemId);
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.mdpf.service.rule;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRuleRespVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRuleSaveReqVO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttAuditRuleDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 稽查规则Service接口
*
* @author qdata
* @date 2025-01-20
*/
public interface IAttAuditRuleService extends IService<AttAuditRuleDO> {
/**
* 获得稽查规则分页列表
*
* @param pageReqVO 分页请求
* @return 稽查规则分页列表
*/
PageResult<AttAuditRuleDO> getAttAuditRulePage(AttAuditRulePageReqVO pageReqVO);
/**
* 创建稽查规则
*
* @param createReqVO 稽查规则信息
* @return 稽查规则编号
*/
Long createAttAuditRule(AttAuditRuleSaveReqVO createReqVO);
/**
* 更新稽查规则
*
* @param updateReqVO 稽查规则信息
*/
int updateAttAuditRule(AttAuditRuleSaveReqVO updateReqVO);
/**
* 删除稽查规则
*
* @param idList 稽查规则编号
*/
int removeAttAuditRule(Collection<Long> idList);
/**
* 获得稽查规则详情
*
* @param id 稽查规则编号
* @return 稽查规则
*/
AttAuditRuleDO getAttAuditRuleById(Long id);
/**
* 获得全部稽查规则列表
*
* @return 稽查规则列表
*/
List<AttAuditRuleDO> getAttAuditRuleList();
/**
* 获得全部稽查规则 Map
*
* @return 稽查规则 Map
*/
Map<Long, AttAuditRuleDO> getAttAuditRuleMap();
/**
* 导入稽查规则数据
*
* @param importExcelList 稽查规则数据列表
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @param operName 操作用户
* @return 结果
*/
String importAttAuditRule(List<AttAuditRuleRespVO> importExcelList, boolean isUpdateSupport, String operName);
/**
* 获取稽查规则树形结构
*
* @return 树形结构列表
*/
List<AttAuditRuleRespVO> getAttAuditRuleTree(Long dataElemId);
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.mdpf.service.rule;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRuleRespVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRuleSaveReqVO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttCleanRuleDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 清洗规则Service接口
*
* @author qdata
* @date 2025-01-20
*/
public interface IAttCleanRuleService extends IService<AttCleanRuleDO> {
/**
* 获得清洗规则分页列表
*
* @param pageReqVO 分页请求
* @return 清洗规则分页列表
*/
PageResult<AttCleanRuleDO> getAttCleanRulePage(AttCleanRulePageReqVO pageReqVO);
/**
* 创建清洗规则
*
* @param createReqVO 清洗规则信息
* @return 清洗规则编号
*/
Long createAttCleanRule(AttCleanRuleSaveReqVO createReqVO);
/**
* 更新清洗规则
*
* @param updateReqVO 清洗规则信息
*/
int updateAttCleanRule(AttCleanRuleSaveReqVO updateReqVO);
/**
* 删除清洗规则
*
* @param idList 清洗规则编号
*/
int removeAttCleanRule(Collection<Long> idList);
/**
* 获得清洗规则详情
*
* @param id 清洗规则编号
* @return 清洗规则
*/
AttCleanRuleDO getAttCleanRuleById(Long id);
/**
* 获得全部清洗规则列表
*
* @return 清洗规则列表
*/
List<AttCleanRuleDO> getAttCleanRuleList();
List<AttCleanRuleRespVO> getAttCleanRuleList(AttCleanRulePageReqVO attCleanRule);
/**
* 获得全部清洗规则 Map
*
* @return 清洗规则 Map
*/
Map<Long, AttCleanRuleDO> getAttCleanRuleMap();
/**
* 导入清洗规则数据
*
* @param importExcelList 清洗规则数据列表
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @param operName 操作用户
* @return 结果
*/
String importAttCleanRule(List<AttCleanRuleRespVO> importExcelList, boolean isUpdateSupport, String operName);
/**
* 获取清洗规则树形结构
*
* @return 树形结构列表
*/
List<AttCleanRuleRespVO> getAttCleanRuleTree(Long dataElemId);
List<AttCleanRuleRespVO> getCleaningRuleTree(Long[] dataElemId);
Long getCount(AttCleanRulePageReqVO vo);
}

View File

@ -0,0 +1,202 @@
package cn.iocoder.yudao.module.mdpf.service.rule.impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRuleRespVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttAuditRuleSaveReqVO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttAuditRuleDO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.enums.RuleTypeEnum;
import cn.iocoder.yudao.module.mdpf.dal.mapper.rule.AttAuditRuleMapper;
import cn.iocoder.yudao.module.mdpf.service.rule.IAttAuditRuleService;
import cn.iocoder.yudao.module.mdpf.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 稽查规则Service业务层处理
*
* @author qdata
* @date 2025-01-20
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class AttAuditRuleServiceImpl extends ServiceImpl<AttAuditRuleMapper, AttAuditRuleDO>
implements IAttAuditRuleService {
@Resource
private AttAuditRuleMapper attAuditRuleMapper;
@Override
public PageResult<AttAuditRuleDO> getAttAuditRulePage(AttAuditRulePageReqVO pageReqVO) {
return attAuditRuleMapper.selectPage(pageReqVO);
}
@Override
public Long createAttAuditRule(AttAuditRuleSaveReqVO createReqVO) {
AttAuditRuleDO dictType = BeanUtils.toBean(createReqVO, AttAuditRuleDO.class);
attAuditRuleMapper.insert(dictType);
return dictType.getId();
}
@Override
public int updateAttAuditRule(AttAuditRuleSaveReqVO updateReqVO) {
// 相关校验
// 更新稽查规则
AttAuditRuleDO updateObj = BeanUtils.toBean(updateReqVO, AttAuditRuleDO.class);
return attAuditRuleMapper.updateById(updateObj);
}
@Override
public int removeAttAuditRule(Collection<Long> idList) {
// 批量删除稽查规则
return attAuditRuleMapper.deleteBatchIds(idList);
}
@Override
public AttAuditRuleDO getAttAuditRuleById(Long id) {
return attAuditRuleMapper.selectById(id);
}
@Override
public List<AttAuditRuleDO> getAttAuditRuleList() {
return attAuditRuleMapper.selectList();
}
@Override
public Map<Long, AttAuditRuleDO> getAttAuditRuleMap() {
List<AttAuditRuleDO> attAuditRuleList = attAuditRuleMapper.selectList();
return attAuditRuleList.stream()
.collect(Collectors.toMap(
AttAuditRuleDO::getId,
attAuditRuleDO -> attAuditRuleDO,
// 保留已存在的值
(existing, replacement) -> existing));
}
@Override
public List<AttAuditRuleRespVO> getAttAuditRuleTree(Long dataElemId) {
// 1. 获取所有稽查规则列表
List<AttAuditRuleDO> list = attAuditRuleMapper.selectAttAuditRuleList(dataElemId);
// 2. 转换为VO对象
List<AttAuditRuleRespVO> voList = BeanUtils.toBean(list, AttAuditRuleRespVO.class);
// 3. 构建树形结构
return buildTreeByType(voList);
}
/**
* 构建树形结构 - 以type字段作为父节点
*
* @param list 规则列表
* @return 树形结构列表
*/
private List<AttAuditRuleRespVO> buildTreeByType(List<AttAuditRuleRespVO> list) {
List<AttAuditRuleRespVO> resultList = new ArrayList<>();
// 创建type映射用于存储相同type的节点
Map<String, List<AttAuditRuleRespVO>> typeMap = list.stream()
.collect(Collectors.groupingBy(AttAuditRuleRespVO::getType));
// 遍历每个type分组
for (Map.Entry<String, List<AttAuditRuleRespVO>> entry : typeMap.entrySet()) {
String type = entry.getKey();
List<AttAuditRuleRespVO> typeNodes = entry.getValue();
for (AttAuditRuleRespVO typeNode : typeNodes) {
typeNode.setDataType("2");
}
// 创建父节点
AttAuditRuleRespVO parentNode = new AttAuditRuleRespVO();
parentNode.setId(0L); // 设置一个特殊的ID
parentNode.setType(type);
parentNode.setDataType("1");
// 使用枚举获取类型名称
String typeName = RuleTypeEnum.getNameByType(type);
parentNode.setName(typeName); // 设置父节点名称
parentNode.setChildren(new ArrayList<>(typeNodes));
resultList.add(parentNode);
}
return resultList;
}
/**
* 导入稽查规则数据
*
* @param importExcelList 稽查规则数据列表
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @param operName 操作用户
* @return 结果
*/
@Override
public String importAttAuditRule(List<AttAuditRuleRespVO> importExcelList, boolean isUpdateSupport,
String operName) {
if (StringUtils.isNull(importExcelList) || importExcelList.size() == 0) {
throw new RuntimeException("导入数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
List<String> successMessages = new ArrayList<>();
List<String> failureMessages = new ArrayList<>();
for (AttAuditRuleRespVO respVO : importExcelList) {
try {
AttAuditRuleDO attAuditRuleDO = BeanUtils.toBean(respVO, AttAuditRuleDO.class);
Long attAuditRuleId = respVO.getId();
if (isUpdateSupport) {
if (attAuditRuleId != null) {
AttAuditRuleDO existingAttAuditRule = attAuditRuleMapper.selectById(attAuditRuleId);
if (existingAttAuditRule != null) {
attAuditRuleMapper.updateById(attAuditRuleDO);
successNum++;
successMessages.add("数据更新成功ID为 " + attAuditRuleId + " 的稽查规则记录。");
} else {
failureNum++;
failureMessages.add("数据更新失败ID为 " + attAuditRuleId + " 的稽查规则记录不存在。");
}
} else {
failureNum++;
failureMessages.add("数据更新失败某条记录的ID不存在。");
}
} else {
QueryWrapper<AttAuditRuleDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", attAuditRuleId);
AttAuditRuleDO existingAttAuditRule = attAuditRuleMapper.selectOne(queryWrapper);
if (existingAttAuditRule == null) {
attAuditRuleMapper.insert(attAuditRuleDO);
successNum++;
successMessages.add("数据插入成功ID为 " + attAuditRuleId + " 的稽查规则记录。");
} else {
failureNum++;
failureMessages.add("数据插入失败ID为 " + attAuditRuleId + " 的稽查规则记录已存在。");
}
}
} catch (Exception e) {
failureNum++;
String errorMsg = "数据导入失败,错误信息:" + e.getMessage();
failureMessages.add(errorMsg);
log.error(errorMsg, e);
}
}
StringBuilder resultMsg = new StringBuilder();
if (failureNum > 0) {
resultMsg.append("很抱歉,导入失败!共 ").append(failureNum).append(" 条数据格式不正确,错误如下:");
resultMsg.append("<br/>").append(String.join("<br/>", failureMessages));
throw new RuntimeException(resultMsg.toString());
} else {
resultMsg.append("恭喜您,数据已全部导入成功!共 ").append(successNum).append(" 条。");
}
return resultMsg.toString();
}
}

View File

@ -0,0 +1,254 @@
package cn.iocoder.yudao.module.mdpf.service.rule.impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRulePageReqVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRuleRespVO;
import cn.iocoder.yudao.module.mdpf.controller.rule.vo.AttCleanRuleSaveReqVO;
import cn.iocoder.yudao.module.mdpf.core.text.Convert;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.AttCleanRuleDO;
import cn.iocoder.yudao.module.mdpf.dal.dataobject.rule.enums.CleanRuleTypeEnum;
import cn.iocoder.yudao.module.mdpf.dal.mapper.rule.AttCleanRuleMapper;
import cn.iocoder.yudao.module.mdpf.service.rule.IAttCleanRuleService;
import cn.iocoder.yudao.module.mdpf.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 清洗规则Service业务层处理
*
* @author qdata
* @date 2025-01-20
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class AttCleanRuleServiceImpl extends ServiceImpl<AttCleanRuleMapper, AttCleanRuleDO>
implements IAttCleanRuleService {
@Resource
private AttCleanRuleMapper attCleanRuleMapper;
@Override
public PageResult<AttCleanRuleDO> getAttCleanRulePage(AttCleanRulePageReqVO pageReqVO) {
return attCleanRuleMapper.selectPage(pageReqVO);
}
@Override
public Long createAttCleanRule(AttCleanRuleSaveReqVO createReqVO) {
List<AttCleanRuleDO> code = attCleanRuleMapper.selectList("code", createReqVO.getCode());
if (code.size() > 0) {
throw new RuntimeException("规则编码重复请重新输入");
}
AttCleanRuleDO dictType = BeanUtils.toBean(createReqVO, AttCleanRuleDO.class);
attCleanRuleMapper.insert(dictType);
return dictType.getId();
}
@Override
public int updateAttCleanRule(AttCleanRuleSaveReqVO updateReqVO) {
// 相关校验
List<AttCleanRuleDO> code = attCleanRuleMapper.selectList("code", updateReqVO.getCode());
if (code.size() > 0) {
throw new RuntimeException("规则编码重复请重新输入");
}
// 更新清洗规则
AttCleanRuleDO updateObj = BeanUtils.toBean(updateReqVO, AttCleanRuleDO.class);
return attCleanRuleMapper.updateById(updateObj);
}
@Override
public int removeAttCleanRule(Collection<Long> idList) {
// 批量删除清洗规则
return attCleanRuleMapper.deleteBatchIds(idList);
}
@Override
public AttCleanRuleDO getAttCleanRuleById(Long id) {
return attCleanRuleMapper.selectById(id);
}
@Override
public List<AttCleanRuleDO> getAttCleanRuleList() {
return attCleanRuleMapper.selectList();
}
@Override
public List<AttCleanRuleRespVO> getAttCleanRuleList(AttCleanRulePageReqVO attCleanRule) {
MPJLambdaWrapper<AttCleanRuleDO> lambdaWrapper = new MPJLambdaWrapper();
lambdaWrapper.selectAll(AttCleanRuleDO.class)
.select("t2.NAME AS catName")
.leftJoin("ATT_CLEAN_CAT t2 on t.CAT_CODE = t2.CODE AND t2.DEL_FLAG = '0'")
.likeRight(org.apache.commons.lang3.StringUtils.isNotBlank(attCleanRule.getCatCode()), AttCleanRuleDO::getCatCode, attCleanRule.getCatCode());
// LambdaQueryWrapperX<AttCleanRuleDO> x = new LambdaQueryWrapperX<>();
// x.eqIfPresent(AttCleanRuleDO::getType , attCleanRule.getType());
// x.eqIfPresent(AttCleanRuleDO::getValidFlag , attCleanRule.getValidFlag());
List<AttCleanRuleDO> attCleanRuleDOS = attCleanRuleMapper.selectList(lambdaWrapper);
List<AttCleanRuleRespVO> bean = BeanUtils.toBean(attCleanRuleDOS, AttCleanRuleRespVO.class);
for (AttCleanRuleRespVO respVO : bean) {
respVO.setParentType(Convert.toStr(respVO.getCatID()));
respVO.setParentName(respVO.getCatName());
}
return bean;
}
@Override
public Map<Long, AttCleanRuleDO> getAttCleanRuleMap() {
List<AttCleanRuleDO> attCleanRuleList = attCleanRuleMapper.selectList();
return attCleanRuleList.stream()
.collect(Collectors.toMap(
AttCleanRuleDO::getId,
attCleanRuleDO -> attCleanRuleDO,
// 保留已存在的值
(existing, replacement) -> existing));
}
/**
* 导入清洗规则数据
*
* @param importExcelList 清洗规则数据列表
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @param operName 操作用户
* @return 结果
*/
@Override
public String importAttCleanRule(List<AttCleanRuleRespVO> importExcelList, boolean isUpdateSupport,
String operName) {
if (StringUtils.isNull(importExcelList) || importExcelList.size() == 0) {
throw new RuntimeException("导入数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
List<String> successMessages = new ArrayList<>();
List<String> failureMessages = new ArrayList<>();
for (AttCleanRuleRespVO respVO : importExcelList) {
try {
AttCleanRuleDO attCleanRuleDO = BeanUtils.toBean(respVO, AttCleanRuleDO.class);
Long attCleanRuleId = respVO.getId();
if (isUpdateSupport) {
if (attCleanRuleId != null) {
AttCleanRuleDO existingAttCleanRule = attCleanRuleMapper.selectById(attCleanRuleId);
if (existingAttCleanRule != null) {
attCleanRuleMapper.updateById(attCleanRuleDO);
successNum++;
successMessages.add("数据更新成功ID为 " + attCleanRuleId + " 的清洗规则记录。");
} else {
failureNum++;
failureMessages.add("数据更新失败ID为 " + attCleanRuleId + " 的清洗规则记录不存在。");
}
} else {
failureNum++;
failureMessages.add("数据更新失败某条记录的ID不存在。");
}
} else {
QueryWrapper<AttCleanRuleDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", attCleanRuleId);
AttCleanRuleDO existingAttCleanRule = attCleanRuleMapper.selectOne(queryWrapper);
if (existingAttCleanRule == null) {
attCleanRuleMapper.insert(attCleanRuleDO);
successNum++;
successMessages.add("数据插入成功ID为 " + attCleanRuleId + " 的清洗规则记录。");
} else {
failureNum++;
failureMessages.add("数据插入失败ID为 " + attCleanRuleId + " 的清洗规则记录已存在。");
}
}
} catch (Exception e) {
failureNum++;
String errorMsg = "数据导入失败,错误信息:" + e.getMessage();
failureMessages.add(errorMsg);
log.error(errorMsg, e);
}
}
StringBuilder resultMsg = new StringBuilder();
if (failureNum > 0) {
resultMsg.append("很抱歉,导入失败!共 ").append(failureNum).append(" 条数据格式不正确,错误如下:");
resultMsg.append("<br/>").append(String.join("<br/>", failureMessages));
throw new RuntimeException(resultMsg.toString());
} else {
resultMsg.append("恭喜您,数据已全部导入成功!共 ").append(successNum).append(" 条。");
}
return resultMsg.toString();
}
@Override
public List<AttCleanRuleRespVO> getAttCleanRuleTree(Long dataElemId) {
// 1. 获取所有清洗规则列表
List<AttCleanRuleDO> list = attCleanRuleMapper.selectAttCleanRuleList(dataElemId);
// 2. 转换为VO对象
List<AttCleanRuleRespVO> voList = BeanUtils.toBean(list, AttCleanRuleRespVO.class);
// 3. 构建树形结构
return buildTreeByType(voList);
}
@Override
public List<AttCleanRuleRespVO> getCleaningRuleTree(Long[] dataElemId) {
List<AttCleanRuleDO> list =null;
if (dataElemId == null || dataElemId.length == 0) {
// 数组为空或未初始化
list = attCleanRuleMapper.selectList();
}else {
list = attCleanRuleMapper.getCleaningRuleTreeIds(dataElemId);
}
// 2. 转换为VO对象
List<AttCleanRuleRespVO> voList = BeanUtils.toBean(list, AttCleanRuleRespVO.class);
// 3. 构建树形结构
return buildTreeByType(voList);
}
@Override
public Long getCount(AttCleanRulePageReqVO vo) {
return attCleanRuleMapper.selectCount(Wrappers.lambdaQuery(AttCleanRuleDO.class)
.likeRight(AttCleanRuleDO::getType, vo.getType()));
}
/**
* 构建树形结构 - 以type字段作为父节点
*
* @param list 规则列表
* @return 树形结构列表
*/
private List<AttCleanRuleRespVO> buildTreeByType(List<AttCleanRuleRespVO> list) {
List<AttCleanRuleRespVO> resultList = new ArrayList<>();
// 创建type映射用于存储相同type的节点
Map<String, List<AttCleanRuleRespVO>> typeMap = list.stream()
.collect(Collectors.groupingBy(AttCleanRuleRespVO::getType));
// 遍历每个type分组
for (Map.Entry<String, List<AttCleanRuleRespVO>> entry : typeMap.entrySet()) {
String type = entry.getKey();
List<AttCleanRuleRespVO> typeNodes = entry.getValue();
for (AttCleanRuleRespVO typeNode : typeNodes) {
typeNode.setDataType("2");
}
// 创建父节点
AttCleanRuleRespVO parentNode = new AttCleanRuleRespVO();
parentNode.setId(0L); // 设置一个特殊的ID
parentNode.setType(type);
parentNode.setDataType("1");
String typeName = CleanRuleTypeEnum.getNameByType(type);
parentNode.setName(typeName); // 设置父节点名称
parentNode.setChildren(new ArrayList<>(typeNodes));
resultList.add(parentNode);
}
return resultList;
}
}

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.mdpf.dal.mapper.rule.AttAuditRuleMapper">
<resultMap type="AttAuditRuleDO" id="AttAuditRuleResult">
<result property="id" column="ID" />
<result property="name" column="NAME" />
<result property="qualityDim" column="QUALITY_DIM" />
<result property="type" column="TYPE" />
<result property="level" column="LEVEL" />
<result property="description" column="DESCRIPTION" />
<result property="validFlag" column="VALID_FLAG" />
<result property="delFlag" column="DEL_FLAG" />
<result property="createBy" column="CREATE_BY" />
<result property="creatorId" column="CREATOR_ID" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updaterId" column="UPDATER_ID" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="remark" column="REMARK" />
<result property="code" column="CODE"/>
<result property="useCase" column="USE_CASE"/>
<result property="example" column="EXAMPLE"/>
<result property="iconPath" column="ICON_PATH"/>
<result property="strategyKey" column="STRATEGY_KEY"/>
</resultMap>
<sql id="selectAttAuditRuleVo">
select ID, NAME, QUALITY_DIM, TYPE, LEVEL, DESCRIPTION, CODE, USE_CASE, EXAMPLE, ICON_PATH, STRATEGY_KEY,VALID_FLAG, DEL_FLAG, CREATE_BY, CREATOR_ID, CREATE_TIME, UPDATE_BY, UPDATER_ID, UPDATE_TIME, REMARK from ATT_AUDIT_RULE
</sql>
<select id="selectAttAuditRuleList" parameterType="Long" resultMap="AttAuditRuleResult">
select
a.ID,
a.NAME,
a.QUALITY_DIM,
a.TYPE,
a.LEVEL,
a.DESCRIPTION,
r.ID AS "ruleRelId",
r.RULE_CONFIG AS "ruleConfig"
from
ATT_AUDIT_RULE a
LEFT JOIN DP_DATA_ELEM_RULE_REL r ON a.ID = r.RULE_ID AND r.RULE_TYPE = '1' AND r.DATA_ELEM_ID = #{dataElemId} AND r.DEL_FLAG = '0'
WHERE
a.DEL_FLAG = '0'
</select>
<select id="selectAttAuditRuleByID" parameterType="Long" resultMap="AttAuditRuleResult">
<include refid="selectAttAuditRuleVo"/>
where ID = #{id}
</select>
<insert id="insertAttAuditRule" parameterType="AttAuditRuleDO">
insert into ATT_AUDIT_RULE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">ID,</if>
<if test="name != null">NAME,</if>
<if test="qualityDim != null">QUALITY_DIM,</if>
<if test="type != null">TYPE,</if>
<if test="level != null">LEVEL,</if>
<if test="description != null">DESCRIPTION,</if>
<if test="validFlag != null">VALID_FLAG,</if>
<if test="delFlag != null">DEL_FLAG,</if>
<if test="createBy != null">CREATE_BY,</if>
<if test="creatorId != null">CREATOR_ID,</if>
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updaterId != null">UPDATER_ID,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
<if test="remark != null">REMARK,</if>
<if test="code != null">CODE,</if>
<if test="useCase != null">USE_CASE,</if>
<if test="example != null">EXAMPLE,</if>
<if test="iconPath != null">ICON_PATH,</if>
<if test="strategyKey != null">STRATEGY_KEY,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="qualityDim != null">#{qualityDim},</if>
<if test="type != null">#{type},</if>
<if test="level != null">#{level},</if>
<if test="description != null">#{description},</if>
<if test="validFlag != null">#{validFlag},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="code != null">#{code},</if>
<if test="useCase != null">#{useCase},</if>
<if test="example != null">#{example},</if>
<if test="iconPath != null">#{iconPath},</if>
<if test="strategyKey != null">#{strategyKey},</if>
</trim>
</insert>
<update id="updateAttAuditRule" parameterType="AttAuditRuleDO">
update ATT_AUDIT_RULE
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">NAME = #{name},</if>
<if test="qualityDim != null">QUALITY_DIM = #{qualityDim},</if>
<if test="type != null">TYPE = #{type},</if>
<if test="level != null">LEVEL = #{level},</if>
<if test="description != null">DESCRIPTION = #{description},</if>
<if test="validFlag != null">VALID_FLAG = #{validFlag},</if>
<if test="delFlag != null">DEL_FLAG = #{delFlag},</if>
<if test="createBy != null">CREATE_BY = #{createBy},</if>
<if test="creatorId != null">CREATOR_ID = #{creatorId},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updaterId != null">UPDATER_ID = #{updaterId},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="remark != null">REMARK = #{remark},</if>
<if test="code != null">CODE = #{code},</if>
<if test="useCase != null">USE_CASE = #{useCase},</if>
<if test="example != null">EXAMPLE = #{example},</if>
<if test="iconPath != null">ICON_PATH = #{iconPath},</if>
<if test="strategyKey != null">STRATEGY_KEY = #{strategyKey},</if>
</trim>
where ID = #{id}
</update>
<delete id="deleteAttAuditRuleByID" parameterType="Long">
delete from ATT_AUDIT_RULE where ID = #{id}
</delete>
<delete id="deleteAttAuditRuleByIDs" parameterType="String">
delete from ATT_AUDIT_RULE where ID in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.mdpf.dal.mapper.rule.AttCleanRuleMapper">
<resultMap type="AttCleanRuleDO" id="AttCleanRuleResult">
<result property="id" column="ID" />
<result property="name" column="NAME" />
<result property="type" column="TYPE" />
<result property="level" column="LEVEL" />
<result property="description" column="DESCRIPTION" />
<result property="validFlag" column="VALID_FLAG" />
<result property="delFlag" column="DEL_FLAG" />
<result property="createBy" column="CREATE_BY" />
<result property="creatorId" column="CREATOR_ID" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updaterId" column="UPDATER_ID" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="remark" column="REMARK" />
</resultMap>
<sql id="selectAttCleanRuleVo">
select ID, NAME, TYPE, LEVEL, DESCRIPTION, VALID_FLAG, DEL_FLAG, CREATE_BY, CREATOR_ID, CREATE_TIME, UPDATE_BY, UPDATER_ID, UPDATE_TIME, REMARK from ATT_CLEAN_RULE
</sql>
<select id="selectAttCleanRuleList" parameterType="Long" resultMap="AttCleanRuleResult">
select
a.ID,
a.NAME,
a.TYPE,
a.LEVEL,
a.DESCRIPTION,
r.ID AS "ruleRelId",
r.RULE_CONFIG AS "ruleConfig"
from
ATT_CLEAN_RULE a
LEFT JOIN DP_DATA_ELEM_RULE_REL r ON a.ID = r.RULE_ID AND r.RULE_TYPE = '2' AND r.DATA_ELEM_ID = #{dataElemId} AND r.DEL_FLAG = '0'
WHERE
a.DEL_FLAG = '0'
</select>
<!-- <select id="getCleaningRuleTreeIds" parameterType="Long" resultMap="AttCleanRuleResult">-->
<!-- select-->
<!-- a.NAME,-->
<!-- a.TYPE,-->
<!-- a.LEVEL,-->
<!-- a.DESCRIPTION,-->
<!-- r.ID AS "ruleRelId",-->
<!-- r.RULE_CONFIG AS "ruleConfig"-->
<!-- from-->
<!-- ATT_CLEAN_RULE a-->
<!-- LEFT JOIN DP_DATA_ELEM_RULE_REL r-->
<!-- ON a.ID = r.RULE_ID AND r.RULE_TYPE = '2' AND r.DEL_FLAG = '0'-->
<!-- AND r.DATA_ELEM_ID in-->
<!-- <foreach collection="array" item="roleId" open="(" separator="," close=")">-->
<!-- #{roleId}-->
<!-- </foreach>-->
<!-- WHERE-->
<!-- a.DEL_FLAG = '0'-->
<!-- </select>-->
<select id="getCleaningRuleTreeIds" parameterType="Long" resultMap="AttCleanRuleResult">
select
a.ID,
a.NAME,
a.TYPE,
a.LEVEL,
a.DESCRIPTION,
r.ID AS "ruleRelId",
r.RULE_CONFIG AS "ruleConfig"
from
DP_DATA_ELEM_RULE_REL r
LEFT JOIN ATT_CLEAN_RULE a
ON a.ID = r.RULE_ID AND a.DEL_FLAG = '0'
where
r.RULE_TYPE = '2'
AND r.DEL_FLAG = '0'
AND r.DATA_ELEM_ID in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</select>
<select id="selectAttCleanRuleById" parameterType="Long" resultMap="AttCleanRuleResult">
<include refid="selectAttCleanRuleVo"/>
where ID = #{id}
</select>
<insert id="insertAttCleanRule" parameterType="AttCleanRuleDO">
insert into ATT_CLEAN_RULE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">ID,</if>
<if test="name != null">NAME,</if>
<if test="type != null">TYPE,</if>
<if test="level != null">LEVEL,</if>
<if test="description != null">DESCRIPTION,</if>
<if test="validFlag != null">VALID_FLAG,</if>
<if test="delFlag != null">DEL_FLAG,</if>
<if test="createBy != null">CREATE_BY,</if>
<if test="creatorId != null">CREATOR_ID,</if>
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updaterId != null">UPDATER_ID,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
<if test="remark != null">REMARK,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="level != null">#{level},</if>
<if test="description != null">#{description},</if>
<if test="validFlag != null">#{validFlag},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAttCleanRule" parameterType="AttCleanRuleDO">
update ATT_CLEAN_RULE
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">NAME = #{name},</if>
<if test="type != null">TYPE = #{type},</if>
<if test="level != null">LEVEL = #{level},</if>
<if test="description != null">DESCRIPTION = #{description},</if>
<if test="validFlag != null">VALID_FLAG = #{validFlag},</if>
<if test="delFlag != null">DEL_FLAG = #{delFlag},</if>
<if test="createBy != null">CREATE_BY = #{createBy},</if>
<if test="creatorId != null">CREATOR_ID = #{creatorId},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updaterId != null">UPDATER_ID = #{updaterId},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="remark != null">REMARK = #{remark},</if>
</trim>
where ID = #{id}
</update>
<delete id="deleteAttCleanRuleById" parameterType="Long">
delete from ATT_CLEAN_RULE where ID = #{id}
</delete>
<delete id="deleteAttCleanRuleByIds" parameterType="String">
delete from ATT_CLEAN_RULE where ID in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>