コード例 #1
0
 // 下载文件
 @Expose
 public String downloadFile(int id, String fname) throws IOException {
   String path = "/Fly_Flightrestrict/" + id + "/";
   if (!FileHelper.existFile(path, fname)) {
     Flightrestrict flightrestrict = flightrestrictDao.queryById(id);
     byte[] datablock = flightrestrict.getDatablock();
     FileHelper.createFile(path, fname, datablock);
   }
   return fname;
 }
コード例 #2
0
 /**
  * 针对单个数据集操作 包括增删改
  *
  * @param details
  * @throws Exception
  */
 public void saveFlightrestrict(Collection<Flightrestrict> details) throws Exception {
   if (null != details && details.size() > 0) {
     for (Flightrestrict item : details) {
       EntityState state = EntityUtils.getState(item);
       if (state.equals(EntityState.NEW)) {
         int tempId = item.getId();
         fileManager(item);
         flightrestrictDao.saveData(item);
         FileHelper.changeFolderById(
             "/Fly_Flightrestrict/" + tempId,
             "/Fly_Flightrestrict/" + item.getId()); // 替换以临时ID命名的文件夹
       } else if (state.equals(EntityState.MODIFIED)) {
         fileManager(item);
         flightrestrictDao.updateData(item);
       } else if (state.equals(EntityState.DELETED)) {
         flightrestrictDao.deleteData(item);
         FileHelper.deleteFile("/Fly_Flightrestrict/" + item.getId()); // 删除相关文件
       } else if (state.equals(EntityState.NONE)) {
       }
     }
   }
 }
コード例 #3
0
 public Collection<Flightrestrict> queryshfxzh(Map<String, Object> parameter) throws Exception {
   return flightrestrictDao.queryshfxzh(parameter);
 }
コード例 #4
0
 /**
  * 分页查询信息,带有criteria 将criteria转换为一个Map
  *
  * @param page
  * @param map
  * @throws Exception
  */
 public void queryFlightrestrict(
     Page<Flightrestrict> page, Map<String, Object> parameter, Criteria criteria)
     throws Exception {
   flightrestrictDao.queryFlightrestrict(page, parameter, criteria);
 }