Просмотр исходного кода

解决数据库信息未保存问题

胡杰 1 год назад
Родитель
Сommit
5ddbd421c8

+ 7 - 4
cn.com.taiji.system/src/main/java/cn/com/taiji/zhongxiao/web/TinfoClassHitchController.java

@@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import cn.com.taiji.util.StrUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -246,6 +247,9 @@ public class TinfoClassHitchController {
 	if (dblist!= null && dblist.size() > 0) {
 		defaultdb = dblist.get(0).getDbId();
 	}
+	if (StrUtils.isNotEmpty(info.getDbid())) {
+		defaultdb = info.getDbid();
+	}
 	model.addAttribute("defaultdb",defaultdb);
 	model.addAttribute("gjchange",gjchange);
 	loginfoService.logDealInfo("3", modelType,"信息类查看", "t_infoclass", id, ToolUtil.getIpAddr(request), request.getRequestURI(),userInfo);
@@ -265,6 +269,7 @@ public class TinfoClassHitchController {
 	List<TguajieopinionList> opinionList = tinfoClassService.findTguajieopinionListByDataId(id,"t_infoclass");
 	model.addAttribute("checkinfo", "1");
 	model.addAttribute("opinionList", opinionList);
+	model.addAttribute("defaultdb", info.getDbid());
 	loginfoService.logDealInfo("3", modelType,"挂接审核", "t_infoclass", id, ToolUtil.getIpAddr(request), request.getRequestURI(),userInfo);
 	return "thymeleaf/tinfohitchclass/tinfoclass_view";
     }
@@ -277,10 +282,6 @@ public class TinfoClassHitchController {
 	model.addAttribute("info", info);
 	List<Dbinfo> dblist= dbinfoService.findDbinfoListByDeptid(info.getProvidebmcode());
 	model.addAttribute("dblist", dblist);
-	Dbinfo dbinfo =new Dbinfo();
-	if(!ToolUtil.isNull(info.getDbid())) {
-		dbinfo = dbinfoService.findInfoById(info.getDbid());
-	}
 	List<TguajieopinionList> opinionList = tinfoClassService.findTguajieopinionListByDataId(id,"t_infoclass");
 	model.addAttribute("opinionList", opinionList);
 	loginfoService.logDealInfo("3", modelType,"信息类查看", "t_infoclass", id, ToolUtil.getIpAddr(request), request.getRequestURI(),userInfo);
@@ -363,6 +364,7 @@ public class TinfoClassHitchController {
 	if(!ToolUtil.isNull(gjchange)) {
 		info.setGjcheckstate("1");//选择变更时,改成待审状态
 	}
+	info.setDbid(dto.getDbid());
 	info.setHitch(dto.getHitch());//挂接情况说明
 	if("2".equals(info.getGjcheckstate())) {
 		info.setHitchStatus(1);//挂接情况状态  1是已挂接   0未挂接
@@ -370,6 +372,7 @@ public class TinfoClassHitchController {
 	else {
 		info.setHitchStatus(0);
 	}
+
 	tinfoClassService.saveTinfoClass(new TinfoClass(info));
 	if("1,2,3".contains(info.getGjcheckstate())) {
 		String result="审核通过";

+ 2 - 0
cn.com.taiji.system/src/main/resources/templates/thymeleaf/tinfohitchclass/tinfoclass_onlyview.html

@@ -176,6 +176,8 @@
              $("#dbid").val(defaultdb);
              $("#dbid").change();
          }
+         $("#dbid").attr("disabled","disabled");
+         $("#hitch").attr("disabled","disabled");
      });
  /*]]>*/
  </script>	

+ 5 - 0
cn.com.taiji.system/src/main/resources/templates/thymeleaf/tinfohitchclass/tinfoclass_view.html

@@ -216,6 +216,7 @@
 	 //获取变更状态
 	 var gjchange=/*[[${gjchange}]]*/;
      var defaultdb=/*[[${defaultdb}]]*/;
+     var checkinfo=/*[[${checkinfo}]]*/;
  
 	 //点击上传附件   跟新表单内容
 	   //$("#hitchUpBut").click(function(){
@@ -233,6 +234,10 @@
              $("#dbid").val(defaultdb);
              $("#dbid").change();
          }
+         if (checkinfo == "1") {
+             $("#dbid").attr("disabled","disabled");
+             $("#hitch").attr("disabled","disabled");
+         }
      });
  var changeDbId = function(options){
      $("#dbName").text(options.attr("dbName"));