|
@@ -3,19 +3,34 @@ package com.lantone.daqe.facade;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.lantone.common.enums.IsDeleteEnum;
|
|
import com.lantone.common.enums.IsDeleteEnum;
|
|
|
|
+import com.lantone.common.exception.Asserts;
|
|
import com.lantone.common.util.BeanUtil;
|
|
import com.lantone.common.util.BeanUtil;
|
|
|
|
+import com.lantone.common.util.ListUtil;
|
|
|
|
+import com.lantone.common.util.StringUtil;
|
|
import com.lantone.daqe.dto.GetColumnDTO;
|
|
import com.lantone.daqe.dto.GetColumnDTO;
|
|
|
|
+import com.lantone.daqe.dto.GetColumnNameDTO;
|
|
import com.lantone.daqe.dto.GetColumnVerifyPageDTO;
|
|
import com.lantone.daqe.dto.GetColumnVerifyPageDTO;
|
|
import com.lantone.daqe.dto.GetRegularDTO;
|
|
import com.lantone.daqe.dto.GetRegularDTO;
|
|
|
|
+import com.lantone.daqe.dto.GetTableNameDTO;
|
|
import com.lantone.daqe.entity.ColumnInfo;
|
|
import com.lantone.daqe.entity.ColumnInfo;
|
|
import com.lantone.daqe.entity.RegularInfo;
|
|
import com.lantone.daqe.entity.RegularInfo;
|
|
|
|
+import com.lantone.daqe.entity.RegularMapping;
|
|
import com.lantone.daqe.facade.base.ColumnInfoFacade;
|
|
import com.lantone.daqe.facade.base.ColumnInfoFacade;
|
|
import com.lantone.daqe.facade.base.ColumnVerifyFacade;
|
|
import com.lantone.daqe.facade.base.ColumnVerifyFacade;
|
|
import com.lantone.daqe.facade.base.RegularInfoFacade;
|
|
import com.lantone.daqe.facade.base.RegularInfoFacade;
|
|
|
|
+import com.lantone.daqe.facade.base.RegularMappingFacade;
|
|
|
|
+import com.lantone.daqe.vo.AddColumnVerifyVO;
|
|
|
|
+import com.lantone.daqe.vo.ColumnInfoVO;
|
|
|
|
+import com.lantone.daqe.vo.GetColumnNameVO;
|
|
import com.lantone.daqe.vo.GetColumnVerifyPageVO;
|
|
import com.lantone.daqe.vo.GetColumnVerifyPageVO;
|
|
|
|
+import com.lantone.daqe.vo.GetRegularVO;
|
|
|
|
+import com.lantone.daqe.vo.GetTableNameVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -34,6 +49,8 @@ public class ColumnVerifyManagementFacade {
|
|
ColumnInfoFacade columnInfoFacade;
|
|
ColumnInfoFacade columnInfoFacade;
|
|
@Autowired
|
|
@Autowired
|
|
RegularInfoFacade regularInfoFacade;
|
|
RegularInfoFacade regularInfoFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ RegularMappingFacade regularMappingFacade;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取字段校验规则分页列表数据
|
|
* 获取字段校验规则分页列表数据
|
|
@@ -46,16 +63,36 @@ public class ColumnVerifyManagementFacade {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 下拉框获取数据库表中列数据信息
|
|
|
|
|
|
+ * 下拉框获取数据库表中列数据表名称信息
|
|
|
|
+ *
|
|
|
|
+ * @param
|
|
|
|
+ * @return: 数据库表中列数据表名称信息
|
|
|
|
+ */
|
|
|
|
+ public List<GetTableNameDTO> getTableName(GetTableNameVO getTableNameVO) {
|
|
|
|
+ List<ColumnInfo> columnInfoList = columnInfoFacade.getBaseMapper().selectList(new QueryWrapper<ColumnInfo>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .like(StringUtil.isNotBlank(getTableNameVO.getTableCname()), "table_cname", getTableNameVO.getTableCname())
|
|
|
|
+ .like(StringUtil.isNotBlank(getTableNameVO.getTableEname()), "table_ename", getTableNameVO.getTableEname())
|
|
|
|
+ .groupBy("table_cname","table_ename")
|
|
|
|
+ );
|
|
|
|
+ List<GetTableNameDTO> getColumnDTOList = BeanUtil.listCopyTo(columnInfoList, GetTableNameDTO.class);
|
|
|
|
+ return getColumnDTOList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 下拉框获取数据库表中列数据字段名称信息
|
|
*
|
|
*
|
|
* @param
|
|
* @param
|
|
- * @return: 数据库表中列数据信息
|
|
|
|
|
|
+ * @return: 数据库表中列数据字段名称信息
|
|
*/
|
|
*/
|
|
- public List<GetColumnDTO> getColumn() {
|
|
|
|
|
|
+ public List<GetColumnNameDTO> getColumnName(GetColumnNameVO getColumnNameVO) {
|
|
List<ColumnInfo> columnInfoList = columnInfoFacade.getBaseMapper().selectList(new QueryWrapper<ColumnInfo>()
|
|
List<ColumnInfo> columnInfoList = columnInfoFacade.getBaseMapper().selectList(new QueryWrapper<ColumnInfo>()
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .like(StringUtil.isNotBlank(getColumnNameVO.getColumnCname()), "column_cname", getColumnNameVO.getColumnCname())
|
|
|
|
+ .like(StringUtil.isNotBlank(getColumnNameVO.getColumnEname()), "column_ename", getColumnNameVO.getColumnEname())
|
|
|
|
+ .groupBy("column_cname","column_ename")
|
|
);
|
|
);
|
|
- List<GetColumnDTO> getColumnDTOList = BeanUtil.listCopyTo(columnInfoList, GetColumnDTO.class);
|
|
|
|
|
|
+ List<GetColumnNameDTO> getColumnDTOList = BeanUtil.listCopyTo(columnInfoList, GetColumnNameDTO.class);
|
|
return getColumnDTOList;
|
|
return getColumnDTOList;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -65,11 +102,60 @@ public class ColumnVerifyManagementFacade {
|
|
* @param
|
|
* @param
|
|
* @return: 正则式名称
|
|
* @return: 正则式名称
|
|
*/
|
|
*/
|
|
- public List<GetRegularDTO> getRegular() {
|
|
|
|
|
|
+ public List<GetRegularDTO> getRegular(GetRegularVO getRegularVO) {
|
|
List<RegularInfo> regularInfoList = regularInfoFacade.getBaseMapper().selectList(new QueryWrapper<RegularInfo>()
|
|
List<RegularInfo> regularInfoList = regularInfoFacade.getBaseMapper().selectList(new QueryWrapper<RegularInfo>()
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .like(StringUtil.isNotBlank(getRegularVO.getName()), "name", getRegularVO.getName())
|
|
);
|
|
);
|
|
List<GetRegularDTO> regularDTOList = BeanUtil.listCopyTo(regularInfoList, GetRegularDTO.class);
|
|
List<GetRegularDTO> regularDTOList = BeanUtil.listCopyTo(regularInfoList, GetRegularDTO.class);
|
|
return regularDTOList;
|
|
return regularDTOList;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增字段校验规则
|
|
|
|
+ *
|
|
|
|
+ * @param
|
|
|
|
+ * @return: 是否成功
|
|
|
|
+ */
|
|
|
|
+ public Boolean addColumnVerify(AddColumnVerifyVO addColumnVerifyVO) {
|
|
|
|
+ List<ColumnInfoVO> columnList = addColumnVerifyVO.getColumnList();
|
|
|
|
+ List<Long> columnIdList = new ArrayList<>();
|
|
|
|
+ //查出表列信息ID
|
|
|
|
+ for (ColumnInfoVO columnInfoVO : columnList) {
|
|
|
|
+ ColumnInfo columnInfo = columnInfoFacade.getBaseMapper().selectOne(new QueryWrapper<ColumnInfo>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq(StringUtil.isNotBlank(columnInfoVO.getTableCname()), "table_cname", columnInfoVO.getTableCname())
|
|
|
|
+ .eq(StringUtil.isNotBlank(columnInfoVO.getTableEname()), "table_ename", columnInfoVO.getTableEname())
|
|
|
|
+ .eq(StringUtil.isNotBlank(columnInfoVO.getColumnCname()), "column_cname", columnInfoVO.getColumnCname())
|
|
|
|
+ .eq(StringUtil.isNotBlank(columnInfoVO.getColumnEname()), "column_ename", columnInfoVO.getColumnEname())
|
|
|
|
+ );
|
|
|
|
+ columnIdList.add(columnInfo.getId());
|
|
|
|
+ }
|
|
|
|
+ //插入正则维护表
|
|
|
|
+ if(ListUtil.isNotEmpty(columnIdList)){
|
|
|
|
+ for (Long columnId : columnIdList) {
|
|
|
|
+ //先判断是否该字段信息是否已关联该正则
|
|
|
|
+ RegularMapping selectOneMapping = regularMappingFacade.getBaseMapper().selectOne(new QueryWrapper<RegularMapping>()
|
|
|
|
+ .eq("column_id", columnId)
|
|
|
|
+ .eq("regular_id", addColumnVerifyVO.getRegularId())
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ );
|
|
|
|
+ if(selectOneMapping!=null){
|
|
|
|
+ Asserts.fail("所选字段已关联该正则,请重新选择正则!");
|
|
|
|
+ }
|
|
|
|
+ RegularMapping regularMapping = new RegularMapping();
|
|
|
|
+ regularMapping.setColumnId(columnId);
|
|
|
|
+ regularMapping.setGmtCreate(new Date());
|
|
|
|
+ regularMapping.setRegularId(addColumnVerifyVO.getRegularId());
|
|
|
|
+ int insert = regularMappingFacade.getBaseMapper().insert(regularMapping);
|
|
|
|
+ if(insert!=1){
|
|
|
|
+ Asserts.fail("关联正则失败,请重试!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //插入表字段的非空校验维护表
|
|
|
|
+ //插入关键字信息维护表
|
|
|
|
+ //插入总表
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|