|
@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.shiro.authz.annotation.Logical;
|
|
import org.apache.shiro.authz.annotation.Logical;
|
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|
import tk.mybatis.mapper.entity.Condition;
|
|
import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -94,14 +96,13 @@ public class DownloadController extends BaseController {
|
|
@ApiOperation("详情")
|
|
@ApiOperation("详情")
|
|
@GetMapping("detail/{id}")
|
|
@GetMapping("detail/{id}")
|
|
public Result detail(@PathVariable Long id) {
|
|
public Result detail(@PathVariable Long id) {
|
|
-// DownloadEntity entity = downloadService.findById(id);
|
|
|
|
DownloadResponse entity = downloadService.rFindById(id);
|
|
DownloadResponse entity = downloadService.rFindById(id);
|
|
if (entity == null) {
|
|
if (entity == null) {
|
|
log.error("对象不存在: {}", id);
|
|
log.error("对象不存在: {}", id);
|
|
return Result.failure("对象不存在");
|
|
return Result.failure("对象不存在");
|
|
}
|
|
}
|
|
-// List<FileEntity> files = fileService.findByIds(entity.getFileIds());
|
|
|
|
- List<FileEntity> files = fileService.findByIds(entity.getFileIds());
|
|
|
|
|
|
+ String fileIds = entity.getFileIds();
|
|
|
|
+ List<FileEntity> files = StringUtils.isNotBlank(fileIds) ? fileService.findByIds(fileIds) : new ArrayList<>();
|
|
HashMap<Object, Object> map = new HashMap<>();
|
|
HashMap<Object, Object> map = new HashMap<>();
|
|
map.put("obj", entity);
|
|
map.put("obj", entity);
|
|
map.put("file", files);
|
|
map.put("file", files);
|