From 15032a82acdb4c4ae66fa20004541ab1528100b0 Mon Sep 17 00:00:00 2001 From: Saisai Liu <1374434128@qq.com> Date: Mon, 22 Apr 2024 11:46:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=B5=84=E4=BA=A7=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A1=A8(mybaits=5Fpuls)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/muyu/etl/domain/Structure.java | 210 ++++++++++++++++++ .../com/muyu/etl/domain/TreeConstruct.java | 57 +++++ .../controller/BasicConfigInfoController.java | 7 + .../com/muyu/etl/mapper/StructureMapper.java | 64 ++++++ .../muyu/etl/mapper/TreeConstructMapper.java | 63 ++++++ .../etl/service/BasicConfigInfoService.java | 3 + .../muyu/etl/service/StructureService.java | 63 ++++++ .../etl/service/TreeConstructService.java | 63 ++++++ .../impl/BasicConfigInfoServiceImpl.java | 114 +++++++++- .../service/impl/StructureServiceImpl.java | 98 ++++++++ .../impl/TreeConstructServiceImpl.java | 98 ++++++++ .../main/resources/mapper/StructureMapper.xml | 131 +++++++++++ .../resources/mapper/TreeConstructMapper.xml | 81 +++++++ 13 files changed, 1048 insertions(+), 4 deletions(-) create mode 100644 muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/Structure.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/TreeConstruct.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/StructureMapper.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/TreeConstructMapper.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/StructureService.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/TreeConstructService.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/StructureServiceImpl.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/TreeConstructServiceImpl.java create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/StructureMapper.xml create mode 100644 muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/TreeConstructMapper.xml diff --git a/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/Structure.java b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/Structure.java new file mode 100644 index 0000000..c057206 --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/Structure.java @@ -0,0 +1,210 @@ +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.BaseEntity; + +/** + * 结构对象 structure + * + * @author Saisai + * @date 2024-04-22 + */ +public class Structure extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 表id */ + @Excel(name = "表id") + private Long tableId; + + /** 字段名称 */ + @Excel(name = "字段名称") + private String columnName; + + /** 字段注释 */ + @Excel(name = "字段注释") + private String columnRemark; + + /** 是否主键 'Y'是主键 'N'不是主键 */ + @Excel(name = "是否主键 'Y'是主键 'N'不是主键") + private String isPrimary; + + /** 数据类型 */ + @Excel(name = "数据类型") + private String columnType; + + /** 映射类型 */ + @Excel(name = "映射类型") + private String javaType; + + /** 字段长度 */ + @Excel(name = "字段长度") + private String columnLength; + + /** 小数位数 */ + @Excel(name = "小数位数") + private String columnDecimals; + + /** 是否为空 'Y'是 'N'不是 */ + @Excel(name = "是否为空 'Y'是 'N'不是") + private String isNull; + + /** 默认值 */ + @Excel(name = "默认值") + private String defaultValue; + + /** 是否字典 'Y'是 'N'不是 */ + @Excel(name = "是否字典 'Y'是 'N'不是") + private String isDictionary; + + /** 映射字典 */ + @Excel(name = "映射字典") + 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(); + } +} diff --git a/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/TreeConstruct.java b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/TreeConstruct.java new file mode 100644 index 0000000..d5e6de1 --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/TreeConstruct.java @@ -0,0 +1,57 @@ +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(); + } +} diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/controller/BasicConfigInfoController.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/controller/BasicConfigInfoController.java index c858f5a..4211256 100644 --- a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/controller/BasicConfigInfoController.java +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/controller/BasicConfigInfoController.java @@ -106,4 +106,11 @@ public class BasicConfigInfoController extends BaseController public Result connectionTest(@RequestBody BasicConfigInfo basicConfigInfo) throws ServletException { return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo)); } + + @RequiresPermissions("etl:info:test") + @Log(title = "获取成功链接中的") + @GetMapping("/dataConstruct") + public Result> getData(){ + return getDataTable(basicConfigInfoService.getDataByEtl()); + } } diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/StructureMapper.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/StructureMapper.java new file mode 100644 index 0000000..da5f6bd --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/StructureMapper.java @@ -0,0 +1,64 @@ +package com.muyu.etl.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.etl.domain.Structure; +import com.muyu.etl.domain.TreeConstruct; + +/** + * 结构Mapper接口 + * + * @author Saisai + * @date 2024-04-22 + */ +public interface StructureMapper extends BaseMapper +{ + /** + * 查询结构 + * + * @param id 结构主键 + * @return 结构 + */ + public Structure selectStructureById(Long id); + + /** + * 查询结构列表 + * + * @param structure 结构 + * @return 结构集合 + */ + public List selectStructureList(Structure structure); + + /** + * 新增结构 + * + * @param structure 结构 + * @return 结果 + */ + public int insertStructure(Structure structure); + + /** + * 修改结构 + * + * @param structure 结构 + * @return 结果 + */ + public int updateStructure(Structure structure); + + /** + * 删除结构 + * + * @param id 结构主键 + * @return 结果 + */ + public int deleteStructureById(Long id); + + /** + * 批量删除结构 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteStructureByIds(Long[] ids); +} diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/TreeConstructMapper.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/TreeConstructMapper.java new file mode 100644 index 0000000..49fcf14 --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/mapper/TreeConstructMapper.java @@ -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.TreeConstruct; + +/** + * 树级结构Mapper接口 + * + * @author Saisai + * @date 2024-04-22 + */ +public interface TreeConstructMapper extends BaseMapper +{ + /** + * 查询树级结构 + * + * @param id 树级结构主键 + * @return 树级结构 + */ + public TreeConstruct selectTreeConstructById(Long id); + + /** + * 查询树级结构列表 + * + * @param treeConstruct 树级结构 + * @return 树级结构集合 + */ + public List 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); +} diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/BasicConfigInfoService.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/BasicConfigInfoService.java index b4ad37f..44b5a88 100644 --- a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/BasicConfigInfoService.java +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/BasicConfigInfoService.java @@ -1,6 +1,7 @@ package com.muyu.etl.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.etl.domain.BasicConfigInfo; import javax.servlet.ServletException; @@ -63,4 +64,6 @@ public interface BasicConfigInfoService extends IService public int deleteBasicConfigInfoById(Long id); boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException; + + List getDataByEtl(); } diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/StructureService.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/StructureService.java new file mode 100644 index 0000000..8e1ebfc --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/StructureService.java @@ -0,0 +1,63 @@ +package com.muyu.etl.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.etl.domain.Structure; + +import java.util.List; + +/** + * 结构Service接口 + * + * @author Saisai + * @date 2024-04-22 + */ +public interface StructureService extends IService +{ + /** + * 查询结构 + * + * @param id 结构主键 + * @return 结构 + */ + public Structure selectStructureById(Long id); + + /** + * 查询结构列表 + * + * @param structure 结构 + * @return 结构集合 + */ + public List selectStructureList(Structure structure); + + /** + * 新增结构 + * + * @param structure 结构 + * @return 结果 + */ + public int insertStructure(Structure structure); + + /** + * 修改结构 + * + * @param structure 结构 + * @return 结果 + */ + public int updateStructure(Structure structure); + + /** + * 批量删除结构 + * + * @param ids 需要删除的结构主键集合 + * @return 结果 + */ + public int deleteStructureByIds(Long[] ids); + + /** + * 删除结构信息 + * + * @param id 结构主键 + * @return 结果 + */ + public int deleteStructureById(Long id); +} diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/TreeConstructService.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/TreeConstructService.java new file mode 100644 index 0000000..311acaa --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/TreeConstructService.java @@ -0,0 +1,63 @@ +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 +{ + /** + * 查询树级结构 + * + * @param id 树级结构主键 + * @return 树级结构 + */ + public TreeConstruct selectTreeConstructById(Long id); + + /** + * 查询树级结构列表 + * + * @param treeConstruct 树级结构 + * @return 树级结构集合 + */ + public List 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); +} diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java index b418d4e..77030d9 100644 --- a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java @@ -4,15 +4,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.muyu.etl.domain.BasicConfigInfo; import com.muyu.etl.mapper.BasicConfigInfoMapper; import com.muyu.etl.service.BasicConfigInfoService; +import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.ServletException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; +import java.sql.*; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * Service业务层处理 @@ -21,6 +22,7 @@ import java.util.List; * @date 2024-04-20 */ @Service +@Log4j2 public class BasicConfigInfoServiceImpl extends ServiceImpl implements BasicConfigInfoService { @Autowired @@ -119,4 +121,108 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl list = this.list(); + List>> mapList = new ArrayList<>(); + for (BasicConfigInfo info : list) { + //定义下面需要的对象 + String url = "jdbc:" + info.getDatabaseType() + "://" + info.getHost() + ":" + info.getPort() + "/" + info.getDatabaseName() + ""; + String user = info.getUsername(); + String password = info.getPassword(); + Connection conn = null; + try { + conn = DriverManager.getConnection(url, user, password); + DatabaseMetaData metaData = conn.getMetaData(); + ResultSet resultSet = metaData.getCatalogs(); + while (resultSet.next()){ + //库名 + String catalogs = resultSet.getString("TABLE_CAT"); + log.info(catalogs); + // 获取表名 + ResultSet rs = metaData.getTables(catalogs, info.getDatabaseName(), "%", new String[]{"TABLE", "VIEW"}); + try { + ArrayList tableName = new ArrayList<>(); + while (rs.next()) { + tableName.add( rs.getString("TABLE_NAME")); + } + mapList.add(new HashMap<>(){{ + //库名,表名 + put(catalogs,tableName); + }}); + }catch (Exception exception){ + continue; + } +// ResultSet tables = metaData.getTables( +// catalogs, +// info.getDatabaseName(), +// "%", +// new String[]{"TABLE", "VIEW"}); +// while (tables.next()) { +// //表名 +// String tableName = tables.getString("TABLE_NAME"); +// ResultSet rs = metaData.getColumns(catalogs, info.getDatabaseName(), tableName, "%"); +// try { +// while (rs.next()) { +// +// HashMap map = new HashMap<>(); +// // 列明 +// map.put("columnName", rs.getString("COLUMN_NAME")); +// // 列类型 +// map.put("typeName", rs.getString("TYPE_NAME")); +// // 列备注 +// map.put("remarks", rs.getString("REMARKS")); +//// list.add(map); +// //库名 +// System.out.println("TABLE_CAT" + "===" + rs.getString("TABLE_CAT")); +// +// System.out.println("TABLE_SCHEM" + "===" + rs.getString("TABLE_SCHEM")); +// System.out.println("TABLE_NAME" + "===" + rs.getString("TABLE_NAME")); +//// System.out.println("NON_UNIQUE" + "===" + rs.getString("NON_UNIQUE")); +// System.out.println("INDEX_QUALIFIER" + "===" + rs.getString("INDEX_QUALIFIER")); +// System.out.println("INDEX_NAME" + "===" + rs.getString("INDEX_NAME")); +// System.out.println("TYPE" + "===" + rs.getString("TYPE")); +// System.out.println("ORDINAL_POSITION" + "===" + rs.getString("ORDINAL_POSITION")); +// System.out.println("COLUMN_NAME" + "===" + rs.getString("COLUMN_NAME")); +// System.out.println("ASC_OR_DESC" + "===" + rs.getString("ASC_OR_DESC")); +// System.out.println("CARDINALITY" + "===" + rs.getString("CARDINALITY")); +// System.out.println("PAGES" + "===" + rs.getString("PAGES")); +// System.out.println("FILTER_CONDITION" + "===" + rs.getString("FILTER_CONDITION")); +// +// } +// }catch (Exception e){ +// log.error(e.getMessage()); +// continue; +// } +// } + } + } catch (Exception e){ + log.error(e.getMessage()); + continue; + } + } + return mapList; + } } diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/StructureServiceImpl.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/StructureServiceImpl.java new file mode 100644 index 0000000..2d52f89 --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/StructureServiceImpl.java @@ -0,0 +1,98 @@ +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.Structure; +import com.muyu.etl.mapper.StructureMapper; +import com.muyu.etl.service.StructureService; +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 StructureServiceImpl extends ServiceImpl implements StructureService +{ + @Autowired + private StructureMapper structureMapper; + + /** + * 查询结构 + * + * @param id 结构主键 + * @return 结构 + */ + @Override + public Structure selectStructureById(Long id) + { + return structureMapper.selectStructureById(id); + } + + /** + * 查询结构列表 + * + * @param structure 结构 + * @return 结构 + */ + @Override + public List selectStructureList(Structure structure) + { + return structureMapper.selectStructureList(structure); + } + + /** + * 新增结构 + * + * @param structure 结构 + * @return 结果 + */ + @Override + public int insertStructure(Structure structure) + { + structure.setCreateTime(DateUtils.getNowDate()); + return structureMapper.insertStructure(structure); + } + + /** + * 修改结构 + * + * @param structure 结构 + * @return 结果 + */ + @Override + public int updateStructure(Structure structure) + { + structure.setUpdateTime(DateUtils.getNowDate()); + return structureMapper.updateStructure(structure); + } + + /** + * 批量删除结构 + * + * @param ids 需要删除的结构主键 + * @return 结果 + */ + @Override + public int deleteStructureByIds(Long[] ids) + { + return structureMapper.deleteStructureByIds(ids); + } + + /** + * 删除结构信息 + * + * @param id 结构主键 + * @return 结果 + */ + @Override + public int deleteStructureById(Long id) + { + return structureMapper.deleteStructureById(id); + } +} diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/TreeConstructServiceImpl.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/TreeConstructServiceImpl.java new file mode 100644 index 0000000..f29a5ac --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/TreeConstructServiceImpl.java @@ -0,0 +1,98 @@ +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 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 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); + } +} diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/StructureMapper.xml b/muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/StructureMapper.xml new file mode 100644 index 0000000..d9180be --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/StructureMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, table_id, column_name, column_remark, is_primary, column_type, java_type, column_length, column_decimals, is_null, default_value, is_dictionary, dictionary_table, remark, create_by, create_time, update_by, update_time from structure + + + + + + + + insert into structure + + table_id, + column_name, + column_remark, + is_primary, + column_type, + java_type, + column_length, + column_decimals, + is_null, + default_value, + is_dictionary, + dictionary_table, + remark, + create_by, + create_time, + update_by, + update_time, + + + #{tableId}, + #{columnName}, + #{columnRemark}, + #{isPrimary}, + #{columnType}, + #{javaType}, + #{columnLength}, + #{columnDecimals}, + #{isNull}, + #{defaultValue}, + #{isDictionary}, + #{dictionaryTable}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update structure + + table_id = #{tableId}, + column_name = #{columnName}, + column_remark = #{columnRemark}, + is_primary = #{isPrimary}, + column_type = #{columnType}, + java_type = #{javaType}, + column_length = #{columnLength}, + column_decimals = #{columnDecimals}, + is_null = #{isNull}, + default_value = #{defaultValue}, + is_dictionary = #{isDictionary}, + dictionary_table = #{dictionaryTable}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from structure where id = #{id} + + + + delete from structure where id in + + #{id} + + + diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/TreeConstructMapper.xml b/muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/TreeConstructMapper.xml new file mode 100644 index 0000000..bc072ae --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/resources/mapper/TreeConstructMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + select id, name, parent_id, remark, create_by, create_time, update_by, update_time from tree_construct + + + + + + + + insert into tree_construct + + name, + parent_id, + remark, + create_by, + create_time, + update_by, + update_time, + + + #{name}, + #{parentId}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update tree_construct + + name = #{name}, + parent_id = #{parentId}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from tree_construct where id = #{id} + + + + delete from tree_construct where id in + + #{id} + + +