|
@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.template.common.utils.CommonUtil;
|
|
import com.template.common.utils.CommonUtil;
|
|
|
import com.template.mapper.SmartDataClassMapper;
|
|
import com.template.mapper.SmartDataClassMapper;
|
|
|
import com.template.mapper.SmartDataSourceMapper;
|
|
import com.template.mapper.SmartDataSourceMapper;
|
|
|
import com.template.model.pojo.SmartDataClass;
|
|
import com.template.model.pojo.SmartDataClass;
|
|
|
import com.template.model.pojo.SmartDataSource;
|
|
import com.template.model.pojo.SmartDataSource;
|
|
|
|
|
+import com.template.model.pojo.SmartDataTaskErr;
|
|
|
import com.template.model.result.PageUtils;
|
|
import com.template.model.result.PageUtils;
|
|
|
import com.template.services.SmartDataSourceService;
|
|
import com.template.services.SmartDataSourceService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -146,6 +149,13 @@ public class SmartDataSourceServiceImpl extends ServiceImpl<SmartDataSourceMappe
|
|
|
return CommonUtil.getReturnMap("1", "数据未修改,请修改后再提交!");
|
|
return CommonUtil.getReturnMap("1", "数据未修改,请修改后再提交!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ Map<String, Object> stringObjectMap = vcoSmartDataSource(smartDataSource);
|
|
|
|
|
+ if ("1".equals(stringObjectMap.get("code"))) {
|
|
|
|
|
+ smartDataSource.setDsStatus(0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ smartDataSource.setDsStatus(1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
int result = smartDataSourceMapper.updateById(smartDataSource);
|
|
int result = smartDataSourceMapper.updateById(smartDataSource);
|
|
|
if (result > 0) {
|
|
if (result > 0) {
|
|
|
return CommonUtil.getReturnMap("0", "数据源修改成功!");
|
|
return CommonUtil.getReturnMap("0", "数据源修改成功!");
|
|
@@ -155,16 +165,10 @@ public class SmartDataSourceServiceImpl extends ServiceImpl<SmartDataSourceMappe
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public PageUtils<SmartDataSource> queryPageSmartDataSources(int currentPage, int pageCount, SmartDataSource smartDataSource) {
|
|
|
|
|
- Page<SmartDataSource> page = new Page<>(currentPage, pageCount);
|
|
|
|
|
- QueryWrapper<SmartDataSource> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
- queryWrapper.like(StringUtils.hasText(smartDataSource.getDsName()), "ds_name", smartDataSource.getDsName());
|
|
|
|
|
- queryWrapper.like(StringUtils.hasText(smartDataSource.getDsUrl()), "ds_url", smartDataSource.getDsUrl());
|
|
|
|
|
- queryWrapper.like(smartDataSource.getDsStatus() != null, "ds_status", smartDataSource.getDsStatus());
|
|
|
|
|
- queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsDescrition()), "ds_descrition", smartDataSource.getDsDescrition());
|
|
|
|
|
- queryWrapper.orderByDesc("ds_update_time");
|
|
|
|
|
- IPage<SmartDataSource> result = smartDataSourceMapper.selectPage(page, queryWrapper);
|
|
|
|
|
- return new PageUtils<>(result);
|
|
|
|
|
|
|
+ public PageInfo<SmartDataSource> queryPageSmartDataSources(int currentPage, int pageCount, SmartDataSource smartDataSource) {
|
|
|
|
|
+ PageHelper.startPage(currentPage, pageCount);
|
|
|
|
|
+ List<SmartDataSource> result = smartDataSourceMapper.selectPageDsSource(smartDataSource);
|
|
|
|
|
+ return new PageInfo<>(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -190,8 +194,7 @@ public class SmartDataSourceServiceImpl extends ServiceImpl<SmartDataSourceMappe
|
|
|
return CommonUtil.getReturnMap("1", "选择的【数据源类型】不存在!");
|
|
return CommonUtil.getReturnMap("1", "选择的【数据源类型】不存在!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String dsClsDriver = smartDataClass.getDsClsDriver();
|
|
|
|
|
- dataSource.setDriverClassName(dsClsDriver);
|
|
|
|
|
|
|
+ dataSource.setDriverClassName(smartDataClass.getDsClsDriver());
|
|
|
dataSource.setUrl(smartDataSource.getDsUrl());
|
|
dataSource.setUrl(smartDataSource.getDsUrl());
|
|
|
dataSource.setUsername(smartDataSource.getDsUser());
|
|
dataSource.setUsername(smartDataSource.getDsUser());
|
|
|
dataSource.setPassword(smartDataSource.getDsPassword());
|
|
dataSource.setPassword(smartDataSource.getDsPassword());
|