66 lines
2.2 KiB
Java
66 lines
2.2 KiB
Java
package com.senmesh.sfile.controller;
|
|
|
|
import com.senmesh.common.AlitaResult;
|
|
import com.senmesh.common.util.UserContextHolder;
|
|
import com.senmesh.sfile.constant.FileStatusEnum;
|
|
import com.senmesh.sfile.constant.RootTypeEnum;
|
|
import com.senmesh.sfile.dto.UserFileCreateDTO;
|
|
import com.senmesh.sfile.dto.UserFileDTO;
|
|
import com.senmesh.sfile.dto.UserFileModifyDTO;
|
|
import com.senmesh.sfile.dto.UserFileModifyStatusDTO;
|
|
import com.senmesh.sfile.dto.UserFileQueryDTO;
|
|
import com.senmesh.sfile.service.NormalUserFileService;
|
|
import com.senmesh.sfile.service.UserFileService;
|
|
import com.senmesh.tkmybatis.pojo.Page;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 普通用户文件Controller
|
|
*/
|
|
@RestController
|
|
@RequestMapping("normal_user_file")
|
|
@Api(tags = "普通用户文件")
|
|
public class NormalUserFileController {
|
|
|
|
@Autowired
|
|
private NormalUserFileService normalUserFileService;
|
|
|
|
@Autowired
|
|
private UserFileService userFileService;
|
|
|
|
@PostMapping("/create")
|
|
@ApiOperation("创建")
|
|
public AlitaResult<Long> create(@Validated @RequestBody UserFileCreateDTO createDTO) {
|
|
return AlitaResult.success(normalUserFileService.create(createDTO));
|
|
}
|
|
|
|
|
|
@PutMapping("/recover/{id}")
|
|
@ApiOperation("恢复")
|
|
public AlitaResult<Boolean> recover(@PathVariable Long id) {
|
|
UserFileModifyStatusDTO modifyStatusDTO = UserFileModifyStatusDTO.builder()
|
|
.id(id)
|
|
.oldStatus(FileStatusEnum.INVALID.getStatus())
|
|
.newStatus(FileStatusEnum.NORMAL.getStatus())
|
|
.build();
|
|
userFileService.modifyStatus(modifyStatusDTO);
|
|
return AlitaResult.success(true);
|
|
}
|
|
|
|
|
|
}
|
|
|