package com.dy.pmsOther.fileManage; import com.alibaba.fastjson2.JSON; import com.dy.common.aop.SsoPowerAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.pmsGlobal.aop.Log; import com.dy.pmsGlobal.pojoOth.OthFileManage; import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 上传文件管理 */ @RestController @RequestMapping(path = "fileManage") public class FileManageCtrl { private FileManageSv sv; public FileManageCtrl(FileManageSv sv) { this.sv = sv; } @GetMapping(path = "/one") @SsoPowerAop(power = "-1") @Log("查询单个上传文件") public BaseResponse one(@RequestParam("id")Long id) { OthFileManage file = sv.one(id); return BaseResponseUtils.buildSuccess(JSON.toJSON(file)); } /** * 分页查询 * @param vo * @return */ @PostMapping(path="some") @SsoPowerAop(power = "-1") @Log("分页查询上传文件") public BaseResponse>> some(@RequestBody QueryVo vo){ QueryResultVo> list = sv.selectSome(vo) ; return BaseResponseUtils.buildSuccess(list); } @PostMapping(path="save") @SsoPowerAop(power = "-1") @Log("保存上传文件") public BaseResponse save(@RequestBody @Valid OthFileManage file) { int count =sv.save(file); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); } return BaseResponseUtils.buildSuccess(true); } @GetMapping(path="delete") @SsoPowerAop(power = "-1") @Log("删除上传文件") public BaseResponse delete(Long id) { int count =sv.delete(id); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); } return BaseResponseUtils.buildSuccess(true); } }