/** 得到批准建议表的属性 */ public RatifyAdvice getAdvice(int j) throws ManagerException { boolean r = false; DBUtil db = new DBUtil(); String sql = "select * from TD_SD_RATIFYADVICE where SCHEDULAR_ID = " + j + ""; RatifyAdvice ratifyAdvice = new RatifyAdvice(); try { db.executeSelect(sql); for (int i = 0; i < db.size(); i++) { ratifyAdvice.setAdvice(db.getString(i, "ADVICE")); ratifyAdvice.setSchedularID(db.getInt(i, "SCHEDULAR_ID")); ratifyAdvice.setRatifierID(db.getInt(i, "RATIFIER_ID")); return ratifyAdvice; } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ratifyAdvice; }
/** 增加批准建议 */ public boolean addRatifyAdvice(RatifyAdvice ratifyAdvice) throws ManagerException { boolean r = false; DBUtil db = new DBUtil(); String delSql = "delete TD_SD_RATIFYADVICE where SCHEDULAR_ID = " + ratifyAdvice.getSchedularID() + ""; String sql = "insert into TD_SD_RATIFYADVICE (SCHEDULAR_ID,RATIFIER_ID,advice) values(" + ratifyAdvice.getSchedularID() + "," + ratifyAdvice.getRatifierID() + ",'" + ratifyAdvice.getAdvice() + "')"; try { db.executeDelete(delSql); db.executeInsert(sql); r = true; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return r; }