| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | | import org.springblade.modules.modules.entity.FunctionEntity; |
| | | import org.springblade.modules.modules.service.IFunctionService; |
| | | import org.springblade.modules.modules.vo.FunctionVO; |
| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @SneakyThrows |
| | | @PostMapping("/put-file-attach") |
| | | public R putFileAttach(@RequestParam MultipartFile file) { |
| | | public R putFileAttach(@RequestParam MultipartFile file,FunctionEntity functionEntity) { |
| | | String fileName = file.getOriginalFilename(); |
| | | FunctionEntity one = modulesFunctionService.getOne(Condition.getQueryWrapper(functionEntity)); |
| | | BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream()); |
| | | |
| | | |
| | | |
| | | |
| | | return R.success("添加成功"); |
| | | HashMap<String,String> map = new HashMap<>(); |
| | | map.put("label",bladeFile.getName()); |
| | | map.put("value",bladeFile.getLink()); |
| | | List list = new ArrayList(); |
| | | if (ObjectUtil.isNotEmpty(one.getFileUrl())){ |
| | | one.getFileUrl().add(map); |
| | | }else { |
| | | list.add(map); |
| | | one.setFileUrl(list); |
| | | } |
| | | modulesFunctionService.updateById(one); |
| | | return R.data(bladeFile); |
| | | } |
| | | |
| | | |