Pārlūkot izejas kodu

git-svn-id: https://192.168.57.71/svn/jsgkj@455 931142cf-59ea-a443-aa0e-51397b428577

ld_zhoutl 9 gadi atpakaļ
vecāks
revīzija
721e87efdb

+ 4 - 1
xtdsp/trunk/src/main/java/com/xt/dsp/controller/DatasourceCtl.java

@@ -10,6 +10,7 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import com.xt.dsp.common.util.CommonUtil;
 import com.xt.dsp.common.util.ConstUtil;
 import com.xt.dsp.model.DataSourceBean;
 import com.xt.dsp.service.DataSourceService;
@@ -63,12 +64,14 @@ public class DatasourceCtl {
 	public DataSourceBean saveDataSource(Model model,DataSourceVo vo) {
 		DataSourceBean saveBean = new DataSourceBean();
 		// 新增
-		if(ConstUtil.OPER_ADD.equals(vo.getOpt())) {
+		if (StringUtils.isNullOrEmpty(vo.getId())) {
 			BeanUtils.copyProperties(vo, saveBean);
+			saveBean.setId(CommonUtil.getUUID());
 			datasourceService.insert(saveBean);
 		} else {
 			// 修改
 			saveBean = datasourceService.selectByPrimaryKey(vo.getId());
+			saveBean.setCode(vo.getCode());
 			saveBean.setUrl(vo.getUrl());
 			saveBean.setDriverclassname(vo.getDriverclassname());
 			saveBean.setUsername(vo.getUsername());

+ 7 - 0
xtdsp/trunk/src/main/java/com/xt/dsp/vo/DataSourceVo.java

@@ -4,6 +4,7 @@ import com.xt.dsp.common.BaseVo;
 
 public class DataSourceVo extends BaseVo{
 	private String id;
+	private String code;
 	private String url;
 	private String driverclassname;
 	private String username;
@@ -23,6 +24,12 @@ public class DataSourceVo extends BaseVo{
 	public void setId(String id) {
 		this.id = id;
 	}
+	public String getCode() {
+		return code;
+	}
+	public void setCode(String code) {
+		this.code = code;
+	}
 	public String getUrl() {
 		return url;
 	}

+ 5 - 4
xtdsp/trunk/src/main/webapp/WEB-INF/view/sys/datasource/datasource.jsp

@@ -57,10 +57,10 @@
 								<form class="form-horizontal" onsubmit="return false">
 									<label class="col-sm-12 control-label"></label>
 									<div class="form-group">
-										<label for="srchId" class="col-sm-2 control-label">ID</label>
+										<label for="srchCode" class="col-sm-2 control-label">CODE</label>
 										<div class="col-sm-2">
 											<input type="text" class="form-control limited"
-												id="srchId" placeholder="">
+												id="srchCode" placeholder="">
 										</div>
 										<label for="srchUserName" class="col-sm-2 control-label">用户名</label>
 										<div class="col-sm-2">
@@ -106,12 +106,13 @@
 					<div class="modal-body no-padding">
 						<form class="form-horizontal" id="form" method="post"
 							onsubmit="return false;">
+							<input type="hidden" id="id" name="id">
 							<div class="form-group">
-								<label for="id" class="col-sm-2 control-label">ID</label>
+								<label for="code" class="col-sm-2 control-label">CODE</label>
 								<div class="col-sm-9">
 									<div id="idError"></div>
 									<input type="text" class="form-control limited {required:true}"
-										id="id" name="id" maxlength="100">
+										id="code" name="code" maxlength="100">
 								</div>
 								<div class="col-sm-1">
 									<span id="idImageTip" class="sp_yes"

+ 2 - 2
xtdsp/trunk/src/main/webapp/js/rwgl/tasksql/tasksql.js

@@ -209,8 +209,8 @@ function initDdl() {
 			    var length=data.length;
 			    if(length > 0) {
 				    for(var i=0;i<length;i++){
-				    	$("<option/>").html(data[i].id).val(data[i].id).appendTo("#srcConn");
-				    	$("<option/>").html(data[i].id).val(data[i].id).appendTo("#targetConn");
+				    	$("<option/>").html(data[i].code).val(data[i].id).appendTo("#srcConn");
+				    	$("<option/>").html(data[i].code).val(data[i].id).appendTo("#targetConn");
 				    }
 			    }
 			}

+ 4 - 3
xtdsp/trunk/src/main/webapp/js/sys/datasource/datasource.js

@@ -45,7 +45,7 @@ function initGrid() {
 	    shrinkToFit: true,
 		sortname : "", //默认的排序列
 		sortorder : "", //默认的排序列
-		colNames : [ '','id','ID', 'URL','用户名','密码','驱动','最大连接池数量'],
+		colNames : [ '','id','CODE', 'URL','用户名','密码','驱动','最大连接池数量'],
 		colModel : [ {
             name:'Edit',
             index:'Edit',
@@ -60,8 +60,8 @@ function initGrid() {
 			editable : false,
 			sortable : false
 		},{
-			name : 'id',
-			index : 'id',
+			name : 'code',
+			index : 'code',
             width:80,
 			editable : false,
 			sortable : true
@@ -338,6 +338,7 @@ function initBaseInfo(rowid, flg){
 		success : function(data) {
 			// 填充信息
 			$('#id').val(data.id);
+			$('#code').val(data.code);
 			$('#url').val(data.url);
 			$('#driverclassname').val(data.driverclassname);
 			$('#username').val(data.username);