| | |
| | | import com.oying.service.BucketStorageService; |
| | | import com.oying.domain.dto.BucketStorageQueryCriteria; |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.utils.PageResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * @author lixin |
| | | * @date 2025-06-03 |
| | | **/ |
| | | * @author lixin |
| | | * @date 2025-06-03 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "存储桶") |
| | | @Api(tags = "工具:存储桶") |
| | | @RequestMapping("/api/bucketStorage") |
| | | public class BucketStorageController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询存储桶") |
| | | @PreAuthorize("@el.check('bucketStorage:list')") |
| | | public ResponseEntity<PageResult<BucketStorage>> queryBucketStorage(BucketStorageQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryBucketStorage(BucketStorageQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(bucketStorageService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(bucketStorageService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | @ApiOperation("上传存储桶文件") |
| | | @PreAuthorize("@el.check('bucketStorage:add')") |
| | | public ResponseEntity<Object> create(@RequestParam String name, @RequestParam("file") MultipartFile file) { |
| | | return new ResponseEntity<>(bucketStorageService.create(name, file), HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(bucketStorageService.create(name, file)), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PostMapping("/pictures") |
| | |
| | | throw new BadRequestException("只能上传图片"); |
| | | } |
| | | BucketStorage bucketStorage = bucketStorageService.create(null, file); |
| | | return new ResponseEntity<>(bucketStorage, HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(bucketStorage), HttpStatus.OK); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('bucketStorage:del')") |
| | | public ResponseEntity<Object> deleteBucketStorage(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | bucketStorageService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |