券 领取数量校验
图库
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.entity.SysImageLibrary;
|
||||
import com.czg.account.service.SysImageLibraryService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 自用图库接口
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/image")
|
||||
public class SysImageLibraryController {
|
||||
|
||||
@Resource
|
||||
private SysImageLibraryService sysImageLibraryService;
|
||||
|
||||
/**
|
||||
* 获取系统图库分页列表
|
||||
* @param name 文件名称 模糊匹配
|
||||
* @return 系统图库分页列表
|
||||
*/
|
||||
@GetMapping("/get")
|
||||
public CzgResult<Page<SysImageLibrary>> get(@RequestParam(required = false) String name) {
|
||||
return CzgResult.success(sysImageLibraryService.getImagePage(name));
|
||||
}
|
||||
/**
|
||||
* 保存系统图库
|
||||
* @param sysImageLibrary 系统图库
|
||||
* @return 无
|
||||
*/
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public CzgResult<Void> saveOrUpdate(@RequestBody SysImageLibrary sysImageLibrary) {
|
||||
sysImageLibraryService.saveOrUpdate(sysImageLibrary);
|
||||
return CzgResult.success();
|
||||
}
|
||||
/**
|
||||
* 上传系统图库图片
|
||||
* @param fileName 图片文件名 必填
|
||||
* @param suffix 图片扩展名 必填
|
||||
* @param file 图片文件 必填
|
||||
* @return 图片地址
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public CzgResult<String> upload(@RequestParam String fileName, @RequestParam String suffix, @RequestParam MultipartFile file) throws Exception {
|
||||
return CzgResult.success(sysImageLibraryService.upload(file.getBytes(), fileName, suffix));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user