重构项目5

master
xiaohuang 2024-05-13 22:37:57 +08:00
parent d1e233042d
commit e36668152d
28 changed files with 1499 additions and 484 deletions

View File

@ -3,12 +3,16 @@ package com.muyu.common.system.remote;
import com.muyu.common.core.constant.SecurityConstants;
import com.muyu.common.core.constant.ServiceNameConstants;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.system.domain.SysDept;
import com.muyu.common.system.domain.SysUser;
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
import com.muyu.common.system.domain.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
@ -37,4 +41,24 @@ public interface RemoteUserService {
*/
@PostMapping("/user/register")
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
*
* @param user
* @return
*/
@PostMapping("/user/list")
public Result<List<SysUser>> list (@RequestBody SysUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
*
* @param deptId
* @return
*/
@PostMapping(value = "/dept/{deptId}")
public Result<SysDept> getInfo (@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping(value = "/dept/list")
Result<List<SysDept>> list(@RequestBody SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

View File

@ -10,109 +10,70 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* Structure
* structure
*
* @author xiaohuang
* on 2024/5/11
* @author Saisai
* @date 2024-04-22
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class Structure extends BaseEntity {
public class Structure extends BaseEntity
{
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
/** 主键 */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* id
*/
/** 表id */
@Excel(name = "表id")
private Long tableId;
/**
*
*/
/** 字段名称 */
@Excel(name = "字段名称")
private String columnName;
/**
*
*/
/** 字段注释 */
@Excel(name = "字段注释")
private String columnRemark;
/**
* 'Y' 'N'
*/
/** 是否主键 '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'不是")
/** 是否为空 'Y'是 'N'不是 */
@Excel(name = "是否为空 'Y'是 'N'不是")
private String isNull;
/**
*
*/
/** 默认值 */
@Excel(name = "默认值")
private String defaultValue;
/**
* 'Y' 'N'
*/
/** 是否字典 'Y'是 'N'不是 */
@Excel(name = "是否字典 'Y'是 'N'不是")
private String isDictionary;
/**
*
*/
/** 映射字典 */
@Excel(name = "映射字典")
private String dictionaryTable;
}

View File

@ -9,46 +9,42 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* AssetImpowerReq
*
* @author xiaohuang
* on 2024/5/11
* @ClassName AssetImpowerReq
* @Description
* @Author SaiSai.Liu
* @Date 2024/4/29 14:04
*/
@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
* id
*/
@Excel(name = "部门id")
private Long doptId;
private Long deptId;
/**
* id

View File

@ -11,102 +11,66 @@ import lombok.experimental.SuperBuilder;
import java.util.Date;
/**
* BasicConfigQueryReq
*
* @author xiaohuang
* on 2024/5/8
* @ClassName BasicQueryReq
* @Description
* @Author SaiSai.Liu
* @Date 2024/4/21 10:42
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class BasicConfigQueryReq {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
/** 主键 */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
/** 接入源名称 */
@Excel(name = "接入源名称")
private String dataResourceName;
/**
*
*/
/** 数据来源系统名称 */
@Excel(name = "数据来源系统名称")
private String dataSourcesSystemName;
/**
* ip
*/
/** 主机ip地址 */
@Excel(name = "主机ip地址")
private String host;
/**
*
*/
/** 端口 */
@Excel(name = "端口")
private String port;
/**
*
*/
/** 数据接入类型 */
@Excel(name = "数据接入类型")
private String databaseType;
/**
*
*/
/** 数据库名称 */
@Excel(name = "数据库名称")
private String databaseName;
/**
*
*/
/** 初始化连接数量 */
@Excel(name = "初始化连接数量")
private Long initLinkNum;
/**
*
*/
/** 最大连接数量 */
@Excel(name = "最大连接数量")
private Long maxLinkNum;
/**
*
*/
/** 最大等待时间 */
@Excel(name = "最大等待时间")
private Long maxWaitTime;
/**
*
*/
/** 最大等待次数 */
@Excel(name = "最大等待次数")
private Long maxWaitTimes;
private String connectionParams;
private String createBy;
private String updateBy;
private Date createTime;
private Date updateTime;
}

View File

@ -9,97 +9,60 @@ import lombok.experimental.SuperBuilder;
import java.util.Date;
/**
* BasicConfigResp
*
* @author xiaohuang
* on 2024/5/11
*/
/**
*
* @ClassName BasicConfigResp
* @Description
* @Author SaiSai.Liu
* @Date 2024/4/21 10:45
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class BasicConfigResp {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
/** 接入源名称 */
private String dataResourceName;
/**
*
*/
/** 数据来源系统名称 */
private String dataSourcesSystemName;
/**
* ip
*/
/** 主机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

@ -6,63 +6,58 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* --() BasicTableInfoResp
* --
*
* @author xiaohuang
* on 2024/5/11
* @ClassName BasicTableInfoResp
* @Description
* @Author SaiSai.Liu
* @Date 2024/4/30 11:58
*/
@Data
@SuperBuilder
@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;
private Long totalNum;
}

View File

@ -12,61 +12,49 @@ import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* TableInfoStructureResp
* table_info
*
* @author xiaohuang
* on 2024/5/11
* @author Saisai
* @date 2024-04-22
*/
@Data
@NoArgsConstructor
@SuperBuilder
@AllArgsConstructor
public class TableInfoStructureResp {
@SuperBuilder
public class TableInfoStructureResp
{
private static final long serialVersionUID = 1L;
public static final long serialVersionUID = 1L;
/** 主键 */
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
@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;
/** 表备注 */
@Excel(name = "数据来源类型")
private String type;
/**
* 'Y' 'N'
*/
@Excel(name = "是否核心 'Y'是 'N'不是 ")
/** 是否核心 'Y'是 'N'不是 */
@Excel(name = "是否核心 'Y'是 'N'不是")
private String center;
private String databaseType;
private List<Structure> structureList;
}

View File

@ -12,37 +12,29 @@ import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* TableTreeResp
*
* @author xiaohuang
* on 2024/5/11
*
* @ClassName TableTreeResp
* @Description
* @Author SaiSai.Liu
* @Date 2024/4/23 8:59
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class TableTreeResp {
@TableId(value = "id",type = IdType.AUTO)
private Long Id;
/**
*
*/
private TableInfo tableInfo;
/**
*
*/
private BasicConfigInfo basicConfigInfo;
/**
*
*/
private List<TableInfoStructureResp> Children;
}

View File

@ -1,31 +0,0 @@
package com.muyu.etl.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.etl.domain.AssetImpower;
import com.muyu.etl.domain.TableInfo;
import com.muyu.etl.service.AssetImpowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* AssetImpowerController
*
* @author xiaohuang
* on 2024/5/12
*/
@RestController
@RequestMapping("/impower")
public class AssetImpowerController extends BaseController {
@Autowired
private AssetImpowerService assetImpowerService;
}

View File

@ -23,19 +23,14 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* BasicConfigInfoController
* Controller
*
* @author xiaohuang
* on 2024/5/9
* @author muyu
* @date 2024-04-21
*/
@RestController
@RequestMapping("/info")
public class BasicConfigInfoController extends BaseController {
@Autowired
private BasicConfigInfoService basicConfigInfoService;
@Autowired
private BasicConfigInfoService basicConfigInfoService;
@Autowired
@ -119,6 +114,16 @@ public class BasicConfigInfoController extends BaseController {
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
}
// /**
// * 获取成功链接中的
// * @return
// */
// @RequiresPermissions("etl:info:test")
// @Log(title = "获取成功链接中的")
// @GetMapping("/dataConstruct")
// public Result<TableDataInfo<List>> getData() {
// return getDataTable(basicConfigInfoService.getDataByEtl());
// }
/**
*
@ -156,7 +161,8 @@ public class BasicConfigInfoController extends BaseController {
@GetMapping("/getTableInfo/{tableId}")
public Result<TableInfoStructureResp>
getTableInfo(@PathVariable Long tableId) {
return Result.success(basicConfigInfoService.getTableInfo(tableId));
return Result.success
(basicConfigInfoService.getTableInfo(tableId));
}
/**
@ -195,7 +201,8 @@ public class BasicConfigInfoController extends BaseController {
@GetMapping("/getBasicTableInfo/{tableId}")
public Result getBasicTableInfo(@PathVariable Long tableId)
throws ServletException {
return Result.success(basicConfigInfoService.getBasicTableInfo(tableId));
return Result.success(basicConfigInfoService
.getBasicTableInfo(tableId));
}
/**
@ -209,6 +216,8 @@ public class BasicConfigInfoController extends BaseController {
public Result updateStructureInfo
(@RequestBody Structure structure) {
return Result.success(structureService.updateStructureInfoDict(structure), "修改成功");
}
}

View File

@ -0,0 +1,63 @@
package com.muyu.etl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.AssetDataDict;
import java.util.List;
/**
* Mapper
*
* @author Saisai
* @date 2024-04-24
*/
public interface AssetDataDictMapper extends BaseMapper<AssetDataDict>
{
/**
*
*
* @param id
* @return
*/
public AssetDataDict selectAssetDataDictById(Long id);
/**
*
*
* @param assetDataDict
* @return
*/
public List<AssetDataDict> selectAssetDataDictList(AssetDataDict assetDataDict);
/**
*
*
* @param assetDataDict
* @return
*/
public int insertAssetDataDict(AssetDataDict assetDataDict);
/**
*
*
* @param assetDataDict
* @return
*/
public int updateAssetDataDict(AssetDataDict assetDataDict);
/**
*
*
* @param id
* @return
*/
public int deleteAssetDataDictById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAssetDataDictByIds(Long[] ids);
}

View File

@ -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.AssetImpower;
/**
* Mapper
*
* @author Saisai
* @date 2024-04-28
*/
public interface AssetImpowerMapper extends BaseMapper<AssetImpower>
{
/**
*
*
* @param id
* @return
*/
public AssetImpower selectAssetImpowerById(Long id);
/**
*
*
* @param assetImpower
* @return
*/
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower);
/**
*
*
* @param assetImpower
* @return
*/
public int insertAssetImpower(AssetImpower assetImpower);
/**
*
*
* @param assetImpower
* @return
*/
public int updateAssetImpower(AssetImpower assetImpower);
/**
*
*
* @param id
* @return
*/
public int deleteAssetImpowerById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAssetImpowerByIds(Long[] ids);
}

View File

@ -2,36 +2,62 @@ package com.muyu.etl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.BasicConfigInfo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* mapper BasicConfigInfoMapper
* Mapper
*
* @author xiaohuang
* on 2024/5/9
* @author muyu
* @date 2024-04-20
*/
public interface BasicConfigInfoMapper extends BaseMapper<BasicConfigInfo> {
public interface BasicConfigInfoMapper extends BaseMapper<BasicConfigInfo>
{
/**
*
*
* @param id
* @return
*/
public BasicConfigInfo selectBasicConfigInfoById(Long id);
/**
*
*
* @param basicConfigInfo
* @return
* @return
*/
List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
/**
*
* @param id
* @return
*
*
* @param basicConfigInfo
* @return
*/
BasicConfigInfo selectBasicConfigInfoById(Long id);
public int insertBasicConfigInfo(BasicConfigInfo basicConfigInfo);
int insertBasicConfigInfo(BasicConfigInfo configQueryReq);
/**
*
*
* @param basicConfigInfo
* @return
*/
public int updateBasicConfigInfo(BasicConfigInfo basicConfigInfo);
int updateBasicConfigInfo(BasicConfigInfo configQueryReq);
/**
*
*
* @param id
* @return
*/
public int deleteBasicConfigInfoById(Long id);
int deleteBasicConfigInfoByIds(Long[] ids);
/**
*
*
* @param ids
* @return
*/
public int deleteBasicConfigInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.muyu.etl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.DictInfo;
import java.util.List;
/**
* Mapper
*
* @author Saisai
* @date 2024-04-24
*/
public interface DictInfoMapper extends BaseMapper<DictInfo>
{
/**
*
*
* @param id
* @return
*/
public DictInfo selectDictInfoById(Long id);
/**
*
*
* @param dictInfo
* @return
*/
public List<DictInfo> selectDictInfoList(DictInfo dictInfo);
/**
*
*
* @param dictInfo
* @return
*/
public int insertDictInfo(DictInfo dictInfo);
/**
*
*
* @param dictInfo
* @return
*/
public int updateDictInfo(DictInfo dictInfo);
/**
*
*
* @param id
* @return
*/
public int deleteDictInfoById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteDictInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.muyu.etl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.Structure;
import java.util.List;
/**
* Mapper
*
* @author Saisai
* @date 2024-04-22
*/
public interface StructureMapper extends BaseMapper<Structure>
{
/**
*
*
* @param id
* @return
*/
public Structure selectStructureById(Long id);
/**
*
*
* @param structure
* @return
*/
public List<Structure> 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);
}

View File

@ -0,0 +1,66 @@
package com.muyu.etl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.TableInfo;
import java.util.List;
/**
* 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);
TableInfo selectTableInfoByName(TableInfo table);
}

View File

@ -1,19 +1,68 @@
package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.domain.AssetDataDict;
import com.muyu.etl.domain.resp.BasicDictResp;
import javax.servlet.ServletException;
import java.util.List;
/**
* AssetDataDictService
* Service
*
* @author xiaohuang
* on 2024/5/12
* @author Saisai
* @date 2024-04-24
*/
public interface AssetDataDictService {
public interface AssetDataDictService extends IService<AssetDataDict>
{
/**
*
*
* @param id
* @return
*/
public AssetDataDict selectAssetDataDictById(Long id);
/**
*
*
* @param assetDataDict
* @return
*/
public List<AssetDataDict> selectAssetDataDictList(AssetDataDict assetDataDict);
/**
*
*
* @param assetDataDict
* @return
*/
public boolean insertAssetDataDict(AssetDataDict assetDataDict) throws ServletException;
/**
*
*
* @param assetDataDict
* @return
*/
public int updateAssetDataDict(AssetDataDict assetDataDict);
/**
*
*
* @param ids
* @return
*/
public int deleteAssetDataDictByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAssetDataDictById(Long id);
List<BasicDictResp> getDict(Long basicId);
Object insertAssetDataDict(AssetDataDict assetDataDict);
}

View File

@ -1,10 +1,65 @@
package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.domain.AssetImpower;
import java.util.List;
/**
* AssetImpowerService
* Service
*
* @author xiaohuang
* on 2024/5/12
* @author Saisai
* @date 2024-04-28
*/
public interface AssetImpowerService {
public interface AssetImpowerService extends IService<AssetImpower>
{
/**
*
*
* @param id
* @return
*/
public AssetImpower selectAssetImpowerById(Long id);
/**
*
*
* @param assetImpower
* @return
*/
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower);
/**
*
*
* @param assetImpower
* @return
*/
public int insertAssetImpower(AssetImpower assetImpower);
/**
*
*
* @param assetImpower
* @return
*/
public int updateAssetImpower(AssetImpower assetImpower);
/**
*
*
* @param ids
* @return
*/
public int deleteAssetImpowerByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAssetImpowerById(Long id);
List<AssetImpower> getPowerByTableId(Long tableId);
}

View File

@ -2,41 +2,76 @@ package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.domain.BasicConfigInfo;
import com.muyu.etl.domain.resp.BasicTableInfoResp;
import com.muyu.etl.domain.resp.TableInfoStructureResp;
import com.muyu.etl.domain.resp.TableTreeResp;
import javax.servlet.ServletException;
import javax.sql.rowset.serial.SerialException;
import java.util.List;
/**
* service BasicConfigInfoService
* Service
*
* @author xiaohuang
* on 2024/5/9
* @author muyu
* @date 2024-04-20
*/
public interface BasicConfigInfoService extends IService<BasicConfigInfo> {
public interface BasicConfigInfoService extends IService<BasicConfigInfo>
{
/**
*
*
* @param id
* @return
*/
public BasicConfigInfo selectBasicConfigInfoById(Long id);
/**
*
*
* @param basicConfigInfo
* @return
* @return
*/
List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
BasicConfigInfo selectBasicConfigInfoById(Long id);
/**
*
*
* @param configQueryReq
* @return
*/
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq);
int insertBasicConfigInfo(BasicConfigInfo configQueryReq);
/**
*
*
* @param basicConfigInfo
* @return
*/
public int updateBasicConfigInfo(BasicConfigInfo basicConfigInfo);
int updateBasicConfigInfo(BasicConfigInfo configQueryReq);
/**
*
*
* @param ids
* @return
*/
public int deleteBasicConfigInfoByIds(Long[] ids);
int deleteBasicConfigInfoByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteBasicConfigInfoById(Long id);
boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException;
// List getDataByEtl();
List<TableTreeResp> getTableTree();
TableInfoStructureResp getTableInfo(Long tableId);
Object getBasicTableInfo(Long tableId);
BasicTableInfoResp getBasicTableInfo(Long tableId);
}

View File

@ -1,13 +1,64 @@
package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.domain.DictInfo;
import javax.servlet.ServletException;
import java.util.List;
/**
* DictInfoService
* Service
*
* @author xiaohuang
* on 2024/5/12
* @author Saisai
* @date 2024-04-24
*/
public interface DictInfoService {
Object insertDictInfo(DictInfo dictInfo);
public interface DictInfoService extends IService<DictInfo>
{
/**
*
*
* @param id
* @return
*/
public DictInfo selectDictInfoById(Long id);
/**
*
*
* @param dictInfo
* @return
*/
public List<DictInfo> selectDictInfoList(DictInfo dictInfo);
/**
*
*
* @param dictInfo
* @return
*/
public boolean insertDictInfo(DictInfo dictInfo) throws ServletException;
/**
*
*
* @param dictInfo
* @return
*/
public int updateDictInfo(DictInfo dictInfo);
/**
*
*
* @param ids
* @return
*/
public int deleteDictInfoByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteDictInfoById(Long id);
}

View File

@ -6,48 +6,60 @@ import com.muyu.etl.domain.Structure;
import java.util.List;
/**
* StructureService
* Service
*
* @author xiaohuang
* on 2024/5/12
* @author Saisai
* @date 2024-04-22
*/
public interface StructureService extends IService<Structure> {
public interface StructureService extends IService<Structure>
{
/**
*
*
* @param id
* @return
*/
public Structure selectStructureById(Long id);
/**
*
*
* @param structure
* @return
*/
public List<Structure> 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);
boolean updateStructureInfoDict(Structure structure);
}

View File

@ -6,47 +6,61 @@ import com.muyu.etl.domain.TableInfo;
import java.util.List;
/**
* TableInfoService
* Service
*
* @author xiaohuang
* on 2024/5/12
* @author Saisai
* @date 2024-04-22
*/
public interface TableInfoService extends IService<TableInfo> {
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);
TableInfo selectTableInfoByName(TableInfo build);
}

View File

@ -0,0 +1,136 @@
package com.muyu.etl.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.etl.domain.AssetDataDict;
import com.muyu.etl.domain.DictInfo;
import com.muyu.etl.domain.resp.BasicDictResp;
import com.muyu.etl.mapper.AssetDataDictMapper;
import com.muyu.etl.service.AssetDataDictService;
import com.muyu.etl.service.DictInfoService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletException;
import java.util.List;
import java.util.stream.Collectors;
/**
* AssetDataDictServiceImpl
*
* @author xiaohuang
* on 2024/5/13
*/
@Service
@Log4j2
public class AssetDataDictServiceImpl extends ServiceImpl<AssetDataDictMapper, AssetDataDict> implements AssetDataDictService {
@Autowired
private AssetDataDictMapper assetDataDictMapper;
@Autowired
private DictInfoService dictInfoService;
/**
*
* @param id
* @return
*/
@Override
public AssetDataDict selectAssetDataDictById(Long id) {
return assetDataDictMapper.selectAssetDataDictById(id);
}
//查询资产数据字典列表
@Override
public List<AssetDataDict> selectAssetDataDictList(AssetDataDict assetDataDict) {
return assetDataDictMapper.selectAssetDataDictList(assetDataDict);
}
/**
*
* @param assetDataDict
* @return
* @throws ServletException
*/
@Override
public boolean insertAssetDataDict(AssetDataDict assetDataDict) throws ServletException {
assetDataDict.setCreateTime(DateUtils.getNowDate());
AssetDataDict one = this.getOne(new LambdaUpdateWrapper<>(AssetDataDict.class){{
eq(AssetDataDict::getDictType,assetDataDict.getDictType());
eq(AssetDataDict::getBasicId,assetDataDict.getBasicId());
}});
if (one!=null){
throw new ServletException("该字典已存在");
}
return this.saveOrUpdate(assetDataDict,new LambdaUpdateWrapper<>(AssetDataDict.class){{
eq(AssetDataDict::getDictType,assetDataDict.getDictType());
eq(AssetDataDict::getBasicId,assetDataDict.getBasicId());
}});
}
/**
*
* @param assetDataDict
* @return
*/
@Override
public int updateAssetDataDict(AssetDataDict assetDataDict) {
assetDataDict.setUpdateTime(DateUtils.getNowDate());
return assetDataDictMapper.updateAssetDataDict(assetDataDict);
}
/**
*
* @param ids
* @return
*/
@Override
public int deleteAssetDataDictByIds(Long[] ids) {
return assetDataDictMapper.deleteAssetDataDictByIds(ids);
}
/**
*
* @param id
* @return
*/
@Override
public int deleteAssetDataDictById(Long id) {
return assetDataDictMapper.deleteAssetDataDictById(id);
}
@Override
public List<BasicDictResp> getDict(Long basicId) {
List<AssetDataDict> list = this.list(new LambdaUpdateWrapper<AssetDataDict>(){{
eq(AssetDataDict :: getBasicId, basicId);
or(assetDataDictLambdaUpdateWrapper -> assetDataDictLambdaUpdateWrapper.eq(AssetDataDict::getId, 1L));
}});
List<BasicDictResp> collect = list.stream().map(assetDataDict -> {
List<DictInfo> dictInfoList = dictInfoService.list(
new LambdaUpdateWrapper<DictInfo>()
.eq(DictInfo::getDictId,assetDataDict.getId())
);
return BasicDictResp.builder()
.id(assetDataDict.getId())
.dictType(assetDataDict.getDictType())
.dictName(assetDataDict.getDictName())
.dictInfoList(dictInfoList)
.basicId(assetDataDict.getBasicId())
.build();
}).collect(Collectors.toList());
return collect;
}
}

View File

@ -0,0 +1,96 @@
package com.muyu.etl.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.constant.SecurityConstants;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.system.domain.SysDept;
import com.muyu.common.system.remote.RemoteFileService;
import com.muyu.common.system.remote.RemoteUserService;
import com.muyu.etl.domain.AssetImpower;
import com.muyu.etl.mapper.AssetImpowerMapper;
import com.muyu.etl.service.AssetImpowerService;
import com.muyu.etl.service.TableInfoService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* AssetImpowerServiceImpl
*
* @author xiaohuang
* on 2024/5/13
*/
@Service
@Log4j2
public class AssetImpowerServiceImpl extends ServiceImpl<AssetImpowerMapper, AssetImpower> implements AssetImpowerService {
@Autowired
private AssetImpowerMapper assetImpowerMapper;
@Autowired
private TableInfoService tableInfoService;
@Autowired
private RemoteUserService remoteUserService;
/**
*
* @param id
* @return
*/
@Override
public AssetImpower selectAssetImpowerById(Long id) {
return assetImpowerMapper.selectAssetImpowerById(id);
}
/**
*
* @param assetImpower
* @return
*/
@Override
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower) {
return assetImpowerMapper.selectAssetImpowerList(assetImpower);
}
/**
*
* @param assetImpower
* @return
*/
@Override
public int insertAssetImpower(AssetImpower assetImpower) {
List<AssetImpower> rows = new ArrayList<>();
assetImpower.setCreateTime(DateUtils.getNowDate());
//创建一个部门容器和用户容器
List<SysDept> deptList = remoteUserService.list(new SysDept(), SecurityConstants.INNER).getData();
System.out.println(remoteUserService.list(new SysDept(), SecurityConstants.INNER));
}
@Override
public int updateAssetImpower(AssetImpower assetImpower) {
return 0;
}
@Override
public int deleteAssetImpowerByIds(Long[] ids) {
return 0;
}
@Override
public int deleteAssetImpowerById(Long id) {
return 0;
}
@Override
public List<AssetImpower> getPowerByTableId(Long tableId) {
return null;
}
}

View File

@ -1,40 +1,44 @@
package com.muyu.etl.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.Structure;
import com.muyu.etl.domain.TableInfo;
import com.muyu.etl.domain.resp.BasicTableInfoResp;
import com.muyu.etl.domain.resp.TableInfoStructureResp;
import com.muyu.etl.domain.resp.TableTreeResp;
import com.muyu.etl.mapper.BasicConfigInfoMapper;
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 net.sf.jsqlparser.schema.Table;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletException;
import javax.sql.rowset.serial.SerialException;
import java.sql.*;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
/**
* BasicConfigInfoServiceImpl
* Service
*
* @author xiaohuang
* on 2024/5/9
* @author muyu
* @date 2024-04-20
*/
@Service
@Log4j2
public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapper, BasicConfigInfo> implements BasicConfigInfoService {
@Autowired
private BasicConfigInfoMapper basicConfigInfoMapper;
@ -44,52 +48,83 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
@Autowired
private TableInfoService tableInfoService;
@Autowired
/**
*
* @param basicConfigInfo
*
*
* @param id
* @return
*/
@Override
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo) {
return basicConfigInfoMapper.selectBasicConfigInfoList(basicConfigInfo);
}
@Override
public BasicConfigInfo selectBasicConfigInfoById(Long id) {
return basicConfigInfoMapper.selectBasicConfigInfoById(id);
}
/**
*
*
* @param basicConfigInfo
* @return
*/
@Override
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo) {
return basicConfigInfoMapper.selectBasicConfigInfoList(basicConfigInfo);
}
/**
*
*
* @param configQueryReq
* @return
*/
@Override
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq) {
return basicConfigInfoMapper.insertBasicConfigInfo(configQueryReq);
}
/**
*
*
* @param configQueryReq
* @return
*/
@Override
public int updateBasicConfigInfo(BasicConfigInfo configQueryReq) {
return basicConfigInfoMapper.updateBasicConfigInfo(configQueryReq);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteBasicConfigInfoByIds(Long[] ids) {
return basicConfigInfoMapper.deleteBasicConfigInfoByIds(ids);
}
/**
*
*
*
* @param id
* @return
*/
@Override
public int deleteBasicConfigInfoById(Long id) {
return basicConfigInfoMapper.deleteBasicConfigInfoById(id);
}
/**
*
*
* @param basicConfigInfo
* @return
* @throws SerialException
* @throws ServletException
*/
@Override
@Transactional
public boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException {
//定义下面需要的对象
String host = basicConfigInfo.getHost();
String port = basicConfigInfo.getPort();
@ -99,13 +134,11 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
String user = basicConfigInfo.getUsername();
String password = basicConfigInfo.getPassword();
Connection conn = null;
try {
conn = DriverManager.getConnection(url,user,password);
conn = DriverManager.getConnection(url, user, password);
System.out.println("Connected to the MySQL server successfully.");
//同步数据库信息
//树级结构
//树级结构,库,
TableInfo tableInfoInsert = TableInfo.builder()
.basicId(basicConfigInfo.getId())
.parentId(0L)
@ -116,19 +149,17 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
.createBy(SecurityUtils.getUsername())
.createTime(new Date())
.build();
tableInfoService.saveOrUpdate(tableInfoInsert,new LambdaUpdateWrapper<>(TableInfo.class) {{
eq(TableInfo::getTableName,tableInfoInsert.getTableName());
eq(TableInfo::getBasicId,basicConfigInfo.getId());
tableInfoService.saveOrUpdate(tableInfoInsert, new LambdaUpdateWrapper<TableInfo>(TableInfo.class) {{
eq(TableInfo::getTableName, tableInfoInsert.getTableName());
eq(TableInfo::getBasicId, basicConfigInfo.getId());
}});
//查询列表中的所有tableinfo basiac_id 不存在删除
//通过查询获取当前tableinfo对象的id
//查询列表中的所有tableInfo basic_id 不存在删除
//通过查询或去当前tableinfo对象的id
TableInfo tableInfo = tableInfoService.selectTableInfoByName(tableInfoInsert);
DatabaseMetaData metaData = conn.getMetaData();
ResultSet rs = metaData.getTables(databaseName, null, "%", new String[]{"TABLE", "VIEW"});
while (rs.next()){
ResultSet rs = metaData.getTables(databaseName,
null, "%", new String[]{"TABLE", "VIEW"});
while (rs.next()) {
//表名
String tableName = rs.getString("TABLE_NAME");
String tableRemark = rs.getString("REMARKS");
@ -136,13 +167,13 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
PreparedStatement ps = conn.prepareStatement("select * from " + tableName);
ResultSet rset = ps.executeQuery();
Long rowCount = 0L;
while (rset.next()){
while (rset.next()) {
rowCount++;
}
TableInfo build = TableInfo.builder()
.basicId(basicConfigInfo.getId())
.tableName(tableName)
//bug点tableRemark为空造成空指针异常
.tableRemark(tableRemark == null ? "" : tableRemark)
.parentId(tableInfo.getId())
.type("dataTable")
@ -151,38 +182,58 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
.dataNum(rowCount)
.updateTime(new Date())
.build();
tableInfoService.saveOrUpdate(build,new LambdaUpdateWrapper<>(TableInfo.class) {{
tableInfoService.saveOrUpdate(build, new LambdaUpdateWrapper<>(TableInfo.class) {{
eq(TableInfo::getTableName, build.getTableName());
eq(TableInfo::getBasicId, basicConfigInfo.getId());
}});
TableInfo table = tableInfoService.selectTableInfoByName(build);
//线程池
ExecutorService threadPool = Executors.newCachedThreadPool();
threadPool.submit(() ->{
})
threadPool.submit(() -> {
try {
syncData(finalConn, databaseName, table);
} catch (SQLException e) {
try {
throw new ServletException("同步数据失败");
} catch (ServletException ex) {
throw new RuntimeException(ex.getMessage());
}
}
});
Runnable thread = new Runnable() {
@SneakyThrows
@Override
public void run() {
try {
//同步
syncData(finalConn, databaseName, table);
} catch (SQLException e) {
log.error(e.getMessage());
throw new ServletException("连接失败");
}
}
};
thread.run();
ps.close();
}
conn.close();
} catch (SQLException e) {
throw new RuntimeException(e);
log.error(e.getMessage());
throw new ServletException("连接失败");
}
return true;
}
/**
*
* @return
*
* @param conn
* @param databaseName
* @param table
* @throws SQLException
*/
public void syncData(Connection conn,String databaseName,TableInfo table) throws SQLException{
public void syncData(Connection conn, String databaseName, TableInfo table) throws SQLException {
ExecutorService threadPool = Executors.newCachedThreadPool();
PreparedStatement ps = conn.prepareStatement(
" SELECT " +
@ -206,10 +257,12 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
"FROM INFORMATION_SCHEMA.COLUMNS WHERE \n" +
"TABLE_SCHEMA = '" + databaseName + "' -- 替换为你的数据库名称 \n" +
"AND TABLE_NAME = '" + table.getTableName() + "'");
// "SELECT COLUMN_NAME,DATA_TYPE,IS_NULLABLE,COLUMN_KEY,COLUMN_DEFAULT,
// COLUMN_COMMENT,CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION,
// NUMERIC_SCALE FROM INFORMATION_SCHEMA.COLUMNS
// WHERE TABLE_SCHEMA = '数据库名' AND TABLE_NAME = '表名'"
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()){
while (resultSet.next()) {
String columnName = String.valueOf(resultSet.getString(1));
String columnComment = String.valueOf(resultSet.getObject(2));
String columnKey = String.valueOf(resultSet.getObject(3));
@ -233,12 +286,11 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
.isNull("YES".equals(isNullable) ? "Y" : "N")
.defaultValue(columnDefault)
.build();
threadPool.submit(() -> {
structureService.saveOrUpdate(build,new LambdaUpdateWrapper<>(){{
eq(Structure::getTableId,build.getTableId());
eq(Structure::getColumnName,build.getColumnName());
eq(Structure::getColumnDecimals,build.getColumnRemark());
structureService.saveOrUpdate(build, new LambdaUpdateWrapper<Structure>() {{
eq(Structure::getTableId, build.getTableId());
eq(Structure::getColumnName, build.getColumnName());
eq(Structure::getColumnRemark, build.getColumnRemark());
}});
});
}
@ -246,14 +298,113 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMappe
ps.close();
}
/**
*
*
* @return
*/
@Override
public List<TableTreeResp> getTableTree() {
ExecutorService threadPool = Executors.newCachedThreadPool();
List<TableTreeResp> tableTreeRespList = tableInfoService.selectTableInfoList(new TableInfo() {{
setParentId(0L);
}}).stream().map(tableInfo -> {
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
List<TableInfoStructureResp> tableInfoStructureRespList = tableInfoService.selectTableInfoList(new TableInfo() {{
setParentId(tableInfo.getId());
}}).stream().map(info -> {
TableInfoStructureResp tableInfoStructureResp = null;
Future<TableInfoStructureResp> submit = threadPool.submit(() -> {
return TableInfoStructureResp.builder()
.id(info.getId())
.tableName(info.getTableName())
.center(info.getCenter())
.tableRemark(info.getTableRemark())
.type(info.getType())
.dataNum(info.getDataNum())
.parentId(info.getParentId())
.databaseType(basicConfigInfo.getDatabaseType())
.structureList(null)
.basicId(info.getBasicId())
.build();
});
try {
tableInfoStructureResp = submit.get();
} catch (Exception e) {
log.error(e.getMessage());
throw new RuntimeException(e);
}
return tableInfoStructureResp;
}).collect(Collectors.toList());
return TableTreeResp.builder()
.tableInfo(tableInfo)
.basicConfigInfo(basicConfigInfo)
.Children(tableInfoStructureRespList)
.build();
}).collect(Collectors.toList());
threadPool.shutdown();
while (true) if (threadPool.isTerminated()) break;
return tableTreeRespList;
}
@Override
public TableInfoStructureResp getTableInfo(Long tableId) {
TableInfo tableInfo = tableInfoService.selectTableInfoById(tableId);
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
List<Structure> structureList = structureService.list(new LambdaQueryWrapper<Structure>()
.eq(Structure::getTableId, tableInfo.getId()));
return TableInfoStructureResp.builder()
.id(tableInfo.getId())
.tableName(tableInfo.getTableName())
.center(tableInfo.getCenter())
.tableRemark(tableInfo.getTableRemark())
.dataNum(tableInfo.getDataNum())
.parentId(tableInfo.getParentId())
.databaseType(basicConfigInfo.getDatabaseType())
.structureList(structureList)
.basicId(tableInfo.getBasicId())
.build();
}
@Override
public BasicTableInfoResp getBasicTableInfo(Long tableId) {
TableInfo tableInfo = tableInfoService.selectTableInfoById(tableId);
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
String host = basicConfigInfo.getHost();
String port = basicConfigInfo.getPort();
String databaseName = basicConfigInfo.getDatabaseName();
String databaseType = basicConfigInfo.getDatabaseType();
String url = "jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + basicConfigInfo.getConnectionParams();
String user = basicConfigInfo.getUsername();
String password = basicConfigInfo.getPassword();
Long totalNum = null;
BasicTableInfoResp basicTableInfoResp = null;
Connection conn = null;
try {
conn = DriverManager.getConnection(url, user, password);
PreparedStatement ps = conn.prepareStatement("select Count(0) from " + tableInfo.getTableName());
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()){
String a = String.valueOf(resultSet.getObject(1));
totalNum = resultSet.getLong(1);
}
basicTableInfoResp = BasicTableInfoResp.builder()
.dataResourceName(basicConfigInfo.getDataResourceName())
.dataSourcesSystemName(basicConfigInfo.getDataSourcesSystemName())
.databaseName(basicConfigInfo.getDatabaseName())
.tableName(tableInfo.getTableName())
.tableRemark(tableInfo.getTableRemark())
.id(tableId)
.basicId(basicConfigInfo.getId())
.totalNum(totalNum)
.build();
ps.close();
conn.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
return basicTableInfoResp;
}
}

View File

@ -0,0 +1,108 @@
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 lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Saisai
* @date 2024-04-22
*/
@Service
@Log4j2
public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure> 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<Structure> 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);
}
@Override
public boolean updateStructureInfoDict(Structure structure) {
if ("N".equals(structure.getIsDictionary())){
structure.setDictionaryTable("");
}
return this.saveOrUpdate(structure);
}
}

View File

@ -0,0 +1,93 @@
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.TableInfo;
import com.muyu.etl.mapper.TableInfoMapper;
import com.muyu.etl.service.StructureService;
import com.muyu.etl.service.TableInfoService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* TableInfoServiceImpl
*
* @author xiaohuang
* on 2024/5/13
*/
@Log4j2
@Service
public class TableInfoServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> implements TableInfoService {
@Autowired
private TableInfoMapper tableInfoMapper;
@Autowired
private StructureService structureService;
/**
*
*/
@Override
public TableInfo selectTableInfoById(Long id){
return tableInfoMapper.selectTableInfoById(id);
}
/**
*
*/
@Override
public List<TableInfo> selectTableInfoList(TableInfo tableInfo){
return tableInfoMapper.selectTableInfoList(tableInfo);
}
/**
*
*/
@Override
public int insertTableInfo(TableInfo tableInfo){
tableInfo.setCreateTime(DateUtils.getNowDate());
return tableInfoMapper.insertTableInfo(tableInfo);
}
/**
*
*/
@Override
public int updateTableInfo(TableInfo tableInfo){
tableInfo.setUpdateTime(DateUtils.getNowDate());
return tableInfoMapper.updateTableInfo(tableInfo);
}
/**
*
*/
@Override
public int deleteTableInfoByIds(Long[] ids){
return tableInfoMapper.deleteTableInfoByIds(ids);
}
/**
*
*/
@Override
public int deleteTableInfoById(Long id){
return tableInfoMapper.deleteTableInfoById(id);
}
@Override
public TableInfo selectTableInfoByName(TableInfo table){
return tableInfoMapper.selectTableInfoByName(table);
}
}

View File

@ -1,13 +1,29 @@
<?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">
<?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.BasicConfigInfoMapper">
<resultMap type="com.muyu.etl.domain.BasicConfigInfo" id="BasicConfigInfoResult">
<result property="id" column="id" />
<result property="dataResourceName" column="data_resource_name" />
<result property="dataSourcesSystemName" column="data_sources_system_name" />
<result property="host" column="host" />
<result property="port" column="port" />
<result property="databaseType" column="database_type" />
<result property="databaseName" column="database_name" />
<result property="initLinkNum" column="init_link_num" />
<result property="maxLinkNum" column="max_link_num" />
<result property="maxWaitTime" column="max_wait_time" />
<result property="maxWaitTimes" column="max_wait_times" />
<result property="connectionParams" column="connection_params" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectBasicConfigInfoVo">
select id, data_resource_name,username,password, data_sources_system_name, host, port, database_type, database_name, init_link_num, max_link_num, max_wait_time, max_wait_times,connection_params, remark from basic_config_info
</sql>
<select id="selectBasicConfigInfoList" parameterType="com.muyu.etl.domain.BasicConfigInfo" resultMap="BasicConfigInfoResult">
<include refid="selectBasicConfigInfoVo"/>
<where>
@ -26,84 +42,78 @@
</where>
</select>
<select id="selectBasicConfigInfoById" parameterType="Long" resultMap="BasicConfigInfoResult">
<include refid="selectBasicConfigInfoVo"/>
where id = #{id}
</select>
<insert id="insertBasicConfigInfo" parameterType="com.muyu.etl.domain.BasicConfigInfo">
insert into basic_config_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="dataResourceName != null">data_resource_name,</if>
<if test="dataSourcesSystemName != null">data_sources_system_name,</if>
<if test="host != null">host,</if>
<if test="port != null">port,</if>
<if test="databaseType != null">database_type,</if>
<if test="databaseName != null">database_name,</if>
<if test="username != null">username,</if>
<if test="password != null">password</if>
<if test="initeLinkNum != null">init_link_num,</if>
<if test="maxLinkNum != null">max_link_num,</if>
<if test="maxWaitTime != null">max_wait_time,</if>
<if test="maxWaitTimes != null">max_wait_times,</if>
<if test="connextionParams != null">connection_params,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id !=null">#{id},</if>
<if test="dataResourceName != null">#{dataResourceName},</if>
<if test="dataSourcesSystemName !=null">#{dataSourcesSystemName},</if>
<if test="host != null">#{host},</if>
<if test="port != null">#{port},</if>
<if test="databaseType != null">#{databaseType},</if>
<if test="databaseName != null">#{databaseName},</if>
<if test="username != null">#{username},</if>
<if test="password != null">#{password},</if>
<if test="initLinkNum != null">#{initLinkNum},</if>
<if test="maxLinkNum != null">#{maxLinkNum},</if>
<if test="maxWaitTime != null">#{maxWaitTime},</if>
<if test="maxWaitTimes != null">#{maxWaitTimes},</if>
<if test="connectionParams != null">#{connectionParams},</if>
<if test="remark != null">#{remark},</if>
</trim>
insert into basic_config_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="dataResourceName != null">data_resource_name,</if>
<if test="dataSourcesSystemName != null">data_sources_system_name,</if>
<if test="host != null">host,</if>
<if test="port != null">port,</if>
<if test="databaseType != null">database_type,</if>
<if test="databaseName != null">database_name,</if>
<if test="username != null">username,</if>
<if test="password != null">password,</if>
<if test="initLinkNum != null">init_link_num,</if>
<if test="maxLinkNum != null">max_link_num,</if>
<if test="maxWaitTime != null">max_wait_time,</if>
<if test="maxWaitTimes != null">max_wait_times,</if>
<if test="connectionParams != null">connection_params,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="dataResourceName != null">#{dataResourceName},</if>
<if test="dataSourcesSystemName != null">#{dataSourcesSystemName},</if>
<if test="host != null">#{host},</if>
<if test="port != null">#{port},</if>
<if test="databaseType != null">#{databaseType},</if>
<if test="databaseName != null">#{databaseName},</if>
<if test="username != null">#{username},</if>
<if test="password != null">#{password},</if>
<if test="initLinkNum != null">#{initLinkNum},</if>
<if test="maxLinkNum != null">#{maxLinkNum},</if>
<if test="maxWaitTime != null">#{maxWaitTime},</if>
<if test="maxWaitTimes != null">#{maxWaitTimes},</if>
<if test="connectionParams != null">#{connectionParams},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateBasicConfigInfo" parameterType="com.muyu.etl.domain.BasicConfigInfo">
update basic_config_info
<trim prefix="SET" suffixOverrides=",">
<if test="dataResourceName !=null">data_resource_name = #{dataResourceName},</if>
<if test="dataSourcesSystemName != null">data_sources_system_name = #{dataSourcesSystemName},</if>
<if test="host != null">host = #{host},</if>
<if test="port != null">port =#{port},</if>
<if test="databaseType != null">database_type = #{databaseType},</if>
<if test="databaseName != null">database_name =#{databaseName},</if>
<if test="username != null">username =#{username},</if>
<if test="password != null">password = #{password},</if>
<if test="initLinkNum != null">init_link_num = #{initLinkNum},</if>
<if test="maxLinkNum != null">max_link_num = #{maxLinkNum},</if>
<if test="maxWaitTime != null">max_wait_time=#{maxWaitTime},</if>
<if test="maxWaitTimes != null">max_wait_times = #{maxWaitTimes},</if>
<if test="connectionParams != null">connection_params = #{connectionParams},</if>
<if test="remark != null">remark =#{remark},</if>
</trim>
where id = #{id}
update basic_config_info
<trim prefix="SET" suffixOverrides=",">
<if test="dataResourceName != null">data_resource_name = #{dataResourceName},</if>
<if test="dataSourcesSystemName != null">data_sources_system_name = #{dataSourcesSystemName},</if>
<if test="host != null">host = #{host},</if>
<if test="port != null">port = #{port},</if>
<if test="databaseType != null">database_type = #{databaseType},</if>
<if test="databaseName != null">database_name = #{databaseName},</if>
<if test="username != null">username = #{username},</if>
<if test="password != null">password = #{password},</if>
<if test="initLinkNum != null">init_link_num = #{initLinkNum},</if>
<if test="maxLinkNum != null">max_link_num = #{maxLinkNum},</if>
<if test="maxWaitTime != null">max_wait_time = #{maxWaitTime},</if>
<if test="maxWaitTimes != null">max_wait_times = #{maxWaitTimes},</if>
<if test="connectionParams != null">connection_params = #{connectionParams},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasicConfigInfoByIds" parameterType="String">
delete from basic_config_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
<delete id="deleteBasicConfigInfoById" parameterType="Long">
delete from basic_config_info where id = #{id}
</delete>
<delete id="deleteBasicConfigInfoByIds" parameterType="String">
delete from basic_config_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>