// 处理相关文件
 private void fileManager(Flightrestrict item) {
   String path = "/Fly_Flightrestrict/" + item.getId() + "/" + item.getFname();
   FileHelper.fileToData(path);
   if (FileHelper.bytes != 0) {
     item.setBytes(FileHelper.bytes);
     item.setDatablock(FileHelper.datablock); // 文件存储到数据库中
     FileHelper.bytes = 0;
     FileHelper.datablock = null;
   }
 }
 // 下载文件
 @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;
 }
 /**
  * 针对单个数据集操作 包括增删改
  *
  * @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)) {
       }
     }
   }
 }