8a3a5681bf414c075c16bd1600100c41b65ab880.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. package com.sinosoft.am.org.linkerHistory.dao;
  2. import java.sql.Connection;
  3. import java.sql.PreparedStatement;
  4. import java.sql.ResultSet;
  5. import java.sql.SQLException;
  6. import java.util.Date;
  7. import com.persistence.DbConnection;
  8. public class HistoryLinkerDao {
  9. public int addDataToTable1(String params,String date,
  10. String madeMan,
  11. String madeManId,
  12. String madeManPhe,
  13. String deptName,
  14. String isIssue){//往表EMC_AM_ORG_INLINK_HISTORY中插数据
  15. /*try {
  16. params = java.net.URLDecoder.decode(params, "UTF-8");
  17. } catch (UnsupportedEncodingException e) {
  18. e.printStackTrace();
  19. }*/
  20. //String needId = Utils.getParameter("connectId", params) == null ? "" : Utils.getParameter("connectId", params);//装备需求id
  21. String sql = "insert into EMC_AM_ORG_INLINK_HISTORY "+
  22. " (FD_OBJECTID,INLINK_INDEX,INLINK_NAME,EMC_TYPE,EMC_ROLE,MANAGER_DEPT,LANDLINE,PHONE,EMAIL,PARENT_ORG,"+
  23. " PARENT_DEPT,JOB,IS_DEL,UPDATEDATE,PARENT_DEPT_ID,PARENT_ORG_ID,VIRTUAL_ORG_ID,MAN_REMARKS,ENTRY_MAN_ID,SORT_NO,"+
  24. " IS_SHOW_TEL,MADE_MAN,MADE_MAN_PHONE,MADE_MAN_ID,IS_ISSUE,NAME,NUMBER) "+
  25. " select "+
  26. " FD_OBJECTID,INLINK_INDEX,INLINK_NAME,EMC_TYPE,EMC_ROLE,MANAGER_DEPT,LANDLINE,PHONE,EMAIL,PARENT_ORG,"+
  27. " PARENT_DEPT,JOB,IS_DEL,'"+date+"',PARENT_DEPT_ID,PARENT_ORG_ID,VIRTUAL_ORG_ID,MAN_REMARKS,ENTRY_MAN_ID,SORT_NO,"+
  28. " IS_SHOW_TEL,'"+madeMan+"','"+madeManPhe+"','"+madeManId+"','"+isIssue+"','"+deptName+"("+date+")','NULL' "+
  29. " from EMC_AM_ORG_INLINK where " + params;
  30. StringBuffer sb = new StringBuffer();
  31. DbConnection dbConn = new DbConnection();
  32. Connection conn = null;
  33. PreparedStatement pstm = null;
  34. ResultSet rs = null;
  35. int n = -1;
  36. try {
  37. conn = dbConn.getConnection();
  38. pstm = conn.prepareStatement(sql);
  39. n = pstm.executeUpdate();//如果成功返回更新的条数
  40. if(n != 1){
  41. //sb.append(fd_id);
  42. }
  43. } catch (SQLException e) {
  44. e.printStackTrace();
  45. } catch (ClassNotFoundException e) {
  46. e.printStackTrace();
  47. }finally{
  48. try {
  49. if(rs!=null)
  50. rs.close();
  51. if(pstm!=null)
  52. pstm.close();
  53. if(conn!=null)
  54. conn.close();
  55. } catch (SQLException e) {
  56. e.printStackTrace();
  57. }
  58. }
  59. return n;
  60. }
  61. public String getSimpleData(){
  62. String sql = "select distinct top 100 name,made_man,made_man_phone,updatedate,is_issue,VIRTUAL_ORG_ID from EMC_AM_ORG_INLINK_HISTORY order by updatedate desc;";
  63. StringBuffer sb = new StringBuffer();
  64. DbConnection dbConn = new DbConnection();
  65. Connection conn = null;
  66. PreparedStatement pstm = null;
  67. ResultSet rs = null;
  68. sb.append("{\"rows\":[");
  69. int n = 0;
  70. try {
  71. conn = dbConn.getConnection();
  72. pstm = conn.prepareStatement(sql);
  73. rs=pstm.executeQuery();
  74. while(rs.next()){
  75. sb.append("{\"NAME\":\""+rs.getString("name")+"\",\"MADE_MAN\":\""+rs.getString("made_man")+"\","+
  76. "\"MADE_MAN_PHONE\":\""+rs.getString("made_man_phone")+"\",\"IS_ISSUE\":\""+rs.getString("is_issue")+"\","+
  77. "\"UPDATEDATE\":\""+rs.getString("updatedate")+"\",\"VIRTUAL_ORG_ID\":\""+rs.getString("VIRTUAL_ORG_ID")+"\"},");
  78. n = n + 1;
  79. }
  80. if(n>0){
  81. sb.deleteCharAt(sb.length()-1);
  82. }
  83. sb.append("]}");
  84. System.out.println();
  85. } catch (SQLException e) {
  86. e.printStackTrace();
  87. } catch (ClassNotFoundException e) {
  88. e.printStackTrace();
  89. }finally{
  90. try {
  91. if(rs!=null)
  92. rs.close();
  93. if(pstm!=null)
  94. pstm.close();
  95. if(conn!=null)
  96. conn.close();
  97. } catch (SQLException e) {
  98. e.printStackTrace();
  99. }
  100. }
  101. return sb.toString();
  102. }
  103. //
  104. public String getPeopleMsg(String updatedate){
  105. String sql = "select "+
  106. " FD_OBJECTID,INLINK_INDEX,INLINK_NAME,EMC_TYPE,EMC_ROLE,MANAGER_DEPT,LANDLINE,PHONE,EMAIL,PARENT_ORG,"+
  107. " PARENT_DEPT,JOB,IS_DEL,UPDATEDATE,PARENT_DEPT_ID,PARENT_ORG_ID,VIRTUAL_ORG_ID,MAN_REMARKS,ENTRY_MAN_ID,SORT_NO,"+
  108. " IS_SHOW_TEL,MADE_MAN,MADE_MAN_PHONE,MADE_MAN_ID,IS_ISSUE,NAME,NUMBER "+
  109. "from EMC_AM_ORG_INLINK_HISTORY where UPDATEDATE='"+updatedate+"' order by EMC_ROLE;";
  110. StringBuffer sb = new StringBuffer();
  111. StringBuffer sbDept = new StringBuffer();
  112. StringBuffer sbDept1 = new StringBuffer();
  113. DbConnection dbConn = new DbConnection();
  114. Connection conn = null;
  115. PreparedStatement pstm = null;
  116. ResultSet rs = null;
  117. sb.append("{\"rows\":[");
  118. int n = 0;
  119. try {
  120. conn = dbConn.getConnection();
  121. pstm = conn.prepareStatement(sql);
  122. rs=pstm.executeQuery();
  123. while(rs.next()){
  124. sbDept.append(getDeptMsg(rs.getString("PARENT_ORG_ID")));
  125. sbDept1.append(getDeptMsg(rs.getString("PARENT_DEPT_ID")));
  126. sb.append("{"+
  127. "\"EMC_ROLE\":\""+rs.getString("EMC_ROLE")+"\","+
  128. "\"INLINK_NAME\":\""+rs.getString("INLINK_NAME")+"\","+
  129. //"\"PARENT_ORG_ID\":\""+rs.getString("PARENT_ORG_ID")+"\","+
  130. "\"PARENT_ORG_ID\":\""+sbDept.toString()+"\","+
  131. //"\"PARENT_DEPT_ID\":\""+rs.getString("PARENT_DEPT_ID")+"\","+
  132. "\"PARENT_DEPT_ID\":\""+sbDept1.toString()+"\","+
  133. "\"PHONE\":\""+rs.getString("PHONE")+"\","+
  134. "\"INLINK_INDEX\":\""+rs.getString("INLINK_INDEX")+"\""+
  135. "},");
  136. sbDept.delete(0, sbDept.length());
  137. sbDept1.delete(0, sbDept1.length());
  138. n = n + 1;
  139. }
  140. if(n>0){
  141. sb.deleteCharAt(sb.length()-1);
  142. }
  143. sb.append("]}");
  144. System.out.println();
  145. } catch (SQLException e) {
  146. e.printStackTrace();
  147. } catch (ClassNotFoundException e) {
  148. e.printStackTrace();
  149. }finally{
  150. try {
  151. if(rs!=null)
  152. rs.close();
  153. if(pstm!=null)
  154. pstm.close();
  155. if(conn!=null)
  156. conn.close();
  157. } catch (SQLException e) {
  158. e.printStackTrace();
  159. }
  160. }
  161. return sb.toString();
  162. }
  163. //通过ID获取单位信息
  164. public String getDeptMsg(String deptId){
  165. String sql = "select dept_name from sys_department where dept_id='"+deptId+"'";
  166. StringBuffer sb = new StringBuffer();
  167. DbConnection dbConn = new DbConnection();
  168. Connection conn = null;
  169. PreparedStatement pstm = null;
  170. ResultSet rs = null;
  171. try {
  172. conn = dbConn.getConnection();
  173. pstm = conn.prepareStatement(sql);
  174. rs=pstm.executeQuery();
  175. while(rs.next()){
  176. sb.append(
  177. //"\"DEPT_NAME\":\""+rs.getString("dept_name")+"\""
  178. rs.getString("dept_name")
  179. );
  180. }
  181. //System.out.println();
  182. } catch (SQLException e) {
  183. e.printStackTrace();
  184. } catch (ClassNotFoundException e) {
  185. e.printStackTrace();
  186. }finally{
  187. try {
  188. if(rs!=null)
  189. rs.close();
  190. if(pstm!=null)
  191. pstm.close();
  192. if(conn!=null)
  193. conn.close();
  194. } catch (SQLException e) {
  195. e.printStackTrace();
  196. }
  197. }
  198. return sb.toString();
  199. }
  200. //通过ID获取单位信息
  201. public int updateIssueState(String updatedate,String issueState,String dateStr){
  202. String paramVoi =updatedate.split(",")[0];
  203. String paramDate ="'"+ updatedate.split(",")[1]+"'";
  204. String getName = getName(paramDate);//贵州电网公司应急指挥中心成员名单(2018-03-18 18:38:41)
  205. getName = getName.split("(")[0]+"("+dateStr+")";
  206. System.out.println("**************"+getName);
  207. String sql = "update EMC_AM_ORG_INLINK_HISTORY set IS_ISSUE='"+issueState+"',updatedate='"+dateStr+"',name='"+getName+"' where updatedate in ("+paramDate+") and VIRTUAL_ORG_ID='"+paramVoi+"';";
  208. DbConnection dbConn = new DbConnection();
  209. Connection conn = null;
  210. PreparedStatement pstm = null;
  211. ResultSet rs = null;
  212. int n = -1;
  213. try {
  214. conn = dbConn.getConnection();
  215. pstm = conn.prepareStatement(sql);
  216. n = pstm.executeUpdate();
  217. } catch (SQLException e) {
  218. e.printStackTrace();
  219. } catch (ClassNotFoundException e) {
  220. e.printStackTrace();
  221. }finally{
  222. try {
  223. if(rs!=null)
  224. rs.close();
  225. if(pstm!=null)
  226. pstm.close();
  227. if(conn!=null)
  228. conn.close();
  229. } catch (SQLException e) {
  230. e.printStackTrace();
  231. }
  232. }
  233. return n;
  234. }
  235. public String getName(String paramDate){
  236. String sql = "select distinct name from EMC_AM_ORG_INLINK_HISTORY where updatedate="+paramDate+";";
  237. StringBuffer sb = new StringBuffer();
  238. DbConnection dbConn = new DbConnection();
  239. Connection conn = null;
  240. PreparedStatement pstm = null;
  241. ResultSet rs = null;
  242. try {
  243. conn = dbConn.getConnection();
  244. pstm = conn.prepareStatement(sql);
  245. rs=pstm.executeQuery();
  246. while(rs.next()){
  247. sb.append(
  248. //"\"DEPT_NAME\":\""+rs.getString("dept_name")+"\""
  249. rs.getString("name")
  250. );
  251. }
  252. //System.out.println();
  253. } catch (SQLException e) {
  254. e.printStackTrace();
  255. } catch (ClassNotFoundException e) {
  256. e.printStackTrace();
  257. }finally{
  258. try {
  259. if(rs!=null)
  260. rs.close();
  261. if(pstm!=null)
  262. pstm.close();
  263. if(conn!=null)
  264. conn.close();
  265. } catch (SQLException e) {
  266. e.printStackTrace();
  267. }
  268. }
  269. return sb.toString();
  270. }
  271. public int addDatatoInlink(String condition){//
  272. /*try {
  273. params = java.net.URLDecoder.decode(params, "UTF-8");
  274. } catch (UnsupportedEncodingException e) {
  275. e.printStackTrace();
  276. }*/
  277. //String needId = Utils.getParameter("connectId", params) == null ? "" : Utils.getParameter("connectId", params);//装备需求id
  278. String sql = "insert into EMC_AM_ORG_INLINK "+
  279. "(FD_OBJECTID,INLINK_INDEX,INLINK_NAME,EMC_TYPE,EMC_ROLE,MANAGER_DEPT,LANDLINE,PHONE,EMAIL,"+
  280. " PARENT_ORG,PARENT_DEPT,JOB,IS_DEL,UPDATEDATE,PARENT_DEPT_ID,PARENT_ORG_ID,VIRTUAL_ORG_ID,"+
  281. " MAN_REMARKS,ENTRY_MAN_ID,SORT_NO,IS_SHOW_TEL) "+
  282. "select "+
  283. " FD_OBJECTID,INLINK_INDEX,INLINK_NAME,EMC_TYPE,EMC_ROLE,MANAGER_DEPT,LANDLINE,PHONE,EMAIL,"+
  284. " PARENT_ORG,PARENT_DEPT,JOB,IS_DEL,UPDATEDATE,PARENT_DEPT_ID,PARENT_ORG_ID,VIRTUAL_ORG_ID,"+
  285. " MAN_REMARKS,ENTRY_MAN_ID,SORT_NO,IS_SHOW_TEL "+
  286. "from EMC_AM_ORG_INLINK_HISTORY where updatedate in "+
  287. "(select distinct top 1 updatedate from EMC_AM_ORG_INLINK_HISTORY " +
  288. "where is_issue='1' and "+condition+" order by updatedate desc);";
  289. StringBuffer sb = new StringBuffer();
  290. DbConnection dbConn = new DbConnection();
  291. Connection conn = null;
  292. PreparedStatement pstm = null;
  293. ResultSet rs = null;
  294. int n = -1;
  295. try {
  296. conn = dbConn.getConnection();
  297. pstm = conn.prepareStatement(sql);
  298. n = pstm.executeUpdate();//如果成功返回更新的条数
  299. if(n != 1){
  300. //sb.append(fd_id);
  301. }
  302. } catch (SQLException e) {
  303. e.printStackTrace();
  304. } catch (ClassNotFoundException e) {
  305. e.printStackTrace();
  306. }finally{
  307. try {
  308. if(rs!=null)
  309. rs.close();
  310. if(pstm!=null)
  311. pstm.close();
  312. if(conn!=null)
  313. conn.close();
  314. } catch (SQLException e) {
  315. e.printStackTrace();
  316. }
  317. }
  318. return n;
  319. }
  320. public int delDatatoInlink(String condition){//
  321. /*try {
  322. params = java.net.URLDecoder.decode(params, "UTF-8");
  323. } catch (UnsupportedEncodingException e) {
  324. e.printStackTrace();
  325. }*/
  326. //String needId = Utils.getParameter("connectId", params) == null ? "" : Utils.getParameter("connectId", params);//装备需求id
  327. String sql = "delete from EMC_AM_ORG_INLINK where "+condition+";";
  328. //String sql = "update EMC_AM_ORG_INLINK set is_del='1' where "+condition+";";
  329. StringBuffer sb = new StringBuffer();
  330. DbConnection dbConn = new DbConnection();
  331. Connection conn = null;
  332. PreparedStatement pstm = null;
  333. ResultSet rs = null;
  334. int n = -1;
  335. try {
  336. conn = dbConn.getConnection();
  337. pstm = conn.prepareStatement(sql);
  338. n = pstm.executeUpdate();//如果成功返回更新的条数
  339. /*if(n != 1){
  340. //sb.append(fd_id);
  341. }*/
  342. } catch (SQLException e) {
  343. e.printStackTrace();
  344. } catch (ClassNotFoundException e) {
  345. e.printStackTrace();
  346. }finally{
  347. try {
  348. if(rs!=null)
  349. rs.close();
  350. if(pstm!=null)
  351. pstm.close();
  352. if(conn!=null)
  353. conn.close();
  354. } catch (SQLException e) {
  355. e.printStackTrace();
  356. }
  357. }
  358. return n;
  359. }
  360. public int updateDataOfInlinkHistory(String condition){//
  361. /*try {
  362. params = java.net.URLDecoder.decode(params, "UTF-8");
  363. } catch (UnsupportedEncodingException e) {
  364. e.printStackTrace();
  365. }*/
  366. //String needId = Utils.getParameter("connectId", params) == null ? "" : Utils.getParameter("connectId", params);//装备需求id
  367. String sql = "update EMC_AM_ORG_INLINK_HISTORY set is_issue='0' where is_issue='1' and "+condition+";";
  368. StringBuffer sb = new StringBuffer();
  369. DbConnection dbConn = new DbConnection();
  370. Connection conn = null;
  371. PreparedStatement pstm = null;
  372. ResultSet rs = null;
  373. int n = -1;
  374. try {
  375. conn = dbConn.getConnection();
  376. pstm = conn.prepareStatement(sql);
  377. n = pstm.executeUpdate();//如果成功返回更新的条数
  378. /*if(n != 1){
  379. //sb.append(fd_id);
  380. }*/
  381. } catch (SQLException e) {
  382. e.printStackTrace();
  383. } catch (ClassNotFoundException e) {
  384. e.printStackTrace();
  385. }finally{
  386. try {
  387. if(rs!=null)
  388. rs.close();
  389. if(pstm!=null)
  390. pstm.close();
  391. if(conn!=null)
  392. conn.close();
  393. } catch (SQLException e) {
  394. e.printStackTrace();
  395. }
  396. }
  397. return n;
  398. }
  399. public int updateIssueStateTo0(String updatedate){//历史人员信息页面发布时,把之前已发布的信息改为未发布
  400. /*try {
  401. params = java.net.URLDecoder.decode(params, "UTF-8");
  402. } catch (UnsupportedEncodingException e) {
  403. e.printStackTrace();
  404. }*/
  405. String voi = updatedate.split(",")[0];//VIRTUAL_ORG_ID字段值
  406. String updateDate = updatedate.split(",")[1];//updatedate字段值
  407. //String sql = "update EMC_AM_ORG_INLINK_HISTORY set is_issue='0' where is_del='0' and updatedate='"+updateDate+"' and VIRTUAL_ORG_ID='"+voi+"';";
  408. String sql = "update EMC_AM_ORG_INLINK_HISTORY set is_issue='0' where is_del='0' and VIRTUAL_ORG_ID='"+voi+"';";
  409. StringBuffer sb = new StringBuffer();
  410. DbConnection dbConn = new DbConnection();
  411. Connection conn = null;
  412. PreparedStatement pstm = null;
  413. ResultSet rs = null;
  414. int n = -1;
  415. try {
  416. conn = dbConn.getConnection();
  417. pstm = conn.prepareStatement(sql);
  418. n = pstm.executeUpdate();//如果成功返回更新的条数
  419. /*if(n != 1){
  420. //sb.append(fd_id);
  421. }*/
  422. } catch (SQLException e) {
  423. e.printStackTrace();
  424. } catch (ClassNotFoundException e) {
  425. e.printStackTrace();
  426. }finally{
  427. try {
  428. if(rs!=null)
  429. rs.close();
  430. if(pstm!=null)
  431. pstm.close();
  432. if(conn!=null)
  433. conn.close();
  434. } catch (SQLException e) {
  435. e.printStackTrace();
  436. }
  437. }
  438. return n;
  439. }
  440. public int deleteInlinkDate(String updatedate){//历史人员信息页面发布时,把之前已发布的信息改为未发布
  441. /*try {
  442. params = java.net.URLDecoder.decode(params, "UTF-8");
  443. } catch (UnsupportedEncodingException e) {
  444. e.printStackTrace();
  445. }*/
  446. String voi = updatedate.split(",")[0];//VIRTUAL_ORG_ID字段值
  447. String updateDate = updatedate.split(",")[1];//updatedate字段值
  448. //String sql = "update EMC_AM_ORG_INLINK set is_del='1' where is_del='0' and VIRTUAL_ORG_ID='"+voi+"';";
  449. String sql = "delete from EMC_AM_ORG_INLINK where is_del='0' and VIRTUAL_ORG_ID='"+voi+"';";
  450. StringBuffer sb = new StringBuffer();
  451. DbConnection dbConn = new DbConnection();
  452. Connection conn = null;
  453. PreparedStatement pstm = null;
  454. ResultSet rs = null;
  455. int n = -1;
  456. try {
  457. conn = dbConn.getConnection();
  458. pstm = conn.prepareStatement(sql);
  459. n = pstm.executeUpdate();//如果成功返回更新的条数
  460. /*if(n != 1){
  461. //sb.append(fd_id);
  462. }*/
  463. } catch (SQLException e) {
  464. e.printStackTrace();
  465. } catch (ClassNotFoundException e) {
  466. e.printStackTrace();
  467. }finally{
  468. try {
  469. if(rs!=null)
  470. rs.close();
  471. if(pstm!=null)
  472. pstm.close();
  473. if(conn!=null)
  474. conn.close();
  475. } catch (SQLException e) {
  476. e.printStackTrace();
  477. }
  478. }
  479. return n;
  480. }
  481. public int insertDataToInlink(String updatedate,String issueState){//往表EMC_AM_ORG_INLINK中插数据
  482. /*try {
  483. params = java.net.URLDecoder.decode(params, "UTF-8");
  484. } catch (UnsupportedEncodingException e) {
  485. e.printStackTrace();
  486. }*/
  487. //String needId = Utils.getParameter("connectId", params) == null ? "" : Utils.getParameter("connectId", params);//装备需求id
  488. String voi = updatedate.split(",")[0];//VIRTUAL_ORG_ID字段值
  489. String updateDate = updatedate.split(",")[1];//updatedate字段值
  490. String sql = "insert into EMC_AM_ORG_INLINK"+
  491. " (FD_OBJECTID,INLINK_INDEX,INLINK_NAME,EMC_TYPE,EMC_ROLE,MANAGER_DEPT,LANDLINE,PHONE,EMAIL,PARENT_ORG,"+
  492. " PARENT_DEPT,JOB,IS_DEL,UPDATEDATE,PARENT_DEPT_ID,PARENT_ORG_ID,VIRTUAL_ORG_ID,MAN_REMARKS,ENTRY_MAN_ID,SORT_NO,"+
  493. " IS_SHOW_TEL) "+
  494. " select "+
  495. " FD_OBJECTID,INLINK_INDEX,INLINK_NAME,EMC_TYPE,EMC_ROLE,MANAGER_DEPT,LANDLINE,PHONE,EMAIL,PARENT_ORG,"+
  496. " PARENT_DEPT,JOB,IS_DEL,UPDATEDATE,PARENT_DEPT_ID,PARENT_ORG_ID,VIRTUAL_ORG_ID,MAN_REMARKS,ENTRY_MAN_ID,SORT_NO,"+
  497. " IS_SHOW_TEL "+
  498. " from EMC_AM_ORG_INLINK_HISTORY where VIRTUAL_ORG_ID='"+voi+"' and is_del='0' and is_issue='1'";
  499. StringBuffer sb = new StringBuffer();
  500. DbConnection dbConn = new DbConnection();
  501. Connection conn = null;
  502. PreparedStatement pstm = null;
  503. ResultSet rs = null;
  504. int n = -1;
  505. try {
  506. conn = dbConn.getConnection();
  507. pstm = conn.prepareStatement(sql);
  508. n = pstm.executeUpdate();//如果成功返回更新的条数
  509. if(n != 1){
  510. //sb.append(fd_id);
  511. }
  512. } catch (SQLException e) {
  513. e.printStackTrace();
  514. } catch (ClassNotFoundException e) {
  515. e.printStackTrace();
  516. }finally{
  517. try {
  518. if(rs!=null)
  519. rs.close();
  520. if(pstm!=null)
  521. pstm.close();
  522. if(conn!=null)
  523. conn.close();
  524. } catch (SQLException e) {
  525. e.printStackTrace();
  526. }
  527. }
  528. return n;
  529. }
  530. }