| | |
| | | import com.ycl.common.utils.SecurityUtils; |
| | | import com.ycl.domain.entity.File; |
| | | import com.ycl.domain.entity.ProjectInfo; |
| | | import com.ycl.domain.form.DocumentInfoForm; |
| | | import com.ycl.domain.form.ProjectInfoForm; |
| | | import com.ycl.domain.query.ProjectInfoQuery; |
| | | import com.ycl.domain.vo.*; |
| | |
| | | ProjectInfoForm.getEntityByForm(form,entity); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | entity.setUpdateBy(userId); |
| | | |
| | | //更新项目信息 |
| | | baseMapper.updateById(entity); |
| | | List<File> fileList = form.getFileList(); |
| | | fileList.forEach(item->{ |
| | | item.setBusId(entity.getId()); |
| | |
| | | fileMapper.delete(fileQueryWrapper); |
| | | //替换成现有 |
| | | fileService.saveBatch(fileList); |
| | | //更新项目信息 |
| | | baseMapper.updateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | |
| | | map.put("processExceptionProject", 0); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Result docDetail(Integer id) { |
| | | DocumentInfoForm documentInfoForm = new DocumentInfoForm(); |
| | | QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); |
| | | fileQueryWrapper.eq("type",FileTypeEnum.DOCUMENT_INFO.getType()); |
| | | fileQueryWrapper.eq("bus_id",id); |
| | | List<File> files = fileMapper.selectList(fileQueryWrapper); |
| | | documentInfoForm.setFileList(files); |
| | | return Result.ok().data(documentInfoForm); |
| | | } |
| | | |
| | | @Override |
| | | public Result addDoc(DocumentInfoForm form) { |
| | | List<File> fileList = form.getFileList(); |
| | | fileList.forEach(item->{ |
| | | item.setBusId(form.getProjectId()); |
| | | item.setType(FileTypeEnum.DOCUMENT_INFO); |
| | | }); |
| | | //删除原有文件 |
| | | QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); |
| | | fileQueryWrapper.eq("type",FileTypeEnum.DOCUMENT_INFO.getType()); |
| | | fileQueryWrapper.eq("bus_id",form.getProjectId()); |
| | | fileMapper.delete(fileQueryWrapper); |
| | | //替换成现有 |
| | | fileService.saveBatch(fileList); |
| | | return Result.ok(); |
| | | } |
| | | } |