From be1267c82755ea2217e3e84d6b47661eaf075497 Mon Sep 17 00:00:00 2001 From: didiyu <1293722656@qq.com> Date: 星期二, 25 九月 2018 16:04:15 +0800 Subject: [PATCH] Merge branch 'dev_lxw' of https://didiyu@gitlab.com/whyclxw1/gx_tieta.git into dev_lxw --- gx_tieta/WebRoot/css/control_style.css | 1 gx_tieta/WebRoot/control.jsp | 60 ++++- gx_tieta/src/com/fgkj/actions/BattInfAction.java | 40 ++ gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java | 132 ++++++---- gx_tieta/src/com/fgkj/db/DBUtil.java | 3 gx_tieta/.mymetadata | 2 gx_tieta/WebRoot/pages/js/pages/siderbar.js | 304 +++++++++++++++++++++++++ gx_tieta/WebRoot/css/common.css | 70 +++++ gx_tieta/src/com/fgkj/services/BattInfServices.java | 61 +++- gx_tieta/.settings/org.eclipse.wst.common.component | 2 10 files changed, 580 insertions(+), 95 deletions(-) diff --git a/gx_tieta/.mymetadata b/gx_tieta/.mymetadata index 4baae0d..258d6d2 100644 --- a/gx_tieta/.mymetadata +++ b/gx_tieta/.mymetadata @@ -3,7 +3,7 @@ type="WEB" name="gx_tieta" id="myeclipse.1459308958540" - context-root="/fuguang" + context-root="/gx_tieta" j2ee-spec="5.0" archive="gx_tieta.war"> <attributes> diff --git a/gx_tieta/.settings/org.eclipse.wst.common.component b/gx_tieta/.settings/org.eclipse.wst.common.component index ac2fc84..58adfff 100644 --- a/gx_tieta/.settings/org.eclipse.wst.common.component +++ b/gx_tieta/.settings/org.eclipse.wst.common.component @@ -4,6 +4,6 @@ <wb-resource deploy-path="/" source-path="/WebRoot"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/> <property name="java-output-path" value="/fuguang/WebRoot/WEB-INF/classes"/> - <property name="context-root" value="/fuguang"/> + <property name="context-root" value="/gx_tieta"/> </wb-module> </project-modules> diff --git a/gx_tieta/WebRoot/control.jsp b/gx_tieta/WebRoot/control.jsp index 74b0ab4..e792f0f 100644 --- a/gx_tieta/WebRoot/control.jsp +++ b/gx_tieta/WebRoot/control.jsp @@ -15,6 +15,7 @@ <link href="css/basic.css" type="text/css" rel="stylesheet" /> <link href="css/control_style.css" type="text/css" rel="stylesheet" /> <link rel="stylesheet" href="css/BrdwMaint.css"> + <link rel="stylesheet" href="css/common.css"> <link href="jqueryui/jquery-ui.css" type="text/css" rel="stylesheet" /> <!-- <link rel="stylesheet" type="text/css" href="css/popup.css"> --> <link rel="stylesheet" type="text/css" href="css/popup-tbl.css"> @@ -840,6 +841,7 @@ <script type="text/javascript" src="js/dischargetest/bts.js"></script> <script type="text/javascript" src="js/dischargetest/4016.js"></script> <script type="text/javascript" src="pages/js/pages/control-common.js"></script> + <script type="text/javascript" src="pages/js/pages/siderbar.js"></script> <!-- 寮曞叆鐢佃矾鍥� --> <script type="text/javascript" src="js/elecircle.js"></script> <script type="text/javascript" src="js/elecircle.content.js"></script> @@ -1111,7 +1113,7 @@ } - seachAllStation(); + //seachAllStation(); //鏌ヨ鎵�鏈夋満鎴� function seachAllStation(){ $.ajax({ @@ -2672,17 +2674,6 @@ $(this).attr('href', 'charge-test.jsp?battgroupId='+BattGroupId+"&stationId="+batt.StationId); }); }); - - - $(function() { - $('#ele_content').resizable({ - minWidth: 240, - maxWidth: 520, - handles: 'e', - edge: 10 - }); - }); - $(function(){ //鍚姩鏌ヨ鐢垫睜鍏呮斁鐢电姸鎬佺殑绾跨▼ @@ -3944,6 +3935,51 @@ $('.confirm').hide(); $('.confirm-mask').hide(); } + + // siderbar妯″潡 + $(function() { + var TreeView = GLOBAL.pages.TreeView; + var first = GLOBAL.pages.siderbar.first; // 涓�绾у鑸� + var second = GLOBAL.pages.siderbar.second; // 浜岀骇瀵艰埅 + var third = GLOBAL.pages.siderbar.third; // 涓夌骇瀵艰埅 + var fourth = GLOBAL.pages.siderbar.fourth; // 鍥涚骇瀵艰埅 + var treeView = new TreeView($('#lside')); + // 璁剧疆瀹瑰櫒鍙嫋鍔� + $('#ele_content').resizable({ + handles: 'e', + maxWidth: 520, + minWidth: 200, + alsoResize: $('#lside'), + resize:function() { + treeView.setContainer(); + } + }); + + // 鐢熸垚涓�绾у鑸�-鐪� + first(treeView, treeView.container); + + // 鐪�->甯� + treeView.ele.on('click', '.province', function() { + var province = $(this).data('attr'); + second(treeView, $(this).parent(), province); + }); + + // 甯�->鏈烘埧 + treeView.ele.on('click', '.city', function() { + var city = $(this).data('attr'); + third(treeView, $(this).parent(), city); + }); + + // 鏈烘埧->鐢垫睜缁� + treeView.ele.on('click', '.home', function() { + var home = $(this).data('attr'); + var tmp = { + StationId: home.StationId + }; + console.info(tmp); + fourth(treeView, $(this).parent(), tmp); + }); + }); </script> <script type="text/javascript" src="js/Title.js"></script> <script type="text/javascript" src="js/control.js"></script> diff --git a/gx_tieta/WebRoot/css/common.css b/gx_tieta/WebRoot/css/common.css new file mode 100644 index 0000000..b3ce739 --- /dev/null +++ b/gx_tieta/WebRoot/css/common.css @@ -0,0 +1,70 @@ +/* side-bar-menu妯″潡 */ +.whyc-sider-menu-container { + overflow: hidden; +} +.whyc-sider-menu { + height: 100%; + background-color: #272822; + font-size: 14px; + overflow: hidden; + overflow-y: auto; +} +/* first */ +.whyc-sider-menu>ul>li>a>i.fa { + margin-left: .5em; +} +/* second */ +.whyc-sider-menu>ul>li>ul>li>a>i.fa { + margin-left: 1em; +} +/* third */ +.whyc-sider-menu>ul>li>ul>li>ul>li>a>i.fa { + margin-left: 1.5em; +} +/* fourth */ +.whyc-sider-menu>ul>li>ul>li>ul>li>ul>li>a>i.fa { + margin-left: 2em; +} +.whyc-sider-menu i.fa { + color: #676863; + font-size: 22px; + vertical-align: middle; + margin-right: .5em; +} +.sider-menu-folder, .sider-menu-file { + display: block; + padding: .3em 0; + color: #cfcfc2; + white-space: nowrap; +} +.sider-menu-folder:hover, .sider-menu-file:hover { + background-color: #494a45; + text-decoration: none; +} + +.sider-menu-file.active { + color: #FFFFFF; + background-color: #818280; +} +.sider-menu-open>a>.fa-caret-right { + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -o-transform: rotate(90deg); + transform: rotate(90deg); +} + +.whyc-sider-menu>ul ul { + display: none; +} +.whyc-sider-menu .sider-menu-open>ul { + display: block; +} +.ui-resizable-e { + width: 10px; +} +.whyc-sider-menu .sider-menu-open>.treeView-progressBar-container { + display: block; +} +.whyc-sider-menu .treeView-progressBar-container { + display: none; +} \ No newline at end of file diff --git a/gx_tieta/WebRoot/css/control_style.css b/gx_tieta/WebRoot/css/control_style.css index 262e1f4..db48907 100644 --- a/gx_tieta/WebRoot/css/control_style.css +++ b/gx_tieta/WebRoot/css/control_style.css @@ -55,7 +55,6 @@ width: 100%; height:460px; background: white; - overflow:scroll; position: relative; } #lside>ul{ diff --git a/gx_tieta/WebRoot/pages/js/pages/siderbar.js b/gx_tieta/WebRoot/pages/js/pages/siderbar.js new file mode 100644 index 0000000..5c809fb --- /dev/null +++ b/gx_tieta/WebRoot/pages/js/pages/siderbar.js @@ -0,0 +1,304 @@ +;(function($, window, document, gl) { + // 瀹氫箟TreeView鐨勫懡鍚嶇┖闂� + gl.namespace('pages.TreeView'); + + /** + * @param jquery ele jQuery 瀵硅薄 + * @param Object first 绗竴灞傜殑鏁版嵁瀵硅薄 + */ + var TreeView = function (ele, options) { + this.ele = ele; + this.container; + this.init(options); + }; + + var _prop = TreeView.prototype; + + // 鍒濆鍖栧鍣ㄥ苟璁剧疆鍩虹鐨勭偣鍑讳簨浠� + _prop.init = function(options) { + var _this = this; + // 娓呯┖瀹瑰櫒 + this.ele.addClass('whyc-sider-menu-container'); + this.ele.text(''); + + var whycTreeView = $('<div class="whyc-sider-menu"></div>'); + this.ele.append(whycTreeView); + + this.container = whycTreeView; + this.setContainer(); + //this.resize(options); + + // 缁欏鍣ㄥ唴瀹规坊鍔犵粦瀹氫簨浠� + this.ele.off('click.treeView.folder').on('click.treeView.folder', '.sider-menu-folder', function() { + $(this).parent().toggleClass('sider-menu-open'); + }); + + this.ele.off('click.treeView.file').on('click.treeView.file', '.sider-menu-file', function() { + if(!$(this).hasClass('active')) { + _this.ele.find('.sider-menu-file').removeClass('active'); + $(this).addClass('active'); + } + }); + }; + + // 璁剧疆resizable + _prop.resize = function(options) { + var _this = this; + var defaults = { + minWidth: 200, + maxWidth: 400 + }; + var opts = $.extend({}, defaults, options || {}); + if(this.ele.resizable) { + this.ele.resizable({ + handles: 'e', + maxWidth: opts.maxWidth, + minWidth: opts.minWidth, + alsoResize: this.container, + stop:function() { + _this.container.height('100%'); + } + }); + } + }; + + // 璁剧疆瀹瑰櫒鐨勫搴� + _prop.setContainer = function() { + var eleWidth = this.ele.width(); + this.container.width(eleWidth+20); + }; + + // 鐢熸垚鍒楄〃 + _prop.treeView = function(container, data, flush) { + var defaults = { + file: false + }; + // 瀛樺湪ul涓斿綋鍓嶄笉鍏佽鍒锋柊 + if(container.find('ul').length !=0 && !flush) { + return; + }else if(flush) { + container.text(''); + } + + // 鍒犻櫎绛夊緟妗� + this.delProgress(container); + // 鐢熸垚鍏冪礌 + var _ul = $('<ul></ul>'); + for(var i=0; i<data.length; i++) { + var _data = $.extend({}, defaults, data[i]); + // 璁剧疆鍐呭瀹瑰櫒 + var _li = $('<li></li>'); + var _a = $('<a href="javascript:;" class="sider-menu-folder"></a>'); + _a.addClass(_data.cla); + var _i = $('<i class="fa fa fa-caret-right"></i>'); + var _span = $('<span>'+_data.txt+'</span>'); + if(_data.file) { + _a = $('<a href="javascript:;" class="sider-menu-file"></a>'); + _i = $('<i class="fa"></i>'); + } + + _a.append(_i); + _a.append(_span); + _li.append(_a); + + // 瀛樺偍鐢熸垚鍏冪礌鐨勫�� + _a.data('attr', _data.attr); + + _ul.append(_li); + } + + container.append(_ul); + }; + + // 鑾峰彇folder鐨勪竴鏉℃暟鎹� + _prop.getFolder = function (txt, cla, attr) { + var tmp = {}; + tmp.txt = txt; + tmp.cla = cla; + tmp.attr = attr; + return tmp; + }; + + // 鑾峰彇file鐨勪竴鏉℃暟鎹� + _prop.getFile =function(txt, cla, attr) { + var tmp = {}; + tmp.txt = txt; + tmp.cla = cla; + tmp.file = true; + tmp.attr = attr; + return tmp; + }; + + // 娣诲姞progressBar + _prop.addProgress = function(container) { + // 瀛樺湪灏变笉鐢ㄥ啀娣诲姞 + if(container.find('.treeView-progressBar-container').length != 0) { + return; + } + var cont = $('<div class="treeView-progressBar-container" style="margin-left: 15px; margin-right: 15px;"></div>'); + var progress = $('<div class="treeView-progressBar"></div>'); + var progressLabel = '<div class="progress-label">鍔犺浇...</div>'; + + progress.append(progressLabel); + cont.append(progress); + container.append(cont); + + // 璁剧疆鏍峰紡 + progress.progressbar({ + value: false, + change: function() { + progressLabel.text( progressbar.progressbar( "value" ) + "%" ); + }, + complete: function() { + progressLabel.text( "瀹屾垚锛�" ); + } + }); + }; + + // 绉婚櫎progressBar + _prop.delProgress = function(container) { + container.find('.treeView-progressBar-container').remove(); + }; + + // 娣诲姞鍒癵l.pages.TreeView鐨勫懡鍚嶇┖闂翠笅 + gl.pages.TreeView = TreeView; +})(jQuery, window, document, GLOBAL); + +// 瀹氫箟椤甸潰涓殑siderbar缁勪欢 +;(function($, window, document, gl, undefined) { + gl.namespace('pages.siderbar'); + // 鐢熸垚涓�绾у鑸�-鐪� + function first(treeView, container) { + //treeView.addProgress(container); + $.ajax({ + type: "post", + url: "BattInfAction!serchAllStation", + async:true, + dataType:'json', + data:null, + success: function(data){ + var rs = JSON.parse(data.result); + if(rs.code == 1) { + var _data= rs.data; + var formatData = []; + for(var i=0; i<_data.length;i++) { + var __data = _data[i]; + var tmp = treeView.getFolder(__data.StationName1, 'province', __data); + formatData.push(tmp); + } + treeView.treeView(container, formatData); + }else { + + } + } + }); + } + + // 灏嗗嚱鏁扮粦瀹氬埌GLOBAL.pages.siderbar鐨勫懡鍚嶇┖闂翠笅 + gl.pages.siderbar.first = first; + + // 鐢熸垚浜岀骇瀵艰埅-甯� + function second(treeView, container, data) { + // 宸茬粡瀛樺湪 + if(container.find('ul').length !=0) { + return; + } + treeView.addProgress(container); + $.ajax({ + type: "post", + url: "BattInfAction!serchStationName2", + async:true, + dataType:'json', + data:"json = "+JSON.stringify(data), + success: function(data){ + var rs = JSON.parse(data.result); + if(rs.code == 1) { + var _data= rs.data; + var formatData = []; + for(var i=0; i<_data.length;i++) { + var __data = _data[i]; + var tmp = treeView.getFolder(__data.StationName2, 'city', __data); + formatData.push(tmp); + } + treeView.treeView(container, formatData); + }else { + + } + } + }); + } + + // 灏嗗嚱鏁扮粦瀹氬埌GLOBAL.pages.siderbar鐨勫懡鍚嶇┖闂翠笅 + gl.pages.siderbar.second = second; + + // 鐢熸垚 涓夌骇瀵艰埅-鏈烘埧 + function third(treeView, container, data) { + // 宸茬粡瀛樺湪 + if(container.find('ul').length !=0) { + return; + } + treeView.addProgress(container); + $.ajax({ + type: "post", + url: "BattInfAction!serchStationName3", + async:true, + dataType:'json', + data:"json = "+JSON.stringify(data), + success: function(data){ + var rs = JSON.parse(data.result); + if(rs.code == 1) { + var _data= rs.data; + var formatData = []; + for(var i=0; i<_data.length;i++) { + var __data = _data[i]; + var tmp = treeView.getFolder(__data.StationName3, 'home', __data); + formatData.push(tmp); + } + treeView.treeView(container, formatData); + }else { + + } + } + }); + } + + // 灏嗗嚱鏁扮粦瀹氬埌GLOBAL.pages.siderbar鐨勫懡鍚嶇┖闂翠笅 + gl.pages.siderbar.third = third; + + // 鐢熸垚 涓夌骇瀵艰埅-鐢垫睜缁� + function fourth(treeView, container, data) { + // 宸茬粡瀛樺湪 + if(container.find('ul').length !=0) { + return; + } + treeView.addProgress(container); + $.ajax({ + type: "post", + url: "BattInfAction!serchBattByStation", + async:true, + dataType:'json', + data:"json = "+JSON.stringify(data), + success: function(data){ + var rs = JSON.parse(data.result); + console.info(rs); + if(rs.code == 1) { + var _data= rs.data; + var formatData = []; + console.log(_data); + return; + for(var i=0; i<_data.length;i++) { + var __data = _data[i]; + var tmp = treeView.getFolder(__data.StationName3, 'eleGroup', __data); + formatData.push(tmp); + } + treeView.treeView(container, formatData); + }else { + + } + } + }); + } + + // 灏嗗嚱鏁扮粦瀹氬埌GLOBAL.pages.siderbar鐨勫懡鍚嶇┖闂翠笅 + gl.pages.siderbar.fourth = fourth; +})(jQuery, window, document, GLOBAL); \ No newline at end of file diff --git a/gx_tieta/src/com/fgkj/actions/BattInfAction.java b/gx_tieta/src/com/fgkj/actions/BattInfAction.java index e1558df..303fa16 100644 --- a/gx_tieta/src/com/fgkj/actions/BattInfAction.java +++ b/gx_tieta/src/com/fgkj/actions/BattInfAction.java @@ -243,13 +243,7 @@ return SUCCESS; } - //鏌ヨ鎵�鏈夌殑鏈烘埧 - public String serchAllStation(){ - User_inf u = (User_inf)getUser(); - ServiceModel model = service.serchAllStation(u); - result = ActionUtil.tojson(model); - return SUCCESS; - } + //鎼滅储鏈烘埧鎴栫數姹犵粍 public String serchStationOrBattgroup(){ @@ -258,9 +252,39 @@ result = ActionUtil.tojson(model); return SUCCESS; } - //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭� + //鏌ヨ鎵�鏈夌殑鐪佷唤(宸︿晶瀵艰埅绗竴灞傦紝鏌ユ墍鏈夌殑鐪佷唤,num涓瓨鏀緐id) + public String serchAllStation(){ + User_inf u = (User_inf)getUser(); + BattInf binf=new BattInf(); + binf.setNum(u.getUId()); + ServiceModel model = service.serchAllStation(binf); + result = ActionUtil.tojson(model); + return SUCCESS; + } + //鏌ヨ绠$悊鐨勫競(宸︿晶瀵艰埅绗簩灞傦紝鏌ユ墍鏈夌殑甯�,num涓瓨鏀緐id) + public String serchStationName2(){ + User_inf u = (User_inf)getUser(); + BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class); + binf.setNum(u.getUId()); + ServiceModel model = service.serchStationName2(binf); + result = ActionUtil.tojson(model); + return SUCCESS; + } + //鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id) + public String serchStationName3(){ + User_inf u = (User_inf)getUser(); + BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class); + binf.setNum(u.getUId()); + ServiceModel model = service.serchStationName3(binf); + result = ActionUtil.tojson(model); + return SUCCESS; + } + //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id) public String serchBattByStation(){ BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class); + User_inf u = (User_inf)getUser(); + binf.setNum(u.getUId()); + //System.out.println(binf); ServiceModel model = service.serchBattByStation(binf); result = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").toJson(model); return SUCCESS; diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java index 96b9411..c35bdf7 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java @@ -3244,83 +3244,107 @@ } - //鏌ヨ鎵�鏈夌殑鏈烘埧 + //鏌ヨ鎵�鏈夌殑鐪佷唤(宸︿晶瀵艰埅绗竴灞傦紝鏌ユ墍鏈夌殑鐪佷唤,num涓瓨鏀緐id) public List serchAllStation(Object obj){ - User_inf uinf=(User_inf) obj; - String sql="select DISTINCT stationid,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationName6,StationName7,StationName8,StationName9,fBSDeviceId " + + BattInf binf=(BattInf) obj;; + String sql="select DISTINCT StationName1 " + " FROM db_battinf.tb_battinf " + " where StationId in(" + " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" + " )"; - List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()},new CallBack() { + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum()},new CallBack() { public List getResults(ResultSet rs) { List list=new ArrayList(); - String conStr="-";//杩炴帴鏈烘埧鍚嶇О鐨勭鍙� - try { - while(rs.next()){ - BattInf batt = new BattInf(); - String stationName=""; - if(!rs.getString("StationName1").trim().equals("")){ - stationName+=rs.getString("StationName1"); + try { + while(rs.next()){ + BattInf batt = new BattInf(); + batt.setStationName1(rs.getString("stationName1")); + list.add(batt); } - if(!rs.getString("StationName2").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName2"); - } - if(!rs.getString("StationName3").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName3"); - } - if(!rs.getString("StationName4").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName4"); - } - if(!rs.getString("StationName5").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName5"); - } - if(!rs.getString("StationName6").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName6"); - } - if(!rs.getString("StationName7").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName7"); - } - if(!rs.getString("StationName8").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName8"); - } - if(!rs.getString("StationName9").trim().equals("")){ - stationName+=conStr; - stationName+=rs.getString("StationName9"); - } - batt.setStationName(stationName); - batt.setStationId(rs.getString("StationId")); - batt.setFBSDeviceId(rs.getInt("fBSDeviceId")); - list.add(batt); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } return list; } } ); return list; } - //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭� + + //鏌ヨ绠$悊鐨勫競(宸︿晶瀵艰埅绗簩灞傦紝鏌ユ墍鏈夌殑甯�,num涓瓨鏀緐id) + public List serchStationName2(Object obj){ + BattInf binf=(BattInf) obj; + String sql="select DISTINCT StationName1,StationName2 " + + " FROM db_battinf.tb_battinf " + + " where StationId in(" + + " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" + + " ) and StationName1 like ?"; + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%"},new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + try { + while(rs.next()){ + BattInf batt = new BattInf(); + batt.setStationName1(rs.getString("stationName1")); + batt.setStationName2(rs.getString("stationName2")); + list.add(batt); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + } ); + return list; + } + //鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id) + public List serchStationName3(Object obj){ + BattInf binf=(BattInf) obj; + String sql="select DISTINCT StationName3,stationid,fbsdeviceid " + + " FROM db_battinf.tb_battinf " + + " where StationId in(" + + " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" + + " ) and StationName1 like ? and StationName2 like ? "; + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%"},new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + try { + while(rs.next()){ + BattInf batt = new BattInf(); + batt.setStationName3(rs.getString("stationName3")); + batt.setStationId(rs.getString("stationId")); + batt.setFBSDeviceId(rs.getInt("fBSDeviceId")); + list.add(batt); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + } ); + return list; + } + + + //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id) public List serchBattByStation(Object obj){ BattInf binf=(BattInf) obj; String sql="select DISTINCT StationName,StationId,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattProducer,BattInUseDate,GroupIndexInFBSDevice " + "from db_battinf.tb_battinf where stationid=? " + + "and StationId in(" + + " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" + + " ) " + "ORDER BY StationName1,battgroupId "; - List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{binf.getStationId()},new CallBack() { + //System.out.println(sql); + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{binf.getStationId(),binf.getNum()},new CallBack() { public List getResults(ResultSet rs) { List list = new ArrayList(); - String conStr="-";//杩炴帴鏈烘埧鍚嶇О鐨勭鍙� try { while (rs.next()) { BattInf batt = new BattInf(); diff --git a/gx_tieta/src/com/fgkj/db/DBUtil.java b/gx_tieta/src/com/fgkj/db/DBUtil.java index 4c6e1bc..4195765 100644 --- a/gx_tieta/src/com/fgkj/db/DBUtil.java +++ b/gx_tieta/src/com/fgkj/db/DBUtil.java @@ -15,9 +15,10 @@ //private static String username="website"; //private static String password="amtb3737"; - //private static String url="jdbc:mysql://118.89.139.230:3360/db_user"; + private static String username="root"; private static String password="lmx8688139"; + //private static String url="jdbc:mysql://118.89.139.230:3360/db_user"; private static String url="jdbc:mysql://123.207.82.239:3360/db_user"; //private static String url="jdbc:mysql://192.168.0.34:3360/db_user"; //private static String url="jdbc:mysql://127.0.0.1:3360/db_user"; diff --git a/gx_tieta/src/com/fgkj/services/BattInfServices.java b/gx_tieta/src/com/fgkj/services/BattInfServices.java index b292edb..a6c5028 100644 --- a/gx_tieta/src/com/fgkj/services/BattInfServices.java +++ b/gx_tieta/src/com/fgkj/services/BattInfServices.java @@ -641,21 +641,7 @@ } return model; } - //鏌ヨ鎵�鏈夌殑鏈烘埧 - public ServiceModel serchAllStation(Object obj){ - List list=((BattInfImpl)dao).serchAllStation(obj); - if (list != null && list.size() > 0) { - model.setCode(1); - model.setData(list); - model.setMsg("鏌ヨ鎴愬姛!"); - }else{ - model.setCode(0); - model.setData(list); - model.setMsg("鏌ヨ澶辫触!"); - } - //System.out.println(model); - return model; - } + //鎼滅储鏈烘埧鎴栫數姹犵粍 public ServiceModel serchStationOrBattgroup(Object obj){ List list=((BattInfImpl)dao).serchStationOrBattgroup(obj); @@ -671,7 +657,49 @@ //System.out.println(list.size()); return model; } - //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭� + //鏌ヨ鎵�鏈夌殑鐪佷唤(宸︿晶瀵艰埅绗竴灞傦紝鏌ユ墍鏈夌殑鐪佷唤) + public ServiceModel serchAllStation(Object obj){ + List list=((BattInfImpl)dao).serchAllStation(obj); + if (list != null && list.size() > 0) { + model.setCode(1); + model.setData(list); + model.setMsg("鏌ヨ鎴愬姛!"); + }else{ + model.setCode(0); + model.setData(list); + model.setMsg("鏌ヨ澶辫触!"); + } + return model; + } + //鏌ヨ绠$悊鐨勫競(宸︿晶瀵艰埅绗簩灞傦紝鏌ユ墍鏈夌殑甯�,num涓瓨鏀緐id) + public ServiceModel serchStationName2(Object obj){ + List list=((BattInfImpl)dao).serchStationName2(obj); + if (list != null && list.size() > 0) { + model.setCode(1); + model.setData(list); + model.setMsg("鏌ヨ鎴愬姛!"); + }else{ + model.setCode(0); + model.setData(list); + model.setMsg("鏌ヨ澶辫触!"); + } + return model; + } + //鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id) + public ServiceModel serchStationName3(Object obj){ + List list=((BattInfImpl)dao).serchStationName3(obj); + if (list != null && list.size() > 0) { + model.setCode(1); + model.setData(list); + model.setMsg("鏌ヨ鎴愬姛!"); + }else{ + model.setCode(0); + model.setData(list); + model.setMsg("鏌ヨ澶辫触!"); + } + return model; + } + //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id) public ServiceModel serchBattByStation(Object obj){ List list=((BattInfImpl)dao).serchBattByStation(obj); if (list != null && list.size() > 0) { @@ -683,7 +711,6 @@ model.setData(list); model.setMsg("鏌ヨ澶辫触!"); } - //System.out.println(model); return model; } //鏌ヨ鎵�鏈夌殑鐢垫睜缁勬暟 -- Gitblit v1.9.1