From 51df6e262c2d625e700a8194cbe0ec1e40b80843 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Tue, 03 Jun 2025 19:23:31 +0800 Subject: [PATCH] 存储桶 --- oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java | 73 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java b/oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java new file mode 100644 index 0000000..096a90c --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java @@ -0,0 +1,73 @@ +package com.oying.modules.system.rest; + +import com.oying.annotation.Log; +import com.oying.modules.system.domain.Merchant; +import com.oying.modules.system.service.MerchantService; +import com.oying.modules.system.domain.dto.MerchantsQueryCriteria; +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.validation.annotation.Validated; +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; + +/** +* @author lixin +* @date 2025-05-29 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:商户信息") +@RequestMapping("/api/merchant") +public class MerchantController { + + private final MerchantService merchantService; + + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('merchant:list')") + public void exportMerchants(HttpServletResponse response, MerchantsQueryCriteria criteria) throws IOException { + merchantService.download(merchantService.queryAll(criteria), response); + } + + @GetMapping + @ApiOperation("查询商户信息") + @PreAuthorize("@el.check('merchant:list')") + public ResponseEntity<PageResult<Merchant>> queryMerchants(MerchantsQueryCriteria criteria){ + Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); + return new ResponseEntity<>(merchantService.queryAll(criteria,page),HttpStatus.OK); + } + + @PostMapping + @Log("新增商户信息") + @ApiOperation("新增商户信息") + @PreAuthorize("@el.check('merchant:add')") + public ResponseEntity<Object> createMerchants(@Validated @RequestBody Merchant resources){ + merchantService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改商户信息") + @ApiOperation("修改商户信息") + @PreAuthorize("@el.check('merchant:edit')") + public ResponseEntity<Object> updateMerchants(@Validated @RequestBody Merchant resources){ + merchantService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除商户信息") + @ApiOperation("删除商户信息") + @PreAuthorize("@el.check('merchant:del')") + public ResponseEntity<Object> deleteMerchants(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { + merchantService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} -- Gitblit v1.9.3