| | |
| | | query.eq("sub_code",code).orderByDesc("id").last(" limit 1"); |
| | | return mapper.selectOne(query); |
| | | } |
| | | //物料推送弹窗使用 |
| | | public Response getMaterialDialog(String subCode, String subName, String subModel) { |
| | | List<Material> list=mapper.getMaterialLimit(subCode,subName,subModel); |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | int flag=0; |
| | | Material m=new Material(); |
| | | // 返回是否存在附件 |
| | | if(list!=null&&list.size()>0){ |
| | | m=list.get(list.size()-1); |
| | | if(m.getFileUrl()!=null&&!m.getFileUrl().isEmpty()){ |
| | | File file = new File(fileDirName+File.separator+m.getFileUrl()); |
| | | if(!file.exists()) { |
| | | flag=0; |
| | | }else{ |
| | | String[] fileNames = file.list();//获取该文件夹下的所有文件以及目录的名字 |
| | | List attachFileList=new ArrayList(); |
| | | if(fileNames.length>0){ |
| | | flag=1; |
| | | for (int i=0;i<fileNames.length;i++){ |
| | | if(!fileNames[i].contains("-dwg.pdf")&&!fileNames[i].contains("-doc.pdf")) |
| | | attachFileList.add(fileNames[i]); |
| | | } |
| | | }else{ |
| | | flag=0; |
| | | } |
| | | m.setAttachFileList(attachFileList); |
| | | } |
| | | } |
| | | m.setHasAttachFlag(flag); |
| | | } |
| | | return new Response().setII(1,m!=null,m,"物料推送弹窗使用"); |
| | | } |
| | | } |