|
@@ -2,15 +2,15 @@ package com.xt.dsp.controller;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
-import org.h2.util.StringUtils;
|
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
+import com.xt.dsp.common.util.ConstUtil;
|
|
import com.xt.dsp.model.DataSourceBean;
|
|
import com.xt.dsp.model.DataSourceBean;
|
|
-import com.xt.dsp.model.TaskBean;
|
|
|
|
import com.xt.dsp.service.DataSourceService;
|
|
import com.xt.dsp.service.DataSourceService;
|
|
import com.xt.dsp.vo.DataSourceVo;
|
|
import com.xt.dsp.vo.DataSourceVo;
|
|
import com.yuanxd.tools.pagehelper.PageHelper;
|
|
import com.yuanxd.tools.pagehelper.PageHelper;
|
|
@@ -30,7 +30,7 @@ public class DatasourceCtl {
|
|
@RequestMapping("main")
|
|
@RequestMapping("main")
|
|
public String main() {
|
|
public String main() {
|
|
//DataSourceBean bean = new DataSourceBean();
|
|
//DataSourceBean bean = new DataSourceBean();
|
|
- return "rwgl/datasource/datasource";
|
|
|
|
|
|
+ return "sys/datasource/datasource";
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -47,7 +47,7 @@ public class DatasourceCtl {
|
|
vo.setRows(1);
|
|
vo.setRows(1);
|
|
}
|
|
}
|
|
PageHelper.startPage(vo.getPage(), vo.getRows());
|
|
PageHelper.startPage(vo.getPage(), vo.getRows());
|
|
- List<DataSourceBean> list = null;//datasourceService;
|
|
|
|
|
|
+ List<DataSourceBean> list = datasourceService.selectAll();
|
|
PageInfo<DataSourceBean> pageResult = new PageInfo<>(list);
|
|
PageInfo<DataSourceBean> pageResult = new PageInfo<>(list);
|
|
return pageResult;
|
|
return pageResult;
|
|
}
|
|
}
|
|
@@ -62,17 +62,27 @@ public class DatasourceCtl {
|
|
public DataSourceBean saveDataSource(Model model,DataSourceVo vo) {
|
|
public DataSourceBean saveDataSource(Model model,DataSourceVo vo) {
|
|
DataSourceBean saveBean = new DataSourceBean();
|
|
DataSourceBean saveBean = new DataSourceBean();
|
|
// 新增
|
|
// 新增
|
|
- if(StringUtils.isNullOrEmpty(vo.getId())) {
|
|
|
|
-// BeanUtils.copyProperties(vo, saveBean);
|
|
|
|
-// saveBean.setId(CommonUtil.getUUID());
|
|
|
|
- //saveBean.setStatus("0");
|
|
|
|
|
|
+ if(ConstUtil.OPER_ADD.equals(vo.getOpt())) {
|
|
|
|
+ BeanUtils.copyProperties(vo, saveBean);
|
|
|
|
+ datasourceService.insert(saveBean);
|
|
} else {
|
|
} else {
|
|
// 修改
|
|
// 修改
|
|
-// saveBean = datasourceService.findOne(vo.getId());
|
|
|
|
-// saveBean.setName(vo.getName());
|
|
|
|
-// saveBean.setCode(vo.getCode());
|
|
|
|
|
|
+ saveBean = datasourceService.selectByPrimaryKey(vo.getId());
|
|
|
|
+ saveBean.setUrl(vo.getUrl());
|
|
|
|
+ saveBean.setDriverclassname(vo.getDriverclassname());
|
|
|
|
+ saveBean.setUsername(vo.getUsername());
|
|
|
|
+ saveBean.setPassword(vo.getPassword());
|
|
|
|
+ saveBean.setInitialsize(vo.getInitialsize());
|
|
|
|
+ saveBean.setMinidle(vo.getMinidle());
|
|
|
|
+ saveBean.setMaxactive(vo.getMaxactive());
|
|
|
|
+ saveBean.setTimebetweenevictionrunsmillis(vo.getTimebetweenevictionrunsmillis());
|
|
|
|
+ saveBean.setMinevictableidletimemillis(vo.getMinevictableidletimemillis());
|
|
|
|
+ saveBean.setTestonreturn(vo.getTestonreturn());
|
|
|
|
+ saveBean.setPoolpreparedstatements(vo.getPoolpreparedstatements());
|
|
|
|
+ saveBean.setMaxpoolpreparedstatementpercon(vo.getMaxpoolpreparedstatementpercon());
|
|
|
|
+ saveBean.setValidationquery(vo.getValidationquery());
|
|
|
|
+ datasourceService.updateByPrimaryKey(saveBean);
|
|
}
|
|
}
|
|
-// datasourceService.save(saveBean);
|
|
|
|
return saveBean;
|
|
return saveBean;
|
|
}
|
|
}
|
|
|
|
|