package com.fuyuanshen.app.controller;

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 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 List<AppFileVo> list(AppFileDto bo) {
        return appFileService.list(bo);
    }

    /**
     * 文件添加
     */
    @PostMapping("/add")
    public R<Void> add(@RequestBody AppFileDto bo) {
        return appFileService.add(bo);
    }

    /**
     * 文件编辑
     */
    @PostMapping("/edit")
    public R<Void> edit(@RequestBody AppFileDto bo) {
        return appFileService.edit(bo);
    }

    /**
     * 文件删除
     */
    @DeleteMapping("/delete")
    public R<Void> delete(AppFileDto bo) {
        return appFileService.delete(bo);
    }
}
