59 lines
1.5 KiB
Java
59 lines
1.5 KiB
Java
package com.fuyuanshen.app.controller;
|
|
|
|
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
|
import com.fuyuanshen.app.domain.dto.AppFileDto;
|
|
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
|
import com.fuyuanshen.app.service.AppFileService;
|
|
import com.fuyuanshen.common.core.domain.R;
|
|
import com.fuyuanshen.common.web.core.BaseController;
|
|
import jakarta.validation.constraints.NotEmpty;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* APP 文件管理
|
|
* @date 2025-06-27
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/app/file")
|
|
public class AppFileController extends BaseController {
|
|
|
|
private final AppFileService appFileService;
|
|
|
|
|
|
/**
|
|
* 查询文件列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public R<List<AppFileVo>> list(AppBusinessFileBo bo) {
|
|
return R.ok(appFileService.list(bo));
|
|
}
|
|
|
|
|
|
/**
|
|
* 上传文件
|
|
*/
|
|
@PostMapping("/upload")
|
|
public R<Void> upload(@Validated @ModelAttribute AppFileDto bo) {
|
|
return toAjax(appFileService.add(bo));
|
|
}
|
|
|
|
|
|
/**
|
|
* 文件删除
|
|
*/
|
|
@DeleteMapping("/delete/{ids}")
|
|
public R<Void> delete(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
|
if(ids == null || ids.length == 0){
|
|
return R.fail("请选择要删除的文件");
|
|
}
|
|
return toAjax(appFileService.delete(ids));
|
|
}
|
|
|
|
}
|