diff --git a/.gitignore b/.gitignore index 5ff6309b7199129c1afe4f4ec1906e640bec48c6..fc3f89ced511ea833f5c8e9fb521219975c6697e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ target/ !**/src/test/**/target/ ### IntelliJ IDEA ### +.idea .idea/modules.xml .idea/jarRepositories.xml .idea/compiler.xml diff --git a/pom.xml b/pom.xml index 3770289e7c7f2d0f13fcbf4b7e4e90c4c393a77c..aa92f6c4706ec644957b1523232c2733a07c041e 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,17 @@ runtime + + org.projectlombok + lombok + + + + + com.alibaba + fastjson + 1.2.60 + @@ -153,4 +164,16 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + + 21 + 21 + + + + \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/controller/BusinessDataSourceController.java b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataSourceController.java new file mode 100644 index 0000000000000000000000000000000000000000..852f7b9dfa29a6453d778df1ddd6144a4147552e --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataSourceController.java @@ -0,0 +1,45 @@ +package com.ediagnosis.cdr.controller; + +import com.ediagnosis.cdr.model.dto.BusinessDataSourceDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceQueryDTO; +import com.ediagnosis.cdr.model.param.BusinessDataSourceQueryParam; +import com.ediagnosis.cdr.model.vo.BusinessDataSourceVo; +import com.ediagnosis.cdr.service.BusinessDataSourceService; +import com.ediagnosis.cdr.util.PageConvertUtils; +import com.ediagnosis.cdr.value.PageVo; +import com.ediagnosis.cdr.value.Response; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author monojun + * @description 数据源接口 + * @createTime 2025年07月31日 + */ +@RestController +@RequestMapping("/dataSource") +public class BusinessDataSourceController { + + @Autowired + private BusinessDataSourceService dataSourceService; + + @PostMapping("/page") + public Response> page(@RequestBody BusinessDataSourceQueryParam queryParam) { + BusinessDataSourceQueryDTO queryDTO = new BusinessDataSourceQueryDTO(); + BeanUtils.copyProperties(queryParam, queryDTO); + Page dataSourcePage = dataSourceService.queryPage(queryDTO); + PageVo systemVoPageInfo = PageConvertUtils.copyPageInfo(dataSourcePage, dataSourceDTO -> { + BusinessDataSourceVo vo = new BusinessDataSourceVo(); + BeanUtils.copyProperties(dataSourceDTO, vo); + vo.setBizSystemId(dataSourceDTO.getBusinessId()); + vo.setBizSystemName(dataSourceDTO.getBusinessName()); + return vo; + }); + return Response.success(systemVoPageInfo); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/controller/BusinessDataSystemController.java b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataSystemController.java new file mode 100644 index 0000000000000000000000000000000000000000..7783d839c9c17308e89e1c125dc85465362740b3 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataSystemController.java @@ -0,0 +1,43 @@ +package com.ediagnosis.cdr.controller; + +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; +import com.ediagnosis.cdr.model.dto.BusinessDataSystemQueryDTO; +import com.ediagnosis.cdr.model.param.BusinessDataSystemQueryParam; +import com.ediagnosis.cdr.model.vo.BusinessDataSystemVo; +import com.ediagnosis.cdr.service.BusinessDataSystemService; +import com.ediagnosis.cdr.util.PageConvertUtils; +import com.ediagnosis.cdr.value.Response; +import com.ediagnosis.cdr.value.PageVo; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author monojun + * @description 业务系统接口 + * @createTime 2025年07月31日 + */ +@RestController +@RequestMapping("/dataSystem") +public class BusinessDataSystemController { + + @Autowired + private BusinessDataSystemService dataSystemService; + + @PostMapping("/page") + public Response> page(@RequestBody BusinessDataSystemQueryParam queryParam) { + BusinessDataSystemQueryDTO queryDTO = new BusinessDataSystemQueryDTO(); + BeanUtils.copyProperties(queryParam, queryDTO); + Page dataSystemPage = dataSystemService.queryPage(queryDTO); + PageVo systemVoPageInfo = PageConvertUtils.copyPageInfo(dataSystemPage, dataSystem -> { + BusinessDataSystemVo vo = new BusinessDataSystemVo(); + BeanUtils.copyProperties(dataSystem, vo); + return vo; + }); + return Response.success(systemVoPageInfo); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/controller/BusinessDataTableController.java b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataTableController.java new file mode 100644 index 0000000000000000000000000000000000000000..9ba4a9712e2eadbecd2dcf67a5cc2a8ad74151b1 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataTableController.java @@ -0,0 +1,43 @@ +package com.ediagnosis.cdr.controller; + +import com.ediagnosis.cdr.model.dto.BusinessDataTableDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataTableQueryDTO; +import com.ediagnosis.cdr.model.param.BusinessDataTableQueryParam; +import com.ediagnosis.cdr.model.vo.BusinessDataTableVo; +import com.ediagnosis.cdr.service.BusinessDataTableService; +import com.ediagnosis.cdr.util.PageConvertUtils; +import com.ediagnosis.cdr.value.PageVo; +import com.ediagnosis.cdr.value.Response; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author monojun + * @description 数据表接口 + * @createTime 2025年07月31日 + */ +@RestController +@RequestMapping("/dataTable") +public class BusinessDataTableController { + + @Autowired + private BusinessDataTableService dataTableService; + + @PostMapping("/page") + public Response> page(@RequestBody BusinessDataTableQueryParam queryParam) { + BusinessDataTableQueryDTO queryDTO = new BusinessDataTableQueryDTO(); + BeanUtils.copyProperties(queryParam, queryDTO); + Page dataTablePage = dataTableService.queryPage(queryDTO); + PageVo dataTableVoPageInfo = PageConvertUtils.copyPageInfo(dataTablePage, dataTable -> { + BusinessDataTableVo vo = new BusinessDataTableVo(); + BeanUtils.copyProperties(dataTable, vo); + return vo; + }); + return Response.success(dataTableVoPageInfo); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/controller/BusinessDataTableFieldController.java b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataTableFieldController.java new file mode 100644 index 0000000000000000000000000000000000000000..56a6f8b690a609e5df48fec7d8d6e60b41f33df5 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/controller/BusinessDataTableFieldController.java @@ -0,0 +1,43 @@ +package com.ediagnosis.cdr.controller; + +import com.ediagnosis.cdr.dao.entity.BusinessDataTableField; +import com.ediagnosis.cdr.model.dto.BusinessDataTableFieldQueryDTO; +import com.ediagnosis.cdr.model.param.BusinessDataTableFieldQueryParam; +import com.ediagnosis.cdr.model.vo.BusinessDataTableFieldVo; +import com.ediagnosis.cdr.service.BusinessDataTableFieldService; +import com.ediagnosis.cdr.util.PageConvertUtils; +import com.ediagnosis.cdr.value.PageVo; +import com.ediagnosis.cdr.value.Response; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author monojun + * @description 数据表字段接口 + * @createTime 2025年07月31日 + */ +@RestController +@RequestMapping("/dataTableField") +public class BusinessDataTableFieldController { + + @Autowired + private BusinessDataTableFieldService dataTableFieldService; + + @PostMapping("/page") + public Response> page(@RequestBody BusinessDataTableFieldQueryParam queryParam) { + BusinessDataTableFieldQueryDTO queryDTO = new BusinessDataTableFieldQueryDTO(); + BeanUtils.copyProperties(queryParam, queryDTO); + Page dataTableFieldPage = dataTableFieldService.queryPage(queryDTO); + PageVo tableFieldVoPageInfo = PageConvertUtils.copyPageInfo(dataTableFieldPage, dataTableField -> { + BusinessDataTableFieldVo vo = new BusinessDataTableFieldVo(); + BeanUtils.copyProperties(dataTableField, vo); + return vo; + }); + return Response.success(tableFieldVoPageInfo); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/dao/DwsRepository.java b/src/main/java/com/ediagnosis/cdr/dao/DwsRepository.java index d904fb3a07a210a713e79272e52f90d146a4239c..1b49b9a5e63e47ae8129efcbd94c955988371d9f 100644 --- a/src/main/java/com/ediagnosis/cdr/dao/DwsRepository.java +++ b/src/main/java/com/ediagnosis/cdr/dao/DwsRepository.java @@ -1,7 +1,7 @@ package com.ediagnosis.cdr.dao; -import com.ediagnosis.cdr.value.Page; +import com.ediagnosis.cdr.value.PageVo; import com.mybatisflex.core.row.Row; import org.springframework.stereotype.Repository; @@ -19,7 +19,7 @@ public class DwsRepository { this.hiveQueryExecutor = hiveQueryExecutor; } - public Page> queryPage(String sql, int pageNo,int pageSize) { + public PageVo> queryPage(String sql, int pageNo, int pageSize) { com.mybatisflex.core.paginate.Page rowPage = hiveQueryExecutor.selectByFullSql(sql, pageNo, pageSize); List> result = rowPage.getRecords().stream() .map(row -> { @@ -41,7 +41,7 @@ public class DwsRepository { .filter(map -> !map.isEmpty()) // 可选:过滤掉空 map .toList(); - return new Page<>(pageNo, pageSize, rowPage.getTotalRow(), result); + return new PageVo<>(pageNo, pageSize, rowPage.getTotalRow(), result); } diff --git a/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataSource.java b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataSource.java new file mode 100644 index 0000000000000000000000000000000000000000..2c3ed86f6c7c18412905cbeacf778847f8560d37 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataSource.java @@ -0,0 +1,101 @@ +package com.ediagnosis.cdr.dao.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.annotation.Table; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 业务系统数据源表 + * @createTime 2025年07月31日 + */ +@Data +@Table(value = "business_data_source") +public class BusinessDataSource implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @Id(value = "id", keyType = KeyType.Auto) + private Long id; + + /** + * 数据源名称 + */ + @Column(value = "name") + private String name; + + /** + * 数据源类型 + */ + @Column(value = "type") + private String type; + + /** + * IP地址 + */ + @Column(value = "ip_address") + private String ipAddress; + + /** + * 属性信息 + */ + @Column(value = "properties") + private String properties; + + /** + * 业务系统id + */ + @Column(value = "business_id") + private Long businessId; + + /** + * 描述 + */ + @Column(value = "description") + private String description; + + /** + * 连接状态: 0-未知 1-已连接 2-未连接 + */ + @Column(value = "status") + private Integer status; + + /** + * 创建时间 + */ + @Column(value = "create_time") + private Date createTime; + + /** + * 创建人 + */ + @Column(value = "create_user_id") + private Long createUserId; + + /** + * 更新时间 + */ + @Column(value = "update_time") + private Date updateTime; + + /** + * 更新人 + */ + @Column(value = "update_user_id") + private Long updateUserId; + + /** + * 是否删除: 0-未删除 1-已删除 + */ + @Column(value = "is_deleted", isLogicDelete = true) + private Integer isDeleted; +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataSystem.java b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataSystem.java new file mode 100644 index 0000000000000000000000000000000000000000..a4bfd46d0cdb3f6326effd746ee60ce35be9478d --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataSystem.java @@ -0,0 +1,66 @@ +package com.ediagnosis.cdr.dao.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.annotation.Table; +import lombok.Data; + +import java.util.Date; + +/** + * @author monojun + * @description 业务系统表 + * @createTime 2025年07月31日 + */ +@Data +@Table("business_data_system") +public class BusinessDataSystem { + /** + * 主键id + */ + @Id(value = "id", keyType = KeyType.Auto) + private Long id; + + /** + * 业务系统名称 + */ + @Column(value = "name") + private String name; + + /** + * 描述 + */ + @Column(value = "description") + private String description; + + /** + * 创建时间 + */ + @Column(value = "create_time") + private Date createTime; + + /** + * 创建人 + */ + @Column(value = "create_user_id") + private Long createUserId; + + /** + * 更新时间 + */ + @Column(value = "update_time") + private Date updateTime; + + /** + * 更新人 + */ + @Column(value = "update_user_id") + private Long updateUserId; + + /** + * 是否删除 0-未删除 1-已删除 + */ + @Column(value = "is_deleted", isLogicDelete = true) + private Integer isDeleted; +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataTable.java b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataTable.java new file mode 100644 index 0000000000000000000000000000000000000000..e328d36ed4c19f2651de9cdc6b44a66f42c7f0f7 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataTable.java @@ -0,0 +1,90 @@ +package com.ediagnosis.cdr.dao.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.annotation.Table; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 业务表信息表 + * @createTime 2025年07月31日 + */ +@Data +@Table(value = "business_data_table") +public class BusinessDataTable implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @Id(value = "id", keyType = KeyType.Auto) + private Long id; + + /** + * 业务表名称 + */ + @Column(value = "name") + private String name; + + /** + * 业务表编号 + */ + @Column(value = "table_no") + private String tableNo; + + /** + * 业务系统id + */ + @Column(value = "business_id") + private Long businessId; + + /** + * 业务数据源id + */ + @Column(value = "source_id") + private Long sourceId; + + /** + * 描述 + */ + @Column(value = "description") + private String description; + + /** + * 创建时间 + */ + @Column(value = "create_time") + private Date createTime; + + /** + * 创建人 + */ + @Column(value = "create_user_id") + private Long createUserId; + + /** + * 更新时间 + */ + @Column(value = "update_time") + private Date updateTime; + + /** + * 更新人 + */ + @Column(value = "update_user_id") + private Long updateUserId; + + /** + * 是否删除: 0-未删除 1-已删除 + */ + @Column(value = "is_deleted", isLogicDelete = true) + private Byte isDeleted; +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataTableField.java b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataTableField.java new file mode 100644 index 0000000000000000000000000000000000000000..8481f4d1d614b16e58d3a14ff14c134c60c331f3 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/entity/BusinessDataTableField.java @@ -0,0 +1,83 @@ +package com.ediagnosis.cdr.dao.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.annotation.Table; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 业务字段信息表 + * @createTime 2025年07月31日 + */ +@Data +@Table(value = "business_data_table_field") +public class BusinessDataTableField implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @Id(value = "id", keyType = KeyType.Auto) + private Long id; + + /** + * 字段名称 + */ + @Column(value = "field_name") + private String fieldName; + + /** + * 字段类型 + */ + @Column(value = "field_type") + private String fieldType; + + /** + * 业务表id + */ + @Column(value = "table_id") + private Long tableId; + + /** + * 描述 + */ + @Column(value = "description") + private String description; + + /** + * 创建时间 + */ + @Column(value = "create_time") + private Date createTime; + + /** + * 创建人 + */ + @Column(value = "create_user_id") + private Long createUserId; + + /** + * 更新时间 + */ + @Column(value = "update_time") + private Date updateTime; + + /** + * 更新人 + */ + @Column(value = "update_user_id") + private Long updateUserId; + + /** + * 是否删除: 0-未删除 1-已删除 + */ + @Column(value = "is_deleted", isLogicDelete = true) + private Byte isDeleted; +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataSourceMapper.java b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataSourceMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..34ecda879075cacd633c7508ca0870611e8429b3 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataSourceMapper.java @@ -0,0 +1,26 @@ +package com.ediagnosis.cdr.dao.mapper; + +import com.ediagnosis.cdr.dao.entity.BusinessDataSource; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceQueryDTO; +import com.mybatisflex.core.BaseMapper; +import com.mybatisflex.core.paginate.Page; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author monojun + * @description 数据源mapper + * @createTime 2025年07月31日 + */ +@Mapper +public interface BusinessDataSourceMapper extends BaseMapper { + + int batchInsert(@Param("list") List list); + + Page queryAll(Page page, @Param("queryDTO")BusinessDataSourceQueryDTO queryDTO); + + +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataSystemMapper.java b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataSystemMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f655526baf094edcadb9f821746448a25f9a0989 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataSystemMapper.java @@ -0,0 +1,21 @@ +package com.ediagnosis.cdr.dao.mapper; + +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; + +import java.util.List; + +import com.mybatisflex.core.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @author monojun + * @description 业务系统mapper + * @createTime 2025年07月31日 + */ +@Mapper +public interface BusinessDataSystemMapper extends BaseMapper { + + int batchInsert(@Param("list") List list); + +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataTableFieldMapper.java b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataTableFieldMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..5c7ed18fe523f48c5a94eba971ca0e53aaccb09f --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataTableFieldMapper.java @@ -0,0 +1,20 @@ +package com.ediagnosis.cdr.dao.mapper; + +import com.ediagnosis.cdr.dao.entity.BusinessDataTableField; + +import java.util.List; + +import com.mybatisflex.core.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @author monojun + * @description 业务表字段mapper + * @createTime 2025年07月31日 + */ +@Mapper +public interface BusinessDataTableFieldMapper extends BaseMapper { + + int batchInsert(@Param("list") List list); +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataTableMapper.java b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataTableMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..b54c1ca4d9e870494c4023f6240069d7e4906d46 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/dao/mapper/BusinessDataTableMapper.java @@ -0,0 +1,18 @@ +package com.ediagnosis.cdr.dao.mapper; + +import com.ediagnosis.cdr.dao.entity.BusinessDataTable; +import java.util.List; + +import com.mybatisflex.core.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @author monojun + * @description 业务表mapper + * @createTime 2025年07月31日 + */ +@Mapper +public interface BusinessDataTableMapper extends BaseMapper { + int batchInsert(@Param("list") List list); +} \ No newline at end of file diff --git a/src/main/java/com/ediagnosis/cdr/enums/DataSourceTypeEnum.java b/src/main/java/com/ediagnosis/cdr/enums/DataSourceTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..23533fb18b7509d0ea0d51d3abca03f85e0db97c --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/enums/DataSourceTypeEnum.java @@ -0,0 +1,36 @@ +package com.ediagnosis.cdr.enums; + +import lombok.Getter; + +/** + * @author monojun + * @description 数据源类型枚举 + * @createTime 2025年07月31日 + */ +@Getter +public enum DataSourceTypeEnum { + + Mysql("Mysql", "mysql"), + + Oracle("Oracle", "oracle"), + + PostgreSQL("PostgreSQL", "postgreSQL"), + + SQLServer("SQLServer", "sqlserver"), + + H2("H2", "h2"), + + SQLite("SQLite", "sqlite"); + + + private final String key; + + private final String value; + + + DataSourceTypeEnum(String key, String value) { + this.key = key; + this.value = value; + } + +} diff --git a/src/main/java/com/ediagnosis/cdr/enums/FieldTypeEnum.java b/src/main/java/com/ediagnosis/cdr/enums/FieldTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..46e7c4416191550fdcbbf4028f766a617a15a315 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/enums/FieldTypeEnum.java @@ -0,0 +1,43 @@ +package com.ediagnosis.cdr.enums; + +import lombok.Getter; + +/** + * @author monojun + * @description 字段类型枚举 + * @createTime 2025年08月01日 + */ +@Getter +public enum FieldTypeEnum { + + varchar("varchar", "String"), + + text("text", "String"), + + decimal("decimal", "BigDecimal"), + + integer("integer", "Integer"), + + int4("int4", "Integer"), + + int8("int8", "Integer"), + + number("number", "Long"), + + datetime("datetime", "Date"), + + timestamp("timestamp", "Date"), + + bool("boolean", "Boolean"); + + + private final String key; + + private final String value; + + + FieldTypeEnum(String key, String value) { + this.key = key; + this.value = value; + } +} diff --git a/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSourceDTO.java b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSourceDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..011d23de5a35543e79a4be78fbc1a3bd36bce4be --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSourceDTO.java @@ -0,0 +1,88 @@ +package com.ediagnosis.cdr.model.dto; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 数据源dto + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSourceDTO implements Serializable { + @Serial + private static final long serialVersionUID = -447329639545048136L; + + /** + * 主键id + */ + private Long id; + + /** + * 数据源名称 + */ + private String name; + + /** + * 数据源类型 + */ + private String type; + + /** + * IP地址 + */ + private String ipAddress; + + /** + * 属性信息 + */ + private String properties; + + /** + * 业务系统id + */ + private Long businessId; + + /** + * 业务系统名称 + */ + private String businessName; + + /** + * 描述 + */ + private String description; + + /** + * 连接状态: 0-未知 1-已连接 2-未连接 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 更新人 + */ + private Long updateUserId; + + +} diff --git a/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSourceQueryDTO.java b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSourceQueryDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..c1de65d13c648cce231b94bbffaa139f35902cd0 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSourceQueryDTO.java @@ -0,0 +1,44 @@ +package com.ediagnosis.cdr.model.dto; + +import com.ediagnosis.cdr.model.param.PageQuery; +import com.mybatisflex.annotation.Column; +import lombok.Data; + +import java.io.Serial; +import java.util.List; + +/** + * @author monojun + * @description 业务数据源查询dto + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSourceQueryDTO extends PageQuery { + @Serial + private static final long serialVersionUID = 4373837873599613512L; + + /** + * 业务系统id列表 + */ + private List businessIds; + + /** + * 数据源名称 + */ + private String name; + + /** + * ip地址 + */ + private String ipAddress; + + /** + * 数据源类型 + */ + private String type; + + /** + * 连接状态: 0-未知 1-已连接 2-未连接 + */ + private Integer status; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSystemDTO.java b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSystemDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..89b383cd4a44863318162886503aa0da4ebd70cc --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSystemDTO.java @@ -0,0 +1,53 @@ +package com.ediagnosis.cdr.model.dto; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 业务系统dto + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSystemDTO implements Serializable { + @Serial + private static final long serialVersionUID = 8024021126762424795L; + + /** + * 主键id + */ + private Long id; + + /** + * 业务系统名称 + */ + private String name; + + /** + * 描述 + */ + private String description; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 更新人 + */ + private Long updateUserId; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSystemQueryDTO.java b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSystemQueryDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..ef32dcb2dfb7eb26c61bbba62c40085301b1bcbc --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataSystemQueryDTO.java @@ -0,0 +1,21 @@ +package com.ediagnosis.cdr.model.dto; + +import com.ediagnosis.cdr.model.param.PageQuery; +import lombok.Data; + +/** + * @author monojun + * @description 业务系统查询参数 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSystemQueryDTO extends PageQuery { + private static final long serialVersionUID = -725393158125223566L; + + /** + * 业务系统名称 + */ + private String name; + + +} diff --git a/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableDTO.java b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..bfd28f395c3a2c6935f571abfba3ffe53bc68319 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableDTO.java @@ -0,0 +1,79 @@ +package com.ediagnosis.cdr.model.dto; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 业务数据源名称 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataTableDTO implements Serializable { + @Serial + private static final long serialVersionUID = -1723613352839697417L; + + /** + * 主键id + */ + private Long id; + + /** + * 业务表名称 + */ + private String name; + + /** + * 业务表编号 + */ + private String tableNo; + + /** + * 业务系统id + */ + private Long businessId; + + /** + * 业务系统名称 + */ + private String businessName; + + /** + * 业务数据源id + */ + private Long sourceId; + + /** + * 业务数据源名称 + */ + private String sourceName; + + /** + * 描述 + */ + private String description; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 更新人 + */ + private Long updateUserId; + +} diff --git a/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableFieldQueryDTO.java b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableFieldQueryDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..2856ccc2f640391400ad17b350b103ef036e6d62 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableFieldQueryDTO.java @@ -0,0 +1,32 @@ +package com.ediagnosis.cdr.model.dto; + +import com.ediagnosis.cdr.model.param.PageQuery; +import lombok.Data; + +import java.io.Serial; + +/** + * @author monojun + * @description 业务数据表dto + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataTableFieldQueryDTO extends PageQuery { + @Serial + private static final long serialVersionUID = -7409716170936124466L; + + /** + * 字段名称 + */ + private String fieldName; + + /** + * 字段类型 + */ + private String fieldType; + + /** + * 业务表id + */ + private Long tableId; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableQueryDTO.java b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableQueryDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..0be5861adde3a41af36eff55c932db9a19cfd2a7 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/dto/BusinessDataTableQueryDTO.java @@ -0,0 +1,38 @@ +package com.ediagnosis.cdr.model.dto; + +import com.ediagnosis.cdr.model.param.PageQuery; +import lombok.Data; + +import java.io.Serial; +import java.util.List; + +/** + * @author monojun + * @description 业务数据表dto + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataTableQueryDTO extends PageQuery { + @Serial + private static final long serialVersionUID = 2568845339056229745L; + + /** + * 业务系统id + */ + private List businessIds; + + /** + * 业务数据源id列表 + */ + private List sourceIds; + + /** + * 业务表名称 + */ + private String name; + + /** + * 业务表编号 + */ + private String tableNo; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataSourceQueryParam.java b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataSourceQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..302fbd0ebbaaaa37237796f259a23c477956f79a --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataSourceQueryParam.java @@ -0,0 +1,37 @@ +package com.ediagnosis.cdr.model.param; + +import lombok.Data; + +import java.io.Serial; +import java.util.List; + +/** + * @author monojun + * @description 数据源查询参数 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSourceQueryParam extends PageQuery { + @Serial + private static final long serialVersionUID = 4384878864788101913L; + + /** + * 业务系统id列表 + */ + private List businessIds; + + /** + * 数据源名称 + */ + private String name; + + /** + * ip地址 + */ + private String ipAddress; + + /** + * 数据源类型 + */ + private String type; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataSystemQueryParam.java b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataSystemQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..d7079a972f9503058ba98609e0b93a1ccfb090d8 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataSystemQueryParam.java @@ -0,0 +1,21 @@ +package com.ediagnosis.cdr.model.param; + +import lombok.Data; + +import java.io.Serial; + +/** + * @author monojun + * @description 业务系统分页查询参数 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSystemQueryParam extends PageQuery { + @Serial + private static final long serialVersionUID = 5408831076545737168L; + + /** + * 业务系统名称 + */ + private String name; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataTableFieldQueryParam.java b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataTableFieldQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..37b691e9b494e5fd67c456e07ec127bffd988aa5 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataTableFieldQueryParam.java @@ -0,0 +1,31 @@ +package com.ediagnosis.cdr.model.param; + +import lombok.Data; + +import java.io.Serial; + +/** + * @author monojun + * @description 表字段查询参数 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataTableFieldQueryParam extends PageQuery{ + + @Serial + private static final long serialVersionUID = 5419533067070233483L; + /** + * 字段名称 + */ + private String fieldName; + + /** + * 字段类型 + */ + private String fieldType; + + /** + * 业务表id + */ + private Long tableId; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataTableQueryParam.java b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataTableQueryParam.java new file mode 100644 index 0000000000000000000000000000000000000000..dfcb680731c07c709909d95d079a186c4aa49365 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/param/BusinessDataTableQueryParam.java @@ -0,0 +1,37 @@ +package com.ediagnosis.cdr.model.param; + +import lombok.Data; + +import java.io.Serial; +import java.util.List; + +/** + * @author monojun + * @description 表信息查询参数 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataTableQueryParam extends PageQuery { + + @Serial + private static final long serialVersionUID = -6012405803243067316L; + /** + * 业务系统id列表 + */ + private List businessIds; + + /** + * 业务数据源id列表 + */ + private List sourceIds; + + /** + * 业务表名称 + */ + private String name; + + /** + * 业务表编号 + */ + private String tableNo; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/param/PageQuery.java b/src/main/java/com/ediagnosis/cdr/model/param/PageQuery.java new file mode 100644 index 0000000000000000000000000000000000000000..d8eef68f7a6622b183b31ed71c0950bea364e210 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/param/PageQuery.java @@ -0,0 +1,26 @@ +package com.ediagnosis.cdr.model.param; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 可以传入一个实体T类型来接收该类型属性值。 + * + * @author wangziqiao + */ +@Data +public class PageQuery implements Serializable { + + @Serial + private static final long serialVersionUID = -1808475912533720127L; + + private int pageNo = 1; + + private int pageSize = 10; + + public int getOffset() { + return (pageNo - 1) * pageSize; + } +} diff --git a/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataSourceVo.java b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataSourceVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c9eada38f6b656f1f9023687dcea8a1174404fee --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataSourceVo.java @@ -0,0 +1,83 @@ +package com.ediagnosis.cdr.model.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 数据源信息 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSourceVo implements Serializable { + @Serial + private static final long serialVersionUID = -4205114103165887164L; + + /** + * 主键id + */ + private Long id; + + /** + * 数据源名称 + */ + private String name; + + /** + * 数据源类型(mysql、oracle、postgreSQL、sqlserver、h2、sqlite) + */ + private String type; + + /** + * IP地址 + */ + private String ipAddress; + + /** + * 业务系统id + */ + private Long bizSystemId; + + /** + * 业务系统名称 + */ + private String bizSystemName; + + /** + * 描述 + */ + private String description; + + /** + * 属性 + */ + private String properties; + + /** + * 连接状态 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 更新人 + */ + private Long updateUserId; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataSystemVo.java b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataSystemVo.java new file mode 100644 index 0000000000000000000000000000000000000000..3b54e29f47ee238d69edfd3e0a4f35056bb05dfe --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataSystemVo.java @@ -0,0 +1,56 @@ +package com.ediagnosis.cdr.model.vo; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 业务系统信息 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataSystemVo implements Serializable { + @Serial + private static final long serialVersionUID = 1995094555769215993L; + /** + * 主键id + */ + private Long id; + + /** + * 业务系统名称 + */ + private String name; + + /** + * 描述 + */ + private String description; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 更新人 + */ + private Long updateUserId; + +} diff --git a/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataTableFieldVo.java b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataTableFieldVo.java new file mode 100644 index 0000000000000000000000000000000000000000..41af7bd7a044cfcbee61c840b08519a944116e75 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataTableFieldVo.java @@ -0,0 +1,63 @@ +package com.ediagnosis.cdr.model.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 表字段信息 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataTableFieldVo implements Serializable { + @Serial + private static final long serialVersionUID = 3062177923173755855L; + + /** + * 主键id + */ + private Long id; + + /** + * 字段名称 + */ + private String fieldName; + + /** + * 字段类型 + */ + private String fieldType; + + /** + * 业务表id + */ + private Long tableId; + + /** + * 描述 + */ + private String description; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 更新人 + */ + private Long updateUserId; +} diff --git a/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataTableVo.java b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataTableVo.java new file mode 100644 index 0000000000000000000000000000000000000000..720c46f4431657f471e769e0c6c28c0c9cf06615 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/model/vo/BusinessDataTableVo.java @@ -0,0 +1,78 @@ +package com.ediagnosis.cdr.model.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author monojun + * @description 表信息 + * @createTime 2025年07月31日 + */ +@Data +public class BusinessDataTableVo implements Serializable { + @Serial + private static final long serialVersionUID = 8791629491093128048L; + + /** + * 主键id + */ + private Long id; + + /** + * 业务表名称 + */ + private String name; + + /** + * 业务表编号 + */ + private String tableNo; + + /** + * 业务系统id + */ + private Long businessId; + + /** + * 业务系统名称 + */ + private String businessName; + + /** + * 业务数据源id + */ + private Long sourceId; + + /** + * 业务数据源名称 + */ + private String sourceName; + + /** + * 描述 + */ + private String description; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 更新人 + */ + private Long updateUserId; +} diff --git a/src/main/java/com/ediagnosis/cdr/service/BusinessDataSourceService.java b/src/main/java/com/ediagnosis/cdr/service/BusinessDataSourceService.java new file mode 100644 index 0000000000000000000000000000000000000000..c1c99d78194b9ce1ad2498e712a695c03ba08010 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/BusinessDataSourceService.java @@ -0,0 +1,21 @@ +package com.ediagnosis.cdr.service; + +import com.ediagnosis.cdr.model.dto.BusinessDataSourceDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceQueryDTO; +import com.mybatisflex.core.paginate.Page; + +/** + * @author monojun + * @description 业务数据源service + * @createTime 2025年07月31日 + */ +public interface BusinessDataSourceService { + + /** + * 分页查询业务数据源信息 + * + * @param queryDTO 查询dto + * @return PageInfo + */ + Page queryPage(BusinessDataSourceQueryDTO queryDTO); +} diff --git a/src/main/java/com/ediagnosis/cdr/service/BusinessDataSystemService.java b/src/main/java/com/ediagnosis/cdr/service/BusinessDataSystemService.java new file mode 100644 index 0000000000000000000000000000000000000000..a9c2b2c7308e58796d513aa0ed07211a6d9738ad --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/BusinessDataSystemService.java @@ -0,0 +1,44 @@ +package com.ediagnosis.cdr.service; + +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; +import com.ediagnosis.cdr.model.dto.BusinessDataSystemDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSystemQueryDTO; +import com.mybatisflex.core.paginate.Page; + +/** + * @author monojun + * @description 业务系统service + * @createTime 2025年07月31日 + */ +public interface BusinessDataSystemService { + /** + * 新增业务系统 + * + * @param dataSystemDTO 业务系统dto + * @return 主键id + */ + Long addDataSystem(BusinessDataSystemDTO dataSystemDTO); + + /** + * 更新业务系统 + * + * @param dataSystemDTO 业务系统dto + * @return Long + */ + Long updateDataSystem(BusinessDataSystemDTO dataSystemDTO); + + /** + * 删除业务系统 + * + * @param dataSystemId 任务主键id + */ + void deleteDataSystem(Long dataSystemId); + + /** + * 分页查询业务系统信息 + * + * @param queryDTO 查询dto + * @return PageInfo + */ + Page queryPage(BusinessDataSystemQueryDTO queryDTO); +} diff --git a/src/main/java/com/ediagnosis/cdr/service/BusinessDataTableFieldService.java b/src/main/java/com/ediagnosis/cdr/service/BusinessDataTableFieldService.java new file mode 100644 index 0000000000000000000000000000000000000000..2d6bc619506d4079990a50e3e4fde3437971b0f2 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/BusinessDataTableFieldService.java @@ -0,0 +1,21 @@ +package com.ediagnosis.cdr.service; + +import com.ediagnosis.cdr.dao.entity.BusinessDataTableField; +import com.ediagnosis.cdr.model.dto.BusinessDataTableFieldQueryDTO; +import com.mybatisflex.core.paginate.Page; + +/** + * @author monojun + * @description 业务表字段service + * @createTime 2025年07月31日 + */ +public interface BusinessDataTableFieldService { + + /** + * 分页查询业务表字段信息 + * + * @param queryDTO 查询dto + * @return PageInfo + */ + Page queryPage(BusinessDataTableFieldQueryDTO queryDTO); +} diff --git a/src/main/java/com/ediagnosis/cdr/service/BusinessDataTableService.java b/src/main/java/com/ediagnosis/cdr/service/BusinessDataTableService.java new file mode 100644 index 0000000000000000000000000000000000000000..3e931b98996a6be47b1dcf0089e9fbbcf3ddde04 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/BusinessDataTableService.java @@ -0,0 +1,21 @@ +package com.ediagnosis.cdr.service; + +import com.ediagnosis.cdr.model.dto.BusinessDataTableDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataTableQueryDTO; +import com.mybatisflex.core.paginate.Page; + +/** + * @author monojun + * @description 业务表service + * @createTime 2025年07月31日 + */ +public interface BusinessDataTableService { + + /** + * 分页查询业务表信息 + * + * @param queryDTO 查询dto + * @return PageInfo + */ + Page queryPage(BusinessDataTableQueryDTO queryDTO); +} diff --git a/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataSourceServiceImpl.java b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataSourceServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8faefe6cf18f5dbbefef0bd45d207a3ccdcacb40 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataSourceServiceImpl.java @@ -0,0 +1,52 @@ +package com.ediagnosis.cdr.service.impl; + +import com.ediagnosis.cdr.dao.entity.BusinessDataSource; +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; +import com.ediagnosis.cdr.dao.mapper.BusinessDataSourceMapper; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceQueryDTO; +import com.ediagnosis.cdr.service.BusinessDataSourceService; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +/** + * @author monojun + * @description 业务数据源service + * @createTime 2025年07月31日 + */ +@Service +public class BusinessDataSourceServiceImpl implements BusinessDataSourceService { + + @Autowired + private BusinessDataSourceMapper dataSourceMapper; + + @Override + public Page queryPage(BusinessDataSourceQueryDTO queryDTO) { + QueryWrapper queryWrapper = QueryWrapper.create() + .select("d.*", "ds.name as businessName") + .from(BusinessDataSource.class).as("d") + .leftJoin(BusinessDataSystem.class).as("ds") + .on(BusinessDataSource::getBusinessId, BusinessDataSystem::getId) + .orderBy(BusinessDataSource::getId, false); + if (!CollectionUtils.isEmpty(queryDTO.getBusinessIds())) { + queryWrapper.in(BusinessDataSource::getBusinessId, queryDTO.getBusinessIds()); + } + if (StringUtils.hasText(queryDTO.getName())) { + queryWrapper.like(BusinessDataSource::getName, queryDTO.getName()); + } + if (StringUtils.hasText(queryDTO.getIpAddress())) { + queryWrapper.like(BusinessDataSource::getIpAddress, queryDTO.getIpAddress()); + } + if (StringUtils.hasText(queryDTO.getType())) { + queryWrapper.eq(BusinessDataSource::getType, queryDTO.getType()); + } + if (queryDTO.getStatus() != null) { + queryWrapper.eq(BusinessDataSource::getStatus, queryDTO.getStatus()); + } + return dataSourceMapper.paginateAs(queryDTO.getPageNo(), queryDTO.getPageSize(), queryWrapper, BusinessDataSourceDTO.class); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataSystemServiceImpl.java b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataSystemServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..67091b8aa1bf67cb4b6abccdb005aca6140eacc9 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataSystemServiceImpl.java @@ -0,0 +1,61 @@ +package com.ediagnosis.cdr.service.impl; + +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; +import com.ediagnosis.cdr.dao.mapper.BusinessDataSystemMapper; +import com.ediagnosis.cdr.model.dto.BusinessDataSystemDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSystemQueryDTO; +import com.ediagnosis.cdr.service.BusinessDataSystemService; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.Date; + +/** + * @author monojun + * @description 业务系统service + * @createTime 2025年07月31日 + */ +@Service +public class BusinessDataSystemServiceImpl implements BusinessDataSystemService { + + @Autowired + private BusinessDataSystemMapper dataSystemMapper; + + @Override + public Long addDataSystem(BusinessDataSystemDTO dataSystemDTO) { + BusinessDataSystem dataSystem = new BusinessDataSystem(); + BeanUtils.copyProperties(dataSystemDTO, dataSystem); + dataSystem.setCreateTime(new Date()); + dataSystem.setUpdateTime(new Date()); + dataSystemMapper.insert(dataSystem); + return dataSystem.getId(); + } + + @Override + public Long updateDataSystem(BusinessDataSystemDTO dataSystemDTO) { + BusinessDataSystem dataSystem = new BusinessDataSystem(); + BeanUtils.copyProperties(dataSystemDTO, dataSystem); + dataSystem.setUpdateTime(new Date()); + dataSystemMapper.update(dataSystem); + return dataSystem.getId(); + } + + @Override + public void deleteDataSystem(Long dataSystemId) { + dataSystemMapper.deleteById(dataSystemId); + } + + @Override + public Page queryPage(BusinessDataSystemQueryDTO queryDTO) { + QueryWrapper queryWrapper = QueryWrapper.create(); + if (StringUtils.hasText(queryDTO.getName())) { + queryWrapper.like(BusinessDataSystem::getName, queryDTO.getName()); + } + queryWrapper.orderBy(BusinessDataSystem::getId, false); + return dataSystemMapper.paginate(queryDTO.getPageNo(), queryDTO.getPageSize(), queryWrapper); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataTableFieldServiceImpl.java b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataTableFieldServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ab398652aed6a3dd5aa68ccbcb58c1d1c5fd8f5f --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataTableFieldServiceImpl.java @@ -0,0 +1,39 @@ +package com.ediagnosis.cdr.service.impl; + +import com.ediagnosis.cdr.dao.entity.BusinessDataTableField; +import com.ediagnosis.cdr.dao.mapper.BusinessDataTableFieldMapper; +import com.ediagnosis.cdr.model.dto.BusinessDataTableFieldQueryDTO; +import com.ediagnosis.cdr.service.BusinessDataTableFieldService; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +/** + * @author monojun + * @description 业务表字段service + * @createTime 2025年07月31日 + */ +@Service +public class BusinessDataTableFieldServiceImpl implements BusinessDataTableFieldService { + + @Autowired + private BusinessDataTableFieldMapper dataTableFieldMapper; + + @Override + public Page queryPage(BusinessDataTableFieldQueryDTO queryDTO) { + QueryWrapper queryWrapper = QueryWrapper.create(); + if (StringUtils.hasText(queryDTO.getFieldName())) { + queryWrapper.like(BusinessDataTableField::getFieldName, queryDTO.getFieldName()); + } + if (StringUtils.hasText(queryDTO.getFieldType())) { + queryWrapper.like(BusinessDataTableField::getFieldType, queryDTO.getFieldType()); + } + if (queryDTO.getTableId() != null) { + queryWrapper.eq(BusinessDataTableField::getTableId, queryDTO.getTableId()); + } + queryWrapper.orderBy(BusinessDataTableField::getId, false); + return dataTableFieldMapper.paginate(queryDTO.getPageNo(), queryDTO.getPageSize(), queryWrapper); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataTableServiceImpl.java b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataTableServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b1a2265092bc3a43edd3213abc97c6934002092f --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/service/impl/BusinessDataTableServiceImpl.java @@ -0,0 +1,52 @@ +package com.ediagnosis.cdr.service.impl; + +import com.ediagnosis.cdr.dao.entity.BusinessDataSource; +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; +import com.ediagnosis.cdr.dao.entity.BusinessDataTable; +import com.ediagnosis.cdr.dao.mapper.BusinessDataTableMapper; +import com.ediagnosis.cdr.model.dto.BusinessDataTableDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataTableQueryDTO; +import com.ediagnosis.cdr.service.BusinessDataTableService; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +/** + * @author monojun + * @description 业务表service + * @createTime 2025年07月31日 + */ +@Service +public class BusinessDataTableServiceImpl implements BusinessDataTableService { + + @Autowired + private BusinessDataTableMapper dataTableMapper; + + @Override + public Page queryPage(BusinessDataTableQueryDTO queryDTO) { + QueryWrapper queryWrapper = QueryWrapper.create() + .select("t.*, d.id as sourceId, d.name as sourceName, ds.id as businessId, ds.name as businessName") + .from(BusinessDataTable.class).as("t") + .leftJoin(BusinessDataSource.class).as("d") + .on(BusinessDataTable::getSourceId, BusinessDataSource::getId) + .leftJoin(BusinessDataSystem.class).as("ds") + .on(BusinessDataSource::getBusinessId, BusinessDataSystem::getId) + .orderBy(BusinessDataTable::getId, false); + if (StringUtils.hasText(queryDTO.getName())) { + queryWrapper.like(BusinessDataTable::getName, queryDTO.getName()); + } + if (!CollectionUtils.isEmpty(queryDTO.getBusinessIds())) { + queryWrapper.in(BusinessDataTable::getBusinessId, queryDTO.getBusinessIds()); + } + if (!CollectionUtils.isEmpty(queryDTO.getSourceIds())) { + queryWrapper.in(BusinessDataTable::getSourceId, queryDTO.getSourceIds()); + } + if (StringUtils.hasText(queryDTO.getTableNo())) { + queryWrapper.like(BusinessDataTable::getTableNo, queryDTO.getTableNo()); + } + return dataTableMapper.paginateAs(queryDTO.getPageNo(), queryDTO.getPageSize(), queryWrapper, BusinessDataTableDTO.class); + } +} diff --git a/src/main/java/com/ediagnosis/cdr/util/PageConvertUtils.java b/src/main/java/com/ediagnosis/cdr/util/PageConvertUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..5dc154aa88fa5dce5e32b270e9fcac0790952a73 --- /dev/null +++ b/src/main/java/com/ediagnosis/cdr/util/PageConvertUtils.java @@ -0,0 +1,42 @@ +package com.ediagnosis.cdr.util; + +import com.ediagnosis.cdr.value.PageVo; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.BeanUtils; + +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author monojun + * @description 拷贝工具 + * @createTime 2025年07月03日 + */ +public class PageConvertUtils { + /** + * 拷贝 Page 到 PageVo + * + * @param source 原始分页数据 + * @param function 转换函数 T -> R + * @param 源类型 + * @param 目标类型 + * @return PageInfo + */ + public static PageVo copyPageInfo(Page source, Function function) { + PageVo result = new PageVo<>(); + // 拷贝分页信息(排除list) + BeanUtils.copyProperties(source, result, "list"); + result.setPageNo(source.getPageNumber()); + result.setPageSize(source.getPageSize()); + result.setTotalCount(source.getTotalRow()); + result.setTotalPage(source.getTotalPage()); + List collect = source.getRecords().stream() + .map(function) + .collect(Collectors.toList()); + result.setContent(collect); + return result; + } + + +} diff --git a/src/main/java/com/ediagnosis/cdr/value/Page.java b/src/main/java/com/ediagnosis/cdr/value/PageVo.java similarity index 89% rename from src/main/java/com/ediagnosis/cdr/value/Page.java rename to src/main/java/com/ediagnosis/cdr/value/PageVo.java index 86e353e2fc5e9deaa677f4f9b45155292fc4726b..fc4438ac1de5eeb18538639f51ad7d1769240a54 100644 --- a/src/main/java/com/ediagnosis/cdr/value/Page.java +++ b/src/main/java/com/ediagnosis/cdr/value/PageVo.java @@ -2,18 +2,18 @@ package com.ediagnosis.cdr.value; import java.util.List; -public class Page { +public class PageVo { private long pageNo; private long pageSize; private long totalCount; private List content; private long totalPage; - public Page() { + public PageVo() { } - public Page(long pageNo, long pageSize, - long totalCount, List content) { + public PageVo(long pageNo, long pageSize, + long totalCount, List content) { this.pageNo = pageNo; this.pageSize = pageSize; this.totalCount = totalCount; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 36969e003121e8e3ea1e2946e536bf65a9000211..ad53ce711a1a07f74ac99f4f30f53143361b107b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,7 +2,7 @@ mybatis-flex: datasource: ds-mysql: - url: jdbc:mysql://10.11.4.21:33063/cdr + url: jdbc:mysql://10.11.4.21:33063/cdr_v1 username: root password: Admin123456# ds-hive: diff --git a/src/main/resources/generator/mapper/BusinessDataSourceMapper.xml b/src/main/resources/generator/mapper/BusinessDataSourceMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c30bc88942398ceb0079ee8f6574d5d19eec8af3 --- /dev/null +++ b/src/main/resources/generator/mapper/BusinessDataSourceMapper.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + id, `name`, `type`, ip_address, properties, business_id, description, `status`, create_time, + create_user_id, update_time, update_user_id, is_deleted + + + d.id, d.`name`, d.`type`, d.ip_address, d.properties, d.business_id, ds.name as businessName, d.description, d.`status`, d.create_time, + d.create_user_id, d.update_time, d.update_user_id + + + + insert into business_data_source + (id, `name`, `type`, ip_address, properties, business_id, description, `status`, + create_time, create_user_id, update_time, update_user_id, is_deleted) + values + + (#{item.id,jdbcType=BIGINT}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, + #{item.ipAddress,jdbcType=VARCHAR}, #{item.properties,jdbcType=LONGVARCHAR}, #{item.businessId,jdbcType=BIGINT}, + #{item.description,jdbcType=LONGVARCHAR}, #{item.status,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, + #{item.createUserId,jdbcType=BIGINT}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.updateUserId,jdbcType=BIGINT}, + #{item.isDeleted,jdbcType=INTEGER}) + + + + + + \ No newline at end of file diff --git a/src/main/resources/generator/mapper/BusinessDataSystemMapper.xml b/src/main/resources/generator/mapper/BusinessDataSystemMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2bed50f2e1c1e11a4d3982da21b8cdb55cf4c248 --- /dev/null +++ b/src/main/resources/generator/mapper/BusinessDataSystemMapper.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + id, name, description, create_time, create_user_id, update_time, update_user_id, + is_deleted + + + + insert into business_data_system + (name, description, create_time, create_user_id, update_time, update_user_id, is_deleted + ) + values + + (#{item.name,jdbcType=VARCHAR}, #{item.description,jdbcType=LONGVARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, + #{item.createUserId,jdbcType=BIGINT}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.updateUserId,jdbcType=BIGINT}, + #{item.isDeleted,jdbcType=INTEGER}) + + + \ No newline at end of file diff --git a/src/main/resources/generator/mapper/BusinessDataTableFieldMapper.xml b/src/main/resources/generator/mapper/BusinessDataTableFieldMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..9951e2c504c7a71f77a8d2401a559b2a9894854a --- /dev/null +++ b/src/main/resources/generator/mapper/BusinessDataTableFieldMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + id, field_name, field_type, table_id, description, create_time, create_user_id, update_time, + update_user_id, is_deleted + + + + insert into business_data_table_field + (id, field_name, field_type, table_id, description, create_time, create_user_id, + update_time, update_user_id, is_deleted) + values + + (#{item.id,jdbcType=BIGINT}, #{item.fieldName,jdbcType=VARCHAR}, #{item.fieldType,jdbcType=VARCHAR}, + #{item.tableId,jdbcType=BIGINT}, #{item.description,jdbcType=LONGVARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, + #{item.createUserId,jdbcType=BIGINT}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.updateUserId,jdbcType=BIGINT}, + #{item.isDeleted,jdbcType=INTEGER}) + + + \ No newline at end of file diff --git a/src/main/resources/generator/mapper/BusinessDataTableMapper.xml b/src/main/resources/generator/mapper/BusinessDataTableMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..df36447a0a4d9e309f37fd902b3b4aeabe5c0600 --- /dev/null +++ b/src/main/resources/generator/mapper/BusinessDataTableMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + id, `name`, table_no, business_id, source_id, description, create_time, create_user_id, + update_time, update_user_id, is_deleted + + + + insert into business_data_table + (id, `name`, table_no, business_id, source_id, description, create_time, create_user_id, + update_time, update_user_id, is_deleted) + values + + (#{item.id,jdbcType=BIGINT}, #{item.name,jdbcType=VARCHAR}, #{item.tableNo,jdbcType=VARCHAR}, + #{item.businessId,jdbcType=BIGINT}, #{item.sourceId,jdbcType=BIGINT}, #{item.description,jdbcType=LONGVARCHAR}, + #{item.createTime,jdbcType=TIMESTAMP}, #{item.createUserId,jdbcType=BIGINT}, #{item.updateTime,jdbcType=TIMESTAMP}, + #{item.updateUserId,jdbcType=BIGINT}, #{item.isDeleted,jdbcType=INTEGER}) + + + \ No newline at end of file diff --git a/src/test/java/com/ediagnosis/cdr/dao/MapperTest.java b/src/test/java/com/ediagnosis/cdr/dao/MapperTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6d75e213379d1293c15c4f55d5da62ec71d1f4ec --- /dev/null +++ b/src/test/java/com/ediagnosis/cdr/dao/MapperTest.java @@ -0,0 +1,51 @@ +package com.ediagnosis.cdr.dao; + +import com.alibaba.fastjson.JSON; +import com.ediagnosis.cdr.CdrApplication; +import com.ediagnosis.cdr.dao.entity.BusinessDataSource; +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; +import com.ediagnosis.cdr.dao.mapper.BusinessDataSourceMapper; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSourceQueryDTO; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * @author monojun + * @description MapperTest + * @createTime 2025年07月31日 + */ +@SpringBootTest(classes = CdrApplication.class) +public class MapperTest { + + @Autowired + private BusinessDataSourceMapper dataSourceMapper; + + @Test + public void test1() { + BusinessDataSourceQueryDTO queryDTO = new BusinessDataSourceQueryDTO(); + QueryWrapper queryWrapper = QueryWrapper.create() + .select("d.*, ds.name as businessName") + .from("business_data_source").as("d") + .leftJoin("business_data_system").as("ds") + .on("d.business_id = ds.id"); + Page dataSourceDTOPage = dataSourceMapper.paginateAs(1, 10, queryWrapper, BusinessDataSourceDTO.class); + System.out.println(JSON.toJSON(dataSourceDTOPage)); + } + + @Test + public void test2() { + QueryWrapper queryWrapper = QueryWrapper.create() + .select("d.*", "ds.id as businessId, ds.name as businessName") + .from(BusinessDataSource.class).as("d") + .leftJoin(BusinessDataSystem.class).as("ds") + .on(BusinessDataSource::getBusinessId, BusinessDataSystem::getId); + queryWrapper.in(BusinessDataSource::getBusinessId, 1); + + Page dataSourceDTOPage = dataSourceMapper.paginateAs(1, 10, queryWrapper, BusinessDataSourceDTO.class); + System.out.println(JSON.toJSON(dataSourceDTOPage)); + } +} diff --git a/src/test/java/com/ediagnosis/cdr/demo/DemoTest.java b/src/test/java/com/ediagnosis/cdr/demo/DemoTest.java new file mode 100644 index 0000000000000000000000000000000000000000..dc708ce2a4f79980f9388feb90679b662ade4d0b --- /dev/null +++ b/src/test/java/com/ediagnosis/cdr/demo/DemoTest.java @@ -0,0 +1,59 @@ +package com.ediagnosis.cdr.demo; + +import com.alibaba.fastjson.JSON; +import com.ediagnosis.cdr.CdrApplication; +import com.ediagnosis.cdr.dao.entity.BusinessDataSystem; +import com.ediagnosis.cdr.model.dto.BusinessDataSystemDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataSystemQueryDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataTableDTO; +import com.ediagnosis.cdr.model.dto.BusinessDataTableQueryDTO; +import com.ediagnosis.cdr.service.BusinessDataSystemService; +import com.ediagnosis.cdr.service.BusinessDataTableService; +import com.mybatisflex.core.paginate.Page; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * @author monojun + * @description ServiceTest + * @createTime 2025年07月31日 + */ +@SpringBootTest(classes = CdrApplication.class) +public class DemoTest { + + @Autowired + private BusinessDataTableService tableService; + + @Autowired + private BusinessDataSystemService dataSystemService; + + @Test + public void test1() { + BusinessDataTableQueryDTO queryDTO = new BusinessDataTableQueryDTO(); + Page businessDataTableDTOPage = tableService.queryPage(queryDTO); + System.out.println(JSON.toJSONString(businessDataTableDTOPage)); + } + + @Test + public void test2() { + BusinessDataSystemQueryDTO queryDTO = new BusinessDataSystemQueryDTO(); + Page dataSystemPage = dataSystemService.queryPage(queryDTO); + System.out.println(JSON.toJSONString(dataSystemPage)); + } + + @Test + public void test3() { + BusinessDataSystemDTO dataSystemDTO = new BusinessDataSystemDTO(); + dataSystemDTO.setName("业务系统demo3"); + dataSystemDTO.setDescription("业务系统demo3描述"); + Long l = dataSystemService.addDataSystem(dataSystemDTO); + System.out.println(l); + BusinessDataSystemDTO updateDataSystemDTO = new BusinessDataSystemDTO(); + updateDataSystemDTO.setId(l); + updateDataSystemDTO.setDescription("业务系统demo3描述1"); + dataSystemService.updateDataSystem(updateDataSystemDTO); + } + + +}