fix:更改数据表结构,在测试的同时异步添加表结构
parent
15032a82ac
commit
29b4db789c
|
@ -1,6 +1,9 @@
|
||||||
package com.muyu.system.domain;
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.muyu.system.domain.req.AsNoticeUserReq;
|
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -29,6 +32,7 @@ public class AsNoticeUser extends BaseEntity
|
||||||
private static final long serialVersionUID = 0L;
|
private static final long serialVersionUID = 0L;
|
||||||
|
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 通知id */
|
/** 通知id */
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.system.domain.vo;
|
package com.muyu.system.domain.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.muyu.common.system.domain.SysDept;
|
import com.muyu.common.system.domain.SysDept;
|
||||||
import com.muyu.system.domain.SysMenu;
|
import com.muyu.system.domain.SysMenu;
|
||||||
|
@ -19,6 +21,7 @@ public class TreeSelect implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 节点ID
|
* 节点ID
|
||||||
*/
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.etl.domain;
|
package com.muyu.etl.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import com.muyu.etl.domain.req.BasicConfigQueryReq;
|
import com.muyu.etl.domain.req.BasicConfigQueryReq;
|
||||||
|
@ -27,6 +29,7 @@ public class BasicConfigInfo extends BaseEntity
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 接入源名称 */
|
/** 接入源名称 */
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package com.muyu.etl.domain;
|
package com.muyu.etl.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
@ -11,11 +17,16 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
* @author Saisai
|
* @author Saisai
|
||||||
* @date 2024-04-22
|
* @date 2024-04-22
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
public class Structure extends BaseEntity
|
public class Structure extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 表id */
|
/** 表id */
|
||||||
|
@ -66,145 +77,5 @@ public class Structure extends BaseEntity
|
||||||
@Excel(name = "映射字典")
|
@Excel(name = "映射字典")
|
||||||
private String dictionaryTable;
|
private String dictionaryTable;
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setTableId(Long tableId)
|
|
||||||
{
|
|
||||||
this.tableId = tableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTableId()
|
|
||||||
{
|
|
||||||
return tableId;
|
|
||||||
}
|
|
||||||
public void setColumnName(String columnName)
|
|
||||||
{
|
|
||||||
this.columnName = columnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnName()
|
|
||||||
{
|
|
||||||
return columnName;
|
|
||||||
}
|
|
||||||
public void setColumnRemark(String columnRemark)
|
|
||||||
{
|
|
||||||
this.columnRemark = columnRemark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnRemark()
|
|
||||||
{
|
|
||||||
return columnRemark;
|
|
||||||
}
|
|
||||||
public void setIsPrimary(String isPrimary)
|
|
||||||
{
|
|
||||||
this.isPrimary = isPrimary;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsPrimary()
|
|
||||||
{
|
|
||||||
return isPrimary;
|
|
||||||
}
|
|
||||||
public void setColumnType(String columnType)
|
|
||||||
{
|
|
||||||
this.columnType = columnType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnType()
|
|
||||||
{
|
|
||||||
return columnType;
|
|
||||||
}
|
|
||||||
public void setJavaType(String javaType)
|
|
||||||
{
|
|
||||||
this.javaType = javaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJavaType()
|
|
||||||
{
|
|
||||||
return javaType;
|
|
||||||
}
|
|
||||||
public void setColumnLength(String columnLength)
|
|
||||||
{
|
|
||||||
this.columnLength = columnLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnLength()
|
|
||||||
{
|
|
||||||
return columnLength;
|
|
||||||
}
|
|
||||||
public void setColumnDecimals(String columnDecimals)
|
|
||||||
{
|
|
||||||
this.columnDecimals = columnDecimals;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnDecimals()
|
|
||||||
{
|
|
||||||
return columnDecimals;
|
|
||||||
}
|
|
||||||
public void setIsNull(String isNull)
|
|
||||||
{
|
|
||||||
this.isNull = isNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsNull()
|
|
||||||
{
|
|
||||||
return isNull;
|
|
||||||
}
|
|
||||||
public void setDefaultValue(String defaultValue)
|
|
||||||
{
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefaultValue()
|
|
||||||
{
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
public void setIsDictionary(String isDictionary)
|
|
||||||
{
|
|
||||||
this.isDictionary = isDictionary;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsDictionary()
|
|
||||||
{
|
|
||||||
return isDictionary;
|
|
||||||
}
|
|
||||||
public void setDictionaryTable(String dictionaryTable)
|
|
||||||
{
|
|
||||||
this.dictionaryTable = dictionaryTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDictionaryTable()
|
|
||||||
{
|
|
||||||
return dictionaryTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("tableId", getTableId())
|
|
||||||
.append("columnName", getColumnName())
|
|
||||||
.append("columnRemark", getColumnRemark())
|
|
||||||
.append("isPrimary", getIsPrimary())
|
|
||||||
.append("columnType", getColumnType())
|
|
||||||
.append("javaType", getJavaType())
|
|
||||||
.append("columnLength", getColumnLength())
|
|
||||||
.append("columnDecimals", getColumnDecimals())
|
|
||||||
.append("isNull", getIsNull())
|
|
||||||
.append("defaultValue", getDefaultValue())
|
|
||||||
.append("isDictionary", getIsDictionary())
|
|
||||||
.append("dictionaryTable", getDictionaryTable())
|
|
||||||
.append("remark", getRemark())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.muyu.etl.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库表基础信息对象 table_info
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-04-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class TableInfo extends TreeEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long basicId;
|
||||||
|
|
||||||
|
/** 表名称/数据库 */
|
||||||
|
@Excel(name = "表名称/数据库")
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
|
/** 表备注 */
|
||||||
|
@Excel(name = "表备注")
|
||||||
|
private String tableRemark;
|
||||||
|
|
||||||
|
/** 数据量 */
|
||||||
|
@Excel(name = "数据量")
|
||||||
|
private Long dataNum;
|
||||||
|
|
||||||
|
/** 是否核心 'Y'是 'N'不是 */
|
||||||
|
@Excel(name = "是否核心 'Y'是 'N'不是")
|
||||||
|
private String center;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,57 +0,0 @@
|
||||||
package com.muyu.etl.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import com.muyu.common.core.web.domain.TreeEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 树级结构对象 tree_construct
|
|
||||||
*
|
|
||||||
* @author Saisai
|
|
||||||
* @date 2024-04-22
|
|
||||||
*/
|
|
||||||
public class TreeConstruct extends TreeEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 主键 */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 树级结构 */
|
|
||||||
@Excel(name = "树级结构")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("parentId", getParentId())
|
|
||||||
.append("remark", getRemark())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.etl.domain.req;
|
package com.muyu.etl.domain.req;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -22,6 +24,7 @@ public class BasicConfigQueryReq {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 接入源名称 */
|
/** 接入源名称 */
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.etl.domain.resp;
|
package com.muyu.etl.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -22,6 +24,7 @@ import java.util.Date;
|
||||||
public class BasicConfigResp {
|
public class BasicConfigResp {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 接入源名称 */
|
/** 接入源名称 */
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package com.muyu.etl.mapper;
|
package com.muyu.etl.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.etl.domain.Structure;
|
import com.muyu.etl.domain.Structure;
|
||||||
import com.muyu.etl.domain.TreeConstruct;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结构Mapper接口
|
* 结构Mapper接口
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.etl.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.etl.domain.TableInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库表基础信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-04-22
|
||||||
|
*/
|
||||||
|
public interface TableInfoMapper extends BaseMapper<TableInfo>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询库表基础信息
|
||||||
|
*
|
||||||
|
* @param id 库表基础信息主键
|
||||||
|
* @return 库表基础信息
|
||||||
|
*/
|
||||||
|
public TableInfo selectTableInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库表基础信息列表
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 库表基础信息集合
|
||||||
|
*/
|
||||||
|
public List<TableInfo> selectTableInfoList(TableInfo tableInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增库表基础信息
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertTableInfo(TableInfo tableInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改库表基础信息
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateTableInfo(TableInfo tableInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库表基础信息
|
||||||
|
*
|
||||||
|
* @param id 库表基础信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTableInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除库表基础信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTableInfoByIds(Long[] ids);
|
||||||
|
}
|
|
@ -1,63 +0,0 @@
|
||||||
package com.muyu.etl.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.etl.domain.TreeConstruct;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 树级结构Mapper接口
|
|
||||||
*
|
|
||||||
* @author Saisai
|
|
||||||
* @date 2024-04-22
|
|
||||||
*/
|
|
||||||
public interface TreeConstructMapper extends BaseMapper<TreeConstruct>
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询树级结构
|
|
||||||
*
|
|
||||||
* @param id 树级结构主键
|
|
||||||
* @return 树级结构
|
|
||||||
*/
|
|
||||||
public TreeConstruct selectTreeConstructById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询树级结构列表
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 树级结构集合
|
|
||||||
*/
|
|
||||||
public List<TreeConstruct> selectTreeConstructList(TreeConstruct treeConstruct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增树级结构
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertTreeConstruct(TreeConstruct treeConstruct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改树级结构
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateTreeConstruct(TreeConstruct treeConstruct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除树级结构
|
|
||||||
*
|
|
||||||
* @param id 树级结构主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteTreeConstructById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除树级结构
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteTreeConstructByIds(Long[] ids);
|
|
||||||
}
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.etl.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.etl.domain.TableInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库表基础信息Service接口
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-04-22
|
||||||
|
*/
|
||||||
|
public interface TableInfoService extends IService<TableInfo>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询库表基础信息
|
||||||
|
*
|
||||||
|
* @param id 库表基础信息主键
|
||||||
|
* @return 库表基础信息
|
||||||
|
*/
|
||||||
|
public TableInfo selectTableInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库表基础信息列表
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 库表基础信息集合
|
||||||
|
*/
|
||||||
|
public List<TableInfo> selectTableInfoList(TableInfo tableInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增库表基础信息
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertTableInfo(TableInfo tableInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改库表基础信息
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateTableInfo(TableInfo tableInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除库表基础信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的库表基础信息主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTableInfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库表基础信息信息
|
||||||
|
*
|
||||||
|
* @param id 库表基础信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTableInfoById(Long id);
|
||||||
|
}
|
|
@ -1,63 +0,0 @@
|
||||||
package com.muyu.etl.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.etl.domain.TreeConstruct;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 树级结构Service接口
|
|
||||||
*
|
|
||||||
* @author Saisai
|
|
||||||
* @date 2024-04-22
|
|
||||||
*/
|
|
||||||
public interface TreeConstructService extends IService<TreeConstruct>
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询树级结构
|
|
||||||
*
|
|
||||||
* @param id 树级结构主键
|
|
||||||
* @return 树级结构
|
|
||||||
*/
|
|
||||||
public TreeConstruct selectTreeConstructById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询树级结构列表
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 树级结构集合
|
|
||||||
*/
|
|
||||||
public List<TreeConstruct> selectTreeConstructList(TreeConstruct treeConstruct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增树级结构
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertTreeConstruct(TreeConstruct treeConstruct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改树级结构
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateTreeConstruct(TreeConstruct treeConstruct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除树级结构
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的树级结构主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteTreeConstructByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除树级结构信息
|
|
||||||
*
|
|
||||||
* @param id 树级结构主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteTreeConstructById(Long id);
|
|
||||||
}
|
|
|
@ -1,19 +1,24 @@
|
||||||
package com.muyu.etl.service.impl;
|
package com.muyu.etl.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.etl.domain.BasicConfigInfo;
|
import com.muyu.etl.domain.BasicConfigInfo;
|
||||||
|
import com.muyu.etl.domain.Structure;
|
||||||
|
import com.muyu.etl.domain.TableInfo;
|
||||||
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
||||||
import com.muyu.etl.service.BasicConfigInfoService;
|
import com.muyu.etl.service.BasicConfigInfoService;
|
||||||
|
import com.muyu.etl.service.StructureService;
|
||||||
|
import com.muyu.etl.service.TableInfoService;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service业务层处理
|
* Service业务层处理
|
||||||
|
@ -28,6 +33,12 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
@Autowired
|
@Autowired
|
||||||
private BasicConfigInfoMapper basicConfigInfoMapper;
|
private BasicConfigInfoMapper basicConfigInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StructureService structureService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TableInfoService tableInfoService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询
|
* 查询
|
||||||
|
@ -116,33 +127,131 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
try {
|
try {
|
||||||
conn = DriverManager.getConnection(url, user, password);
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
System.out.println("Connected to the MySQL server successfully.");
|
System.out.println("Connected to the MySQL server successfully.");
|
||||||
|
//同步数据库信息
|
||||||
|
//树级结构,库,表
|
||||||
|
TableInfo tableInfo = new TableInfo().builder()
|
||||||
|
.basicId(basicConfigInfo.getId())
|
||||||
|
.parentId(0L)
|
||||||
|
.tableRemark("")
|
||||||
|
.center("Y")
|
||||||
|
.tableName(basicConfigInfo.getDataSourcesSystemName() + "(" + databaseName + ")")
|
||||||
|
.createBy(SecurityUtils.getUsername())
|
||||||
|
.createTime(new Date())
|
||||||
|
.build();
|
||||||
|
tableInfoService.saveOrUpdate(tableInfo,new LambdaUpdateChainWrapper<TableInfo>(TableInfo.class){{
|
||||||
|
eq(TableInfo::getTableName,tableInfo.getTableName());
|
||||||
|
eq(TableInfo::getBasicId,basicConfigInfo.getId());
|
||||||
|
}});
|
||||||
|
DatabaseMetaData metaData = conn.getMetaData();
|
||||||
|
ResultSet rs = metaData.getTables(databaseName,
|
||||||
|
null, "%", new String[]{"TABLE", "VIEW"});
|
||||||
|
while (rs.next()) {
|
||||||
|
//表名
|
||||||
|
String tableName1 = rs.getString("TABLE_NAME");
|
||||||
|
String tableRemark = rs.getString("REMARKS");
|
||||||
|
Connection finalConn = conn;
|
||||||
|
PreparedStatement ps = conn.prepareStatement("select * from " + tableName1);
|
||||||
|
ResultSet rset = ps.executeQuery();
|
||||||
|
Long rowCount = 0L;
|
||||||
|
while(rset.next())
|
||||||
|
{
|
||||||
|
rowCount++;
|
||||||
|
}
|
||||||
|
TableInfo build = TableInfo.builder()
|
||||||
|
.basicId(basicConfigInfo.getId())
|
||||||
|
.tableName(tableName1)
|
||||||
|
.tableRemark(tableRemark.isEmpty()? "":tableRemark)
|
||||||
|
.parentId(tableInfo.getId())
|
||||||
|
.center("Y")
|
||||||
|
.updateBy(SecurityUtils.getUsername())
|
||||||
|
.dataNum(rowCount)
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
tableInfoService.saveOrUpdate(build,new LambdaUpdateChainWrapper<TableInfo>(TableInfo.class){{
|
||||||
|
eq(TableInfo::getTableName,build.getTableName());
|
||||||
|
eq(TableInfo::getBasicId,basicConfigInfo.getId());
|
||||||
|
}});
|
||||||
|
new Runnable() {
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
syncData(finalConn,databaseName,build);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new ServletException("连接失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new ServletException("连接失败");
|
throw new ServletException("连接失败");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//{
|
public void syncData (Connection conn, String databaseName, TableInfo table) throws SQLException {
|
||||||
// list: [
|
PreparedStatement ps = conn.prepareStatement(
|
||||||
// {
|
" SELECT " +
|
||||||
// (数据库名)testName: null,
|
" COLUMN_NAME AS '字段', " +
|
||||||
// (表名)children: [
|
" COLUMN_COMMENT AS '字段注释', " +
|
||||||
// {
|
" CASE WHEN COLUMN_KEY = 'PRI' THEN '是' ELSE '否' END AS '是否主键'," +
|
||||||
// (表名)name: null,
|
" CASE \n" +
|
||||||
// data: [
|
" WHEN DATA_TYPE = 'int' THEN 'Integer' " +
|
||||||
// {
|
" WHEN DATA_TYPE = 'varchar' THEN 'String' " +
|
||||||
// (字段名)name: null,
|
" WHEN DATA_TYPE = 'decimal' THEN 'BigDecimal' " +
|
||||||
// val: null,
|
" WHEN DATA_TYPE = 'tinyint' AND COLUMN_TYPE = 'tinyint(1)' THEN 'Boolean'" +
|
||||||
// type: null,
|
" ELSE DATA_TYPE -- 如果无法映射,则返回原始数据库类型 \n" +
|
||||||
// 注释:null,
|
" END AS 'Java类型', " +
|
||||||
// ...
|
" DATA_TYPE AS '数据库类型', -- 原始的数据库类型 \n" +
|
||||||
// }
|
" COLUMN_TYPE AS '详细的数据库类型', -- 更详细的数据库类型,可能包含长度、精度等 \n" +
|
||||||
// ]
|
" CHARACTER_MAXIMUM_LENGTH AS '长度', \n" +
|
||||||
// }
|
" NUMERIC_SCALE AS '小数位', \n" +
|
||||||
// ]
|
" IS_NULLABLE AS '是否为空', \n" +
|
||||||
// }
|
" COLUMN_DEFAULT AS '默认值' \n" +
|
||||||
// ]
|
"FROM INFORMATION_SCHEMA.COLUMNS WHERE \n" +
|
||||||
//}
|
" TABLE_SCHEMA = '" + databaseName + "' -- 替换为你的数据库名称 \n" +
|
||||||
|
" AND TABLE_NAME = '" + table.getTableName() + "'");
|
||||||
|
ResultSet resultSet = ps.executeQuery();
|
||||||
|
ArrayList<Structure> structureList = new ArrayList<>();
|
||||||
|
while (resultSet.next()){
|
||||||
|
String columnName = resultSet.getObject(0).toString();
|
||||||
|
String columnComment = resultSet.getObject(1).toString();
|
||||||
|
String columnKey = resultSet.getObject(2).toString();
|
||||||
|
String end = resultSet.getObject(3).toString();
|
||||||
|
String dataType = resultSet.getObject(4).toString();
|
||||||
|
String columnType = resultSet.getObject(5).toString();
|
||||||
|
String characterMaximumLength = resultSet.getObject(6).toString();
|
||||||
|
String NumericScale = resultSet.getObject(7).toString();
|
||||||
|
String isNullable = resultSet.getObject(8).toString();
|
||||||
|
String columnDefault = resultSet.getObject(9).toString();
|
||||||
|
System.out.println(columnName);
|
||||||
|
System.out.println(columnComment);
|
||||||
|
System.out.println(columnKey);
|
||||||
|
System.out.println(end);
|
||||||
|
System.out.println(dataType);
|
||||||
|
System.out.println(columnType);
|
||||||
|
System.out.println(characterMaximumLength);
|
||||||
|
System.out.println(NumericScale);
|
||||||
|
System.out.println(isNullable);
|
||||||
|
System.out.println(columnDefault);
|
||||||
|
Structure build = Structure.builder()
|
||||||
|
.tableId(table.getId())
|
||||||
|
.columnName(columnName)
|
||||||
|
.columnRemark(columnComment)
|
||||||
|
.isPrimary("是".equals(columnKey) ? "Y" : "N")
|
||||||
|
.javaType(end)
|
||||||
|
.columnType(dataType)
|
||||||
|
.columnType(columnType)
|
||||||
|
.columnLength(characterMaximumLength)
|
||||||
|
.columnDecimals(NumericScale)
|
||||||
|
.isNull("YES".equals(isNullable) ? "Y" : "N")
|
||||||
|
.defaultValue(columnDefault)
|
||||||
|
.build();
|
||||||
|
log.info(build);
|
||||||
|
structureList.add(build);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List getDataByEtl() {
|
public List getDataByEtl() {
|
||||||
List<BasicConfigInfo> list = this.list();
|
List<BasicConfigInfo> list = this.list();
|
||||||
|
@ -162,10 +271,12 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
String catalogs = resultSet.getString("TABLE_CAT");
|
String catalogs = resultSet.getString("TABLE_CAT");
|
||||||
log.info(catalogs);
|
log.info(catalogs);
|
||||||
// 获取表名
|
// 获取表名
|
||||||
ResultSet rs = metaData.getTables(catalogs, info.getDatabaseName(), "%", new String[]{"TABLE", "VIEW"});
|
ResultSet rs = metaData.getTables(info.getDatabaseName(),null, "%", new String[]{"TABLE", "VIEW"});
|
||||||
try {
|
try {
|
||||||
ArrayList<String> tableName = new ArrayList<>();
|
ArrayList<String> tableName = new ArrayList<>();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
//表名
|
||||||
|
String tableName1 = rs.getString("TABLE_NAME");
|
||||||
tableName.add( rs.getString("TABLE_NAME"));
|
tableName.add( rs.getString("TABLE_NAME"));
|
||||||
}
|
}
|
||||||
mapList.add(new HashMap<>(){{
|
mapList.add(new HashMap<>(){{
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.muyu.etl.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.etl.mapper.TableInfoMapper;
|
||||||
|
import com.muyu.etl.domain.TableInfo;
|
||||||
|
import com.muyu.etl.service.TableInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库表基础信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Saisai
|
||||||
|
* @date 2024-04-22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TableInfoServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> implements TableInfoService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private TableInfoMapper tableInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库表基础信息
|
||||||
|
*
|
||||||
|
* @param id 库表基础信息主键
|
||||||
|
* @return 库表基础信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableInfo selectTableInfoById(Long id)
|
||||||
|
{
|
||||||
|
return tableInfoMapper.selectTableInfoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库表基础信息列表
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 库表基础信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TableInfo> selectTableInfoList(TableInfo tableInfo)
|
||||||
|
{
|
||||||
|
return tableInfoMapper.selectTableInfoList(tableInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增库表基础信息
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertTableInfo(TableInfo tableInfo)
|
||||||
|
{
|
||||||
|
tableInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return tableInfoMapper.insertTableInfo(tableInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改库表基础信息
|
||||||
|
*
|
||||||
|
* @param tableInfo 库表基础信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateTableInfo(TableInfo tableInfo)
|
||||||
|
{
|
||||||
|
tableInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return tableInfoMapper.updateTableInfo(tableInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除库表基础信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的库表基础信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteTableInfoByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return tableInfoMapper.deleteTableInfoByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库表基础信息信息
|
||||||
|
*
|
||||||
|
* @param id 库表基础信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteTableInfoById(Long id)
|
||||||
|
{
|
||||||
|
return tableInfoMapper.deleteTableInfoById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,98 +0,0 @@
|
||||||
package com.muyu.etl.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
|
||||||
import com.muyu.etl.domain.TreeConstruct;
|
|
||||||
import com.muyu.etl.mapper.TreeConstructMapper;
|
|
||||||
import com.muyu.etl.service.TreeConstructService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 树级结构Service业务层处理
|
|
||||||
*
|
|
||||||
* @author Saisai
|
|
||||||
* @date 2024-04-22
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TreeConstructServiceImpl extends ServiceImpl<TreeConstructMapper, TreeConstruct> implements TreeConstructService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private TreeConstructMapper treeConstructMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询树级结构
|
|
||||||
*
|
|
||||||
* @param id 树级结构主键
|
|
||||||
* @return 树级结构
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public TreeConstruct selectTreeConstructById(Long id)
|
|
||||||
{
|
|
||||||
return treeConstructMapper.selectTreeConstructById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询树级结构列表
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 树级结构
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<TreeConstruct> selectTreeConstructList(TreeConstruct treeConstruct)
|
|
||||||
{
|
|
||||||
return treeConstructMapper.selectTreeConstructList(treeConstruct);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增树级结构
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertTreeConstruct(TreeConstruct treeConstruct)
|
|
||||||
{
|
|
||||||
treeConstruct.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return treeConstructMapper.insertTreeConstruct(treeConstruct);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改树级结构
|
|
||||||
*
|
|
||||||
* @param treeConstruct 树级结构
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateTreeConstruct(TreeConstruct treeConstruct)
|
|
||||||
{
|
|
||||||
treeConstruct.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return treeConstructMapper.updateTreeConstruct(treeConstruct);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除树级结构
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的树级结构主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteTreeConstructByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return treeConstructMapper.deleteTreeConstructByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除树级结构信息
|
|
||||||
*
|
|
||||||
* @param id 树级结构主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteTreeConstructById(Long id)
|
|
||||||
{
|
|
||||||
return treeConstructMapper.deleteTreeConstructById(id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?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="com.muyu.etl.mapper.TableInfoMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.etl.domain.TableInfo" id="TableInfoResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="parentId" column="parent_id" />
|
||||||
|
<result property="basicId" column="basic_id" />
|
||||||
|
<result property="tableName" column="table_name" />
|
||||||
|
<result property="tableRemark" column="table_remark" />
|
||||||
|
<result property="dataNum" column="data_num" />
|
||||||
|
<result property="center" column="center" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectTableInfoVo">
|
||||||
|
select id, parent_id, table_name, table_remark, data_num, center, remark, create_by, create_time, update_by, update_time from table_info
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectTableInfoList" parameterType="com.muyu.etl.domain.TableInfo" resultMap="TableInfoResult">
|
||||||
|
<include refid="selectTableInfoVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||||
|
<if test="basicId != null "> and basic_id = #{basicId}</if>
|
||||||
|
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
|
||||||
|
<if test="tableRemark != null and tableRemark != ''"> and table_remark = #{tableRemark}</if>
|
||||||
|
<if test="dataNum != null "> and data_num = #{dataNum}</if>
|
||||||
|
<if test="center != null and center != ''"> and center = #{center}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTableInfoById" parameterType="Long" resultMap="TableInfoResult">
|
||||||
|
<include refid="selectTableInfoVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertTableInfo" parameterType="com.muyu.etl.domain.TableInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into table_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="parentId != null">parent_id,</if>
|
||||||
|
<if test="basicId != null">basic_id,</if>
|
||||||
|
<if test="tableName != null and tableName != ''">table_name,</if>
|
||||||
|
<if test="tableRemark != null and tableRemark != ''">table_remark,</if>
|
||||||
|
<if test="dataNum != null">data_num,</if>
|
||||||
|
<if test="center != null">center,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="parentId != null">#{parentId},</if>
|
||||||
|
<if test="basicId != null">#{basicId},</if>
|
||||||
|
<if test="tableName != null and tableName != ''">#{tableName},</if>
|
||||||
|
<if test="tableRemark != null and tableRemark != ''">#{tableRemark},</if>
|
||||||
|
<if test="dataNum != null">#{dataNum},</if>
|
||||||
|
<if test="center != null">#{center},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateTableInfo" parameterType="com.muyu.etl.domain.TableInfo">
|
||||||
|
update table_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
|
<if test="basicId != null">basic_id = #{basicId},</if>
|
||||||
|
<if test="tableName != null and tableName != ''">table_name = #{tableName},</if>
|
||||||
|
<if test="tableRemark != null and tableRemark != ''">table_remark = #{tableRemark},</if>
|
||||||
|
<if test="dataNum != null">data_num = #{dataNum},</if>
|
||||||
|
<if test="center != null">center = #{center},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteTableInfoById" parameterType="Long">
|
||||||
|
delete from table_info where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteTableInfoByIds" parameterType="String">
|
||||||
|
delete from table_info where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -1,81 +0,0 @@
|
||||||
<?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="com.muyu.etl.mapper.TreeConstructMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.muyu.etl.domain.TreeConstruct" id="TreeConstructResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="name" column="name" />
|
|
||||||
<result property="parentId" column="parent_id" />
|
|
||||||
<result property="remark" column="remark" />
|
|
||||||
<result property="createBy" column="create_by" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateBy" column="update_by" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectTreeConstructVo">
|
|
||||||
select id, name, parent_id, remark, create_by, create_time, update_by, update_time from tree_construct
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectTreeConstructList" parameterType="com.muyu.etl.domain.TreeConstruct" resultMap="TreeConstructResult">
|
|
||||||
<include refid="selectTreeConstructVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
||||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectTreeConstructById" parameterType="Long" resultMap="TreeConstructResult">
|
|
||||||
<include refid="selectTreeConstructVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertTreeConstruct" parameterType="com.muyu.etl.domain.TreeConstruct" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into tree_construct
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="name != null">name,</if>
|
|
||||||
<if test="parentId != null">parent_id,</if>
|
|
||||||
<if test="remark != null">remark,</if>
|
|
||||||
<if test="createBy != null">create_by,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="name != null">#{name},</if>
|
|
||||||
<if test="parentId != null">#{parentId},</if>
|
|
||||||
<if test="remark != null">#{remark},</if>
|
|
||||||
<if test="createBy != null">#{createBy},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateTreeConstruct" parameterType="com.muyu.etl.domain.TreeConstruct">
|
|
||||||
update tree_construct
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="name != null">name = #{name},</if>
|
|
||||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteTreeConstructById" parameterType="Long">
|
|
||||||
delete from tree_construct where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteTreeConstructByIds" parameterType="String">
|
|
||||||
delete from tree_construct where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue