添加查询数据源的接口
parent
c612585c82
commit
a1ff33d35a
|
@ -1,5 +1,60 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
<component name="InspectionProjectProfileManager">
|
||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAbstractClassShouldStartWithAbstractNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidApacheBeanUtilsCopy" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidCallStaticSimpleDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidCommentBehindStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidComplexCondition" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidConcurrentCompetitionRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidDoubleOrFloatEqualCompare" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidManuallyCreateThread" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidMissUseOfMathRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidNegationOperator" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidNewDateGetTime" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidPatternCompileInMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidReturnInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidStartWithDollarAndUnderLineNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaAvoidUseTimer" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaBigDecimalAvoidDoubleConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaBooleanPropertyShouldNotStartWithIs" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaClassCastExceptionWithSubListToArrayList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaClassCastExceptionWithToArray" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaClassMustHaveAuthor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaClassNamingShouldBeCamel" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaCollectionInitShouldAssignCapacity" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaCommentsMustBeJavadocFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaConcurrentExceptionWithModifyOriginSubList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaConstantFieldShouldBeUpperCase" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaCountDownShouldInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaDontModifyInForeachCircle" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaEnumConstantsMustHaveComment" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaExceptionClassShouldEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaIbatisMethodQueryForList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaLockShouldWithTryFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaLowerCamelCaseVariableNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaMethodReturnWrapperType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaMethodTooLong" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaPackageNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaPojoMustOverrideToString" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaPojoMustUsePrimitiveField" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaPojoNoDefaultValue" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaRemoveCommentedCode" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaServiceOrDaoClassShouldEndWithImpl" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaSneakyThrowsWithoutExceptionType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaStringConcat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaSwitchExpression" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaTestClassShouldEndWithTestNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaThreadLocalShouldRemove" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaThreadPoolCreation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaThreadShouldSetName" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaTransactionMustHaveRollback" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaUndefineMagicConstant" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaUnsupportedExceptionWithModifyAsList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaUseQuietReferenceNotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AlibabaUseRightCaseForDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.source.domain;
|
package com.muyu.source.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
@ -21,12 +22,10 @@ import lombok.experimental.SuperBuilder;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName(value = "data_source",autoResultMap = true)
|
@TableName(value = "data_source",autoResultMap = true)
|
||||||
@EqualsAndHashCode(callSuper = true)
|
public class DataSource {
|
||||||
public class DataSource extends BaseEntity {
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
|
@ -37,83 +36,97 @@ public class DataSource extends BaseEntity {
|
||||||
* 接入源名称
|
* 接入源名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "接入源名称")
|
@Excel(name = "接入源名称")
|
||||||
|
@TableField ("name")
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 数据来源系统名称
|
* 数据来源系统名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "数据来源系统名称")
|
@Excel(name = "数据来源系统名称")
|
||||||
|
@TableField ("system_name")
|
||||||
private String systemName;
|
private String systemName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库类型
|
* 数据库类型
|
||||||
*/
|
*/
|
||||||
@Excel(name = "数据库类型")
|
@Excel(name = "数据库类型")
|
||||||
|
@TableField("data_type")
|
||||||
private String dataType;
|
private String dataType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ip地址
|
* ip地址
|
||||||
*/
|
*/
|
||||||
@Excel(name = "ip地址")
|
@Excel(name = "ip地址")
|
||||||
|
@TableField("ip")
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 端口号
|
* 端口号
|
||||||
*/
|
*/
|
||||||
@Excel(name = "端口号")
|
@Excel(name = "端口号")
|
||||||
|
@TableField("port")
|
||||||
private String port;
|
private String port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库名称
|
* 数据库名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "数据库名称")
|
@Excel(name = "数据库名称")
|
||||||
|
@TableField("database_name")
|
||||||
private String databaseName;
|
private String databaseName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
@Excel(name = "用户名")
|
@Excel(name = "用户名")
|
||||||
|
@TableField("user_name")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码
|
* 密码
|
||||||
*/
|
*/
|
||||||
@Excel(name = "密码")
|
@Excel(name = "密码")
|
||||||
|
@TableField("password")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据连接参数
|
* 数据连接参数
|
||||||
*/
|
*/
|
||||||
@Excel(name = "数据连接参数")
|
@Excel(name = "数据连接参数")
|
||||||
|
@TableField("connection_param")
|
||||||
private String connectionParam;
|
private String connectionParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否初始化 状态 'Y'/'N'
|
* 是否初始化 状态 'Y'/'N'
|
||||||
*/
|
*/
|
||||||
@Excel(name = "是否初始化")
|
@Excel(name = "是否初始化")
|
||||||
|
@TableField("is_init")
|
||||||
private String isInit;
|
private String isInit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化连接数量
|
* 初始化连接数量
|
||||||
*/
|
*/
|
||||||
@Excel(name = "初始连接数量")
|
@Excel(name = "初始连接数量")
|
||||||
|
@TableField("init_total")
|
||||||
private Long initNum;
|
private Long initNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大连接数量
|
* 最大连接数量
|
||||||
*/
|
*/
|
||||||
@Excel(name = "最大连接数量")
|
@Excel(name = "最大连接数量")
|
||||||
|
@TableField("max_num")
|
||||||
private Long maxNum;
|
private Long maxNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大等待时间
|
* 最大等待时间
|
||||||
*/
|
*/
|
||||||
@Excel(name = "最大等待时间")
|
@Excel(name = "最大等待时间")
|
||||||
|
@TableField("max_wait_time")
|
||||||
private Long maxWaitTime;
|
private Long maxWaitTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大等待次数
|
* 最大等待次数
|
||||||
*/
|
*/
|
||||||
@Excel(name = "最大等待次数")
|
@Excel(name = "最大等待次数")
|
||||||
|
@TableField("max_wait_size")
|
||||||
private Long maxWaitSize;
|
private Long maxWaitSize;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.source.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-08-20-22:36
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:Mybatis Plus 配置
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
public class MybatisPlusConfig {
|
||||||
|
// 配置分页插件
|
||||||
|
@Bean
|
||||||
|
public PaginationInnerInterceptor paginationInnerInterceptor() {
|
||||||
|
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
|
||||||
|
// 设置数据库类型为mysql
|
||||||
|
paginationInnerInterceptor.setDbType(DbType.MYSQL);
|
||||||
|
// 设置最大单页限制数量,默认 500 条,-1 不受限制
|
||||||
|
paginationInnerInterceptor.setMaxLimit(-1L);
|
||||||
|
return paginationInnerInterceptor;
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
/**
|
||||||
|
* 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html
|
||||||
|
*/
|
||||||
|
public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor()
|
||||||
|
{
|
||||||
|
return new OptimisticLockerInnerInterceptor();
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
/**
|
||||||
|
* 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html
|
||||||
|
*/
|
||||||
|
public BlockAttackInnerInterceptor blockAttackInnerInterceptor()
|
||||||
|
{
|
||||||
|
return new BlockAttackInnerInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,18 @@
|
||||||
package com.muyu.source.controller;
|
package com.muyu.source.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
|
||||||
|
import com.dtflys.forest.annotation.Post;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.muyu.source.domain.DataSource;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import com.muyu.source.service.DataSourceService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ Tool:IntelliJ IDEA
|
* @ Tool:IntelliJ IDEA
|
||||||
|
@ -12,8 +22,33 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
* @ Description:数据源控制层
|
* @ Description:数据源控制层
|
||||||
* @author Lenovo
|
* @author Lenovo
|
||||||
*/
|
*/
|
||||||
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/data_source")
|
@RequestMapping("/dataSource")
|
||||||
|
@Tag(name = "数据源控制层",description = "进行数据源管理,查看等相关操作")
|
||||||
public class DataSourceController extends BaseController {
|
public class DataSourceController extends BaseController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源业务层
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private DataSourceService dataSourceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源的全部数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<DataSource>> list(){
|
||||||
|
List<DataSource> list =dataSourceService.list();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<?> update(@RequestBody DataSource dataSource){
|
||||||
|
UpdateChainWrapper<DataSource> update = dataSourceService.update();
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.source.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.source.domain.DataSource;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-08-20-20:03
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:数据源持久层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DataSourceMapper extends BaseMapper<DataSource> {
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.source.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.source.domain.DataSource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-08-20-20:06
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:数据源业务层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
public interface DataSourceService extends IService<DataSource> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.source.service.Impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.source.domain.DataSource;
|
||||||
|
import com.muyu.source.mapper.DataSourceMapper;
|
||||||
|
import com.muyu.source.service.DataSourceService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-08-20-20:06
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:数据源业务层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSource> implements DataSourceService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -52,4 +52,12 @@ spring:
|
||||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
# rabbit 配置文件
|
# rabbit 配置文件
|
||||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
#mybatis-plus 配置
|
||||||
|
mybatis-plus:
|
||||||
|
#xml文件位置
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
#控制台打印信息
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
#驼峰配置
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
|
Loading…
Reference in New Issue