添加查询标签数据源value接口

This commit is contained in:
yangsb
2024-04-03 16:15:21 +08:00
parent e08dc9324c
commit b0dfc889ff
15 changed files with 123 additions and 9 deletions
@@ -0,0 +1,29 @@
package com.cf.imes.module.system.api.datasource;
import com.cf.imes.framework.common.exception.ErrorCode;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceDO;
import com.cf.imes.module.system.dal.mysql.datasource.DataSourceMapper;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Objects;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
@RestController
public class DataSourceApiImpl implements DataSourceApi {
@Resource
private DataSourceMapper dataSourceMapper;
@Override
public CommonResult<String> getSqlById(Long id) {
DataSourceDO dataSourceDO = dataSourceMapper.selectById(id);
if(Objects.isNull(dataSourceDO)) {
throw exception(new ErrorCode(2133,"数据源不存在"));
}
return CommonResult.success(dataSourceDO.getSqlStr()) ;
}
}
@@ -19,7 +19,7 @@ public class DataSourcePageReqVO extends PageParam {
private String name;
@Schema(description = "sql")
private String sql;
private String sqlStr;
@Schema(description = "数据源类型", example = "2")
private Integer type;
@@ -24,7 +24,7 @@ public class DataSourceRespVO {
@Schema(description = "sql", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("sql")
private String sql;
private String sqlStr;
@Schema(description = "数据源类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("数据源类型")
@@ -34,7 +34,7 @@ public class DataSourceDO extends BaseDO {
/**
* sql
*/
private String sql;
private String sqlStr;
/**
* 数据源类型
*/
@@ -20,7 +20,7 @@ public interface DataSourceMapper extends BaseMapperX<DataSourceDO> {
default PageResult<DataSourceDO> selectPage(DataSourcePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DataSourceDO>()
.likeIfPresent(DataSourceDO::getName, reqVO.getName())
.eqIfPresent(DataSourceDO::getSql, reqVO.getSql())
.eqIfPresent(DataSourceDO::getSqlStr, reqVO.getSqlStr())
.eqIfPresent(DataSourceDO::getType, reqVO.getType())
.betweenIfPresent(DataSourceDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DataSourceDO::getId));