commit 292ff9c46eb374eede9981e5880690e6ae57f6e9 Author: ruyaxie <648179520@qq.comgit> Date: Fri Aug 23 11:58:26 2024 +0800 fix():初始化cloud-etl-common diff --git a/src/main/java/com/muyu/etl/domain/DataSource.java b/src/main/java/com/muyu/etl/domain/DataSource.java new file mode 100644 index 0000000..f5eb501 --- /dev/null +++ b/src/main/java/com/muyu/etl/domain/DataSource.java @@ -0,0 +1,117 @@ +package com.muyu.etl.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.etl.domain.req.DataSourceAddReq; +import com.muyu.etl.domain.req.DataSourceUpdReq; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @version 1.0 + * @Author xie ya ru + * @Date 2024/8/19 19:04 + * @注释 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(value = "order_pay_customer",autoResultMap = true) +public class DataSource extends BaseEntity { + /** + * 主键 + */ + @TableId(value = "id",type = IdType.AUTO) + private Long dataSourceId; + /** + *数据源类型 mysql + */ + private String databaseType; + /** + *数据源名称 127.0.0.1 + */ + private String databaseFormName; + /** + *数据来源地址 jdbc:mysql://localhost:3306/dbname?useUnicode=true&serverTimezone=Asia/Shanghai + */ + private String databaseUrl; + /** + *来源地址端口号 3306 + */ + private String databasePost; + /** + *数据库名称 cloud-server + */ + private String databaseName; + /** + * 表名称 + */ + private String tableName; + /** + *数据库登录名 root + */ + private String userName; + /** + *数据库登录密码 123 + */ + private String userPwd; + + /** + *数据源状态(1启用,2禁用) + */ + private String status; + + public static DataSource addBuild(DataSourceAddReq req){ + return DataSource.builder() + .databaseFormName(req.getDatabaseFormName()) + .databaseType(req.getDatabaseType()) + .databaseUrl(req.getDatabaseUrl()) + .databasePost(req.getDatabasePost()) + .databaseName(req.getDatabaseName()) + .userName(req.getUserName()) + .userPwd(req.getUserPwd()) + .build(); + } + + + public static DataSource updBuild(Long dataSourceId, DataSourceUpdReq req){ + return DataSource.builder() + .dataSourceId(dataSourceId) + .databaseFormName(req.getDatabaseFormName()) + .databaseType(req.getDatabaseType()) + .databaseUrl(req.getDatabaseUrl()) + .databasePost(req.getDatabasePost()) + .databaseName(req.getDatabaseName()) + .userName(req.getUserName()) + .userPwd(req.getUserPwd()) + .build(); + } + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/muyu/etl/domain/EtlData.java b/src/main/java/com/muyu/etl/domain/EtlData.java new file mode 100644 index 0000000..3a01178 --- /dev/null +++ b/src/main/java/com/muyu/etl/domain/EtlData.java @@ -0,0 +1,70 @@ +package com.muyu.etl.domain; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @version 1.0 + * @Author xie ya ru + * @Date 2024/8/22 17:03 + * @注释 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class EtlData { + /** + * 字段名称 cloud_id + */ + private String columnName; + /** + * 字段值 1 + */ + private String columnValue; + /** + * 字段类型 Long + */ + private String columnType; + /** + * 字段默认长度 19 + */ + private Integer columnSize; + /** + * 字段是否为空 ture false + */ + private Boolean isNullable; + /** + * 字段默认值 1 + */ + private String defaultValue; + /** + * 字段描述 主键 + */ + private String remarks; + /** + * 小数位数 2 + */ + private Integer decimalDigits; + /** + * 行号 + */ + private String row; + + public static EtlData setEtlData(String columnName,String columnValue,String columnType,Integer columnSize,Boolean isNullable,String defaultValue,String remarks,Integer decimalDigits,String row) { + return EtlData.builder() + .columnName(columnName) + .columnValue(columnValue) + .columnType(columnType) + .columnSize(columnSize) + .isNullable(isNullable) + .defaultValue(defaultValue) + .remarks(remarks) + .decimalDigits(decimalDigits) + .row(row) + .build(); + } + +} diff --git a/src/main/java/com/muyu/etl/domain/req/DataSourceAddReq.java b/src/main/java/com/muyu/etl/domain/req/DataSourceAddReq.java new file mode 100644 index 0000000..3d06dca --- /dev/null +++ b/src/main/java/com/muyu/etl/domain/req/DataSourceAddReq.java @@ -0,0 +1,68 @@ +package com.muyu.etl.domain.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.constraints.NotEmpty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @version 1.0 + * @Author xie ya ru + * @Date 2024/8/19 19:14 + * @注释 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Tag(name = "添加数据源信息" ,description = "数据源详细信息的添加") +public class DataSourceAddReq { + /** + * 数据源类型 + */ + @NotEmpty(message = "数据来源不可为空") + @Schema(type = "String",defaultValue = "MySQL",description = "数据信息来源的信息名称",requiredProperties = "true") + private String databaseType; + /** + * 数据源名称 + */ + @NotEmpty(message = "数据源名称不可为空") + @Schema(type = "String",defaultValue = "cloud-app",description = "数据源的来源的名称",requiredProperties = "true") + private String databaseFormName; + /** + * 数据来源地址 + */ + @NotEmpty(message = "数据来源地址不可为空") + @Schema(type = "String",defaultValue = "127.0.0.1",description = "数据来源地址",requiredProperties = "true") + private String databaseUrl; + /** + * 来源地址端口号 + */ + @Schema(type = "String",defaultValue = "3306",description = "来源地址端口号") + private String databasePost; + /** + * 数据库名称 + */ + @Schema(type = "String",defaultValue = "cloud-server",description = "数据库名称") + private String databaseName; + /** + * 表名称 + */ + @Schema(type = "String",defaultValue = "t_student",description = "表名称") + private String tableName; + /** + * 数据库登录名 + */ + @Schema(type = "String",defaultValue = "root",description = "数据库登录名") + private String userName; + /** + * 数据库登录密码 + */ + @Schema(type = "String",defaultValue = "wuzuxiaoniu@123.",description = "数据库登录密码") + private String userPwd; + +} diff --git a/src/main/java/com/muyu/etl/domain/req/DataSourceReq.java b/src/main/java/com/muyu/etl/domain/req/DataSourceReq.java new file mode 100644 index 0000000..ad04525 --- /dev/null +++ b/src/main/java/com/muyu/etl/domain/req/DataSourceReq.java @@ -0,0 +1,51 @@ +package com.muyu.etl.domain.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @version 1.0 + * @Author xie ya ru + * @Date 2024/8/19 19:14 + * @注释 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Tag(name = "添加数据源信息" ,description = "数据源详细信息的添加") +public class DataSourceReq { + /** + * 数据源类型 + */ + @Schema(type = "String",defaultValue = "MySQL",description = "数据信息来源的信息名称") + private String databaseType; + /** + * 数据源名称 + */ + @Schema(type = "String",defaultValue = "cloud-app",description = "数据源的来源的名称") + private String databaseFormName; + /** + * 数据库名称 + */ + @Schema(type = "String",defaultValue = "cloud-server",description = "数据库名称") + private String databaseName; + + /** + * 表名称 + */ + @Schema(type = "String",defaultValue = "t_student",description = "表名称") + private String tableName; + /** + *数据源状态(1启用,2禁用) + */ + @Schema(type = "Integer",defaultValue = "1",description = "数据源状态(1启用,2禁用)") + private String status; + + +} diff --git a/src/main/java/com/muyu/etl/domain/req/DataSourceUpdReq.java b/src/main/java/com/muyu/etl/domain/req/DataSourceUpdReq.java new file mode 100644 index 0000000..9a0f968 --- /dev/null +++ b/src/main/java/com/muyu/etl/domain/req/DataSourceUpdReq.java @@ -0,0 +1,64 @@ +package com.muyu.etl.domain.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @version 1.0 + * @Author xie ya ru + * @Date 2024/8/19 19:14 + * @注释 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Tag(name = "修改数据源信息" ,description = "数据源详细信息的部分修改") +public class DataSourceUpdReq { + /** + * 数据源类型 + */ + @Schema(type = "String",defaultValue = "MySQL",description = "数据信息来源的信息名称") + private String databaseType; + /** + * 数据源名称 + */ + @Schema(type = "String",defaultValue = "cloud-app",description = "数据源的来源的名称") + private String databaseFormName; + /** + * 数据来源地址 + */ + @Schema(type = "String",defaultValue = "127.0.0.1",description = "数据来源地址") + private String databaseUrl; + /** + * 来源地址端口号 + */ + @Schema(type = "String",defaultValue = "3306",description = "来源地址端口号") + private String databasePost; + /** + * 数据库名称 + */ + @Schema(type = "String",defaultValue = "cloud-server",description = "数据库名称") + private String databaseName; + /** + * 表名称 + */ + @Schema(type = "String",defaultValue = "t_student",description = "表名称") + private String tableName; + /** + * 数据库登录名 + */ + @Schema(type = "String",defaultValue = "root",description = "数据库登录名") + private String userName; + /** + * 数据库登录密码 + */ + @Schema(type = "String",defaultValue = "wuzuxiaoniu@123.",description = "数据库登录密码") + private String userPwd; + +} diff --git a/src/main/java/com/muyu/etl/domain/resp/DataSourceResp.java b/src/main/java/com/muyu/etl/domain/resp/DataSourceResp.java new file mode 100644 index 0000000..d2078fd --- /dev/null +++ b/src/main/java/com/muyu/etl/domain/resp/DataSourceResp.java @@ -0,0 +1,120 @@ +package com.muyu.etl.domain.resp; + +import com.muyu.etl.domain.DataSource; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @version 1.0 + * @Author xie ya ru + * @Date 2024/8/19 19:12 + * @注释 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Tag(name = "数据源输出信息",description = "查询数据源信息需要输出的字段") +public class DataSourceResp { + /** + * 主键 + */ + @Schema(type = "String",defaultValue = "1",description = "数据源主键") + private Long dataSourceId; /** + * 数据源类型 + */ + @Schema(type = "String",defaultValue = "MySQL",description = "数据信息来源的信息名称") + private String databaseType; + /** + * 数据源名称 + */ + @Schema(type = "String",defaultValue = "cloud-app",description = "数据源的来源的名称") + private String databaseFormName; + /** + * 数据来源地址 + */ + @Schema(type = "String",defaultValue = "127.0.0.1",description = "数据来源地址") + private String databaseUrl; + /** + * 来源地址端口号 + */ + @Schema(type = "String",defaultValue = "3306",description = "来源地址端口号") + private String databasePost; + /** + * 数据库名称 + */ + @Schema(type = "String",defaultValue = "cloud-server",description = "数据库名称") + private String databaseName; + /** + * 数据库登录名 + */ + @Schema(type = "String",defaultValue = "root",description = "数据库登录名") + private String userName; + /** + * 数据库登录密码 + */ + @Schema(type = "String",defaultValue = "wuzuxiaoniu@123.",description = "数据库登录密码") + private String userPwd; + /** + * 数据源状态(1启用,2禁用) + */ + @Schema(type = "String",defaultValue = "1",description = "数据源状态") + private String status; + + + public static DataSourceResp dataSourceRespBuild(DataSource dataSource){ + return DataSourceResp.builder() + .dataSourceId(dataSource.getDataSourceId()) + .databaseName(dataSource.getDatabaseName()) + .databaseType(dataSource.getDatabaseType()) + .databaseFormName(dataSource.getDatabaseFormName()) + .databaseUrl(dataSource.getDatabaseUrl()) + .databasePost(dataSource.getDatabasePost()) + .databaseName(dataSource.getDatabaseName()) + .userName(dataSource.getUserName()) + .userPwd(dataSource.getUserPwd()) + .status(dataSource.getStatus()) + .build(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +}