public boolean delete(int id) {
   PaidDetail paidDetail = paidDao.find(id);
   boolean flag = paidDao.delete(id);
   if (flag) {
     log.debug(MyFactory.getUserService().getCurrentUserName() + " delete " + paidDetail);
   }
   return flag;
 }
 public boolean censored(int id, boolean pass) {
   boolean flag;
   PaidDetail paidDetail = paidDao.find(id);
   paidDetail.setCensored(pass ? Constants.CENSORED_PASS : Constants.CENSORED_REFUSE);
   flag = paidDao.update(paidDetail);
   if (flag) {
     log.debug(MyFactory.getUserService().getCurrentUserName() + " censored " + paidDetail);
   }
   return flag;
 }
 /**
  * @param id
  * @param iid 进货ID
  * @param ownerId 货主
  * @param fid
  * @param censored
  * @param from
  * @param to
  * @param uid
  * @return
  */
 public List<PaidDetail> queryMyPaidDetail(
     int id, int iid, int ownerId, int fid, int censored, Date from, Date to, int uid) {
   List<PaidDetail> result = paidDao.queryMyPaidDetail(id, iid, censored, from, to, uid);
   if (ownerId != -1) {
     result = selectOwner(result, ownerId);
   }
   if (fid != -1) {
     result = selectFruit(result, fid);
   }
   return result;
 }
 public boolean update(PaidDetail paidDetail) {
   int id = paidDetail.getId();
   boolean flag = false;
   PaidDetail old = paidDao.find(id);
   if (MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) {
     paidDetail.setCensored(Constants.CENSORED_PASS);
   } else {
     paidDetail.setCensored(Constants.CENSORED_ORIGINAL);
   }
   if (flag) {
     log.debug(
         MyFactory.getUserService().getCurrentUserName() + " update " + old + " to " + paidDetail);
   }
   return flag;
 }
  public boolean create(PaidDetail paidDetail) {
    paidDetail.setUid(MyFactory.getCurrentUser().getId());
    if (MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) {
      paidDetail.setCensored(Constants.CENSORED_PASS);
    }

    boolean flag = paidDao.create(paidDetail);
    if (flag) {
      log.info(MyFactory.getUserService().getCurrentUserName() + " create " + paidDetail);
      if (paidDetail.getDiscount() != -1) {
        OutDetailService outDetailService = MyFactory.getOutDetailService();
        outDetailService.paid(paidDetail);
      }
    }
    return flag;
  }
 public boolean createTable() {
   return paidDao.createTable();
 }