重构项目2

master
xiaohuang 2024-05-11 21:00:38 +08:00
parent c61947614a
commit d7fd3e9135
14 changed files with 820 additions and 39 deletions

View File

@ -0,0 +1,53 @@
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.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* AssetDataDict
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class AssetDataDict extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* id
*/
@Excel(name = "数据接入id")
private Long basicId;
/**
*
*/
@Excel(name = "字典名称")
private String dictName;
/**
*
*/
@Excel(name = "字典类型")
private String dictType;
}

View File

@ -0,0 +1,66 @@
package com.muyu.etl.domain;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* AssetImpower
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class AssetImpower extends BaseEntity {
private static final long serialVersionUID =1L;
/**
*
*/
private Long id;
/**
* id
*/
@Excel(name = "表id")
private Long tableId;
/**
* id
*/
@Excel(name = "部门id")
private Long deptId;
/**
* id
*/
@Excel(name = "接入id")
private Long basicId;
/**
* id
*/
@Excel(name = "用户id")
private Long userId;
public static AssetImpower saveAssetImpower(Long deptId, Long userId, AssetImpower assetImpower){
return AssetImpower.builder()
.basicId(assetImpower.getBasicId())
.tableId(assetImpower.getTableId())
.deptId(deptId)
.userId(userId)
.build();
}
}

View File

@ -0,0 +1,61 @@
package com.muyu.etl.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* DictInfo
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class DictInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* id
*/
@Excel(name = "字典id")
private Long dictId;
/**
*
*/
@Excel(name = "字典名称")
private String infoName;
/**
*
*/
@Excel(name = "字典类型")
private String infoValue;
@JsonProperty("isEdit")
private boolean isEdit;
}

View File

@ -0,0 +1,118 @@
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.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* Structure
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class Structure extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
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 = "是否为空 '是' 'N'不是")
private String isNull;
/**
*
*/
@Excel(name = "默认值")
private String defaultValue;
/**
* 'Y' 'N'
*/
@Excel(name = "是否字典 'Y'是 'N'不是")
private String isDictionary;
/**
*
*/
@Excel(name = "映射字典")
private String dictionaryTable;
}

View File

@ -0,0 +1,74 @@
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.web.domain.TreeEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* TableInfo
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class TableInfo extends TreeEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* //
*/
@Excel(name = "表名称/数据库")
private String tableName;
/**
*
*/
@Excel(name = "表备注")
private String tableRemark;
/**
*
*/
@Excel(name = "数据来源类型")
private String type;
/**
*
*/
@Excel(name = "数据量")
private Long dataNum;
/**
* 'Y' 'N'
*/
@Excel(name = "是否核心 'Y'是 'N'不是")
private String center;
private Long parentId;
}

View File

@ -0,0 +1,59 @@
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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* AssetImpowerReq
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class AssetImpowerReq {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* id
*/
@Excel(name = "表id")
private Long tableId;
/**
* id
*/
@Excel(name = "接入id")
private Long basicId;
/**
* Id
*/
@Excel(name = "部门id")
private Long doptId;
/**
* id
*/
@Excel(name = "用户id")
private Long userId;
}

View File

@ -0,0 +1,105 @@
package com.muyu.etl.domain.resp;
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 java.util.Date;
/**
* BasicConfigResp
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class BasicConfigResp {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
*
*/
private String dataResourceName;
/**
*
*/
private String dataSourcesSystemName;
/**
* ip
*/
private String host;
/**
*
*/
private String port;
/**
*
*/
private String databaseType;
/**
*
*/
private String databaseName;
/**
*
*/
private Long initLinkNum;
/**
*
*/
private Long maxLinkNum;
/**
*
*/
private Long maxWaitTime;
/**
*
*/
private Long maxWaitTimes;
/**
*
*/
private String connectionParams;
private String remark;
private String createBy;
private String updateBy;
private Date createTime;
private Date updateTime;
}

View File

@ -0,0 +1,49 @@
package com.muyu.etl.domain.resp;
import com.muyu.etl.domain.DictInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* BasicDictResp
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class BasicDictResp {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
/**
* id
*/
private Long basicId;
/**
*
*/
private String dictName;
/**
*
*/
private String dictType;
private List<DictInfo> dictInfoList;
}

View File

@ -0,0 +1,68 @@
package com.muyu.etl.domain.resp;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* --() BasicTableInfoResp
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class BasicTableInfoResp {
/**
* id
*/
private Long id;
/**
* id
*/
private Long basicId;
/**
*
*/
private String dataResourceName;
/**
*
*/
private String dataSourcesSystemName;
/**
*
*/
private String databaseName;
/**
* (
*/
private String tableRemark;
/**
* (
*/
private String tableName;
/**
*
*/
private Long tatalNum;
}

View File

@ -0,0 +1,72 @@
package com.muyu.etl.domain.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.muyu.common.core.annotation.Excel;
import com.muyu.etl.domain.Structure;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* TableInfoStructureResp
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@NoArgsConstructor
@SuperBuilder
@AllArgsConstructor
public class TableInfoStructureResp {
public 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;
private Long parentId;
/**
*
*/
@Excel(name = "数据量")
private Long dataNum;
/**
* 'Y' 'N'
*/
@Excel(name = "是否核心 'Y'是 'N'不是 ")
private String center;
private String databaseType;
private List<Structure> structureList;
}

View File

