| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.FileDirPath; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.MaterialMapper; |
| | | import com.whyc.pojo.DocUser; |
| | |
| | | } |
| | | return response.setII(1,true,list,filePath); |
| | | } |
| | | //根据物料id查询返回附件文件夹下所有的文件列表 |
| | | public Response getAttachByMaterialId(int materialId) { |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | Material material=mapper.getAttachByMaterialId(materialId); |
| | | boolean flag=false; |
| | | String[] fileNames=null; |
| | | if(material.getFileUrl()!=null&&!material.getFileUrl().isEmpty()){ |
| | | File file = new File(fileDirName+File.separator+material.getFileUrl()); |
| | | if(!file.exists()) { |
| | | flag=false; |
| | | }else{ |
| | | fileNames = file.list();//获取该文件夹下的所有文件以及目录的名字 |
| | | if(fileNames.length>0){ |
| | | flag=true; |
| | | for (int i=0;i<fileNames.length;i++){ |
| | | fileNames[i]=fileDirName+File.separator+material.getFileUrl()+fileNames[i]; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return new Response().setII(1,flag,fileNames,"文件列表返回"); |
| | | } |
| | | } |