コード例 #1
0
 /** 更具通知ID得到通知属性 */
 public Notic getNotic(int j) throws ManagerException {
   Notic notic = new Notic();
   DBUtil db = new DBUtil();
   String sql =
       "select a.*,b.user_name from TD_SD_NOTIC a,td_sm_user b "
           + "where a.notic_planner_id = b.user_id and NOTIC_ID="
           + j
           + "";
   try {
     db.executeSelect(sql);
     for (int i = 0; i < db.size(); i++) {
       notic.setBeginTime(db.getDate(i, "begintime"));
       notic.setEndTime(db.getDate(i, "endtime"));
       notic.setContent(db.getString(i, "content"));
       notic.setExecutorID(db.getInt(i, "executor_id"));
       notic.setPlace(db.getString(i, "place"));
       notic.setNoticPlannerName(db.getString(i, "user_nasme"));
       notic.setStatus(db.getInt(i, "status"));
       notic.setTopic(db.getString(i, "topic"));
       notic.setSource(db.getString(i, "source"));
       notic.setNoticPlannerID(db.getInt(i, "notic_planner_id"));
       return notic;
     }
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return notic;
 }
コード例 #2
0
  /** 得到通知列表 */
  public ListInfo getNoticList(String sql, int offset, int maxItem) throws ManagerException {

    DBUtil dbUtil = new DBUtil();
    try {

      dbUtil.executeSelect(sql, offset, maxItem);
      ListInfo listInfo = new ListInfo();
      List list = new ArrayList();
      for (int i = 0; i < dbUtil.size(); i++) {
        Notic notic = new Notic();

        notic.setNoticID(dbUtil.getInt(i, "NOTIC_ID"));
        notic.setBeginTime(dbUtil.getDate(i, "begintime"));
        notic.setEndTime(dbUtil.getDate(i, "endtime"));
        notic.setContent(dbUtil.getString(i, "content"));
        notic.setPlace(dbUtil.getString(i, "place"));
        notic.setExecutorID(dbUtil.getInt(i, "executor_id"));
        notic.setNoticPlannerName(dbUtil.getString(i, "user_name"));
        notic.setNoticPlannerRealName(dbUtil.getString(i, "user_realname"));
        notic.setSource(dbUtil.getString(i, "source"));
        notic.setStatus(dbUtil.getInt(i, "status"));
        notic.setTopic(dbUtil.getString(i, "topic"));
        list.add(notic);
      }
      listInfo.setDatas(list);
      listInfo.setTotalSize(dbUtil.getTotalSize());
      return listInfo;
    } catch (SQLException e) {
      e.printStackTrace();
      throw new ManagerException(e.getMessage());
    }
  }