@ -0,0 +1,48 @@
package com.muyu.etl.domain.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.muyu.etl.domain.BasicConfigInfo;
import com.muyu.etl.domain.TableInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* TableTreeResp
*
* @author xiaohuang
* on 2024/5/11
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class TableTreeResp {
@TableId(value = "id",type = IdType.AUTO)
private Long Id;
/**
*
*/
private TableInfo tableInfo;
/**
*
*/
private BasicConfigInfo basicConfigInfo;
/**
*
*/
private List<TableInfoStructureResp> Children;
}

View File

@ -8,6 +8,7 @@ import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.etl.domain.BasicConfigInfo;
import com.muyu.etl.domain.resp.TableTreeResp;
import com.muyu.etl.service.BasicConfigInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,7 +29,7 @@ import java.util.List;
public class BasicConfigInfoController extends BaseController {
@Autowired
private BasicConfigInfoService service;
private BasicConfigInfoService basicConfigInfoService;
/**
@ -36,30 +37,22 @@ public class BasicConfigInfoController extends BaseController {
*/
@RequiresPermissions("etl:info:list")
@GetMapping("/list")
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo){
startPage();;
List<BasicConfigInfo> list = service.selectBasicConfigInfoList(basicConfigInfo);
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo) {
startPage();
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("etl:info:export")
@Log(title = "基础信息",businessType = BusinessType.EXPORT)
@Log(title = "基础信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
//数据接入到basicConfigInfo
public void export(HttpServletResponse response,BasicConfigInfo basicConfigInfo){
//数据接入后查询列表
List<BasicConfigInfo> list = service.selectBasicConfigInfoList(basicConfigInfo);
//new一个excelUtil 接入到basicConfigInfo
public void export(HttpServletResponse response, BasicConfigInfo basicConfigInfo) {
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
ExcelUtil<BasicConfigInfo> util = new ExcelUtil<>(BasicConfigInfo.class);
//可以导出到表单
util.exportExcel(response,list,"基础信息数据");
util.exportExcel(response, list, "基础信息数据");
}
/**
@ -67,55 +60,60 @@ public class BasicConfigInfoController extends BaseController {
*/
@RequiresPermissions("etl:info:query")
@GetMapping(value = "/{id}")
//响应信息主体
public Result getInfo(@PathVariable("id") Long id){
//返回成功消息
return success(service.selectBasicConfigInfoById(id));
public Result getInfo(@PathVariable("id") Long id) {
return success(basicConfigInfoService.selectBasicConfigInfoById(id));
}
/**
*
*/
@RequiresPermissions("etl:info:add")
@Log(title = "基础信息",businessType = BusinessType.INSERT)
@Log(title = "基础信息", businessType = BusinessType.INSERT)
@PostMapping
//数据接入到basicConfigInfo
public Result add(@RequestBody BasicConfigInfo configQueryReq){
//响应返回结果
return toAjax(service.insertBasicConfigInfo(configQueryReq));
public Result add(@RequestBody BasicConfigInfo configQueryReq) {
return toAjax(basicConfigInfoService.insertBasicConfigInfo(configQueryReq));
}
/**
*
*/
@RequiresPermissions("etl:info:edit")
@Log(title = "基础信息",businessType = BusinessType.UPDATE)
@PostMapping
//数据接入basicConfigInfo
public Result edit(@RequestBody BasicConfigInfo configQueryReq){
//响应返回结果
return toAjax(service.updateBasicConfigInfo(configQueryReq));
@Log(title = "基础信息", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody BasicConfigInfo basicConfigInfo) {
return toAjax(basicConfigInfoService.updateBasicConfigInfo(basicConfigInfo));
}
/**
*
*/
@RequiresPermissions("etl:info:remove")
@Log(title = "基础信息",businessType = BusinessType.DELETE)
@Log(title = "基础信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids){
return toAjax(service.deleteBasicConfigInfoByIds(ids));
public Result remove(@PathVariable Long[] ids) {
return toAjax(basicConfigInfoService.deleteBasicConfigInfoByIds(ids));
}
/**
*
*/
@RequiresPermissions("etl:info:test")
@Log(title = "测试连接")
@PostMapping("/connectionTest")
public Result connectionTest(@RequestBody BasicConfigInfo basicConfigInfo) throws ServletException {
return toAjax(service.connectionTest(basicConfigInfo));
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
}
/**
*
*/
@RequiresPermissions("etl:table:list")
@Log(title = "获取已成功链接的树级结构")
@GetMapping("/getTableTree")
public Result<List<TableTreeResp>> getTableTree(){
return Result.success(basicConfigInfoService.getTableTree());
}
}

View File

@ -2,6 +2,7 @@ package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.domain.BasicConfigInfo;
import com.muyu.etl.domain.resp.TableTreeResp;
import javax.servlet.ServletException;
import javax.sql.rowset.serial.SerialException;
@ -32,4 +33,5 @@ public interface BasicConfigInfoService extends IService<BasicConfigInfo> {
boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException;
List<TableTreeResp> getTableTree();
}

View File

@ -3,6 +3,7 @@ package com.muyu.etl.service.impl;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.etl.domain.BasicConfigInfo;
import com.muyu.etl.domain.resp.TableTreeResp;
import com.muyu.etl.mapper.BasicConfigInfoMapper;
import com.muyu.etl.service.BasicConfigInfoService;
import lombok.extern.log4j.Log4j2;
@ -92,6 +93,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
//树级结构 库 表
} catch (SQLException e) {
throw new RuntimeException(e);
}
@ -100,5 +102,11 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
return true;
}
@Override
public List<TableTreeResp> getTableTree() {
}
}