From 347909bae241fff128b628ea6d12992d7e5b4b10 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 30 May 2025 18:35:43 +0800
Subject: [PATCH] 响应信息主体

---
 oying-system/src/main/java/com/oying/modules/system/rest/MerchantsController.java |   74 +++++++++++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/system/rest/MerchantsController.java b/oying-system/src/main/java/com/oying/modules/system/rest/MerchantsController.java
new file mode 100644
index 0000000..6339318
--- /dev/null
+++ b/oying-system/src/main/java/com/oying/modules/system/rest/MerchantsController.java
@@ -0,0 +1,74 @@
+package com.oying.modules.system.rest;
+
+import com.oying.annotation.Log;
+import com.oying.modules.system.domain.Merchants;
+import com.oying.modules.system.service.MerchantsService;
+import com.oying.modules.system.domain.dto.MerchantsQueryCriteria;
+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.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/merchants")
+public class MerchantsController {
+
+    private final MerchantsService merchantsService;
+
+    @ApiOperation("导出数据")
+    @GetMapping(value = "/download")
+    @PreAuthorize("@el.check('merchants:list')")
+    public void exportMerchants(HttpServletResponse response, MerchantsQueryCriteria criteria) throws IOException {
+        merchantsService.download(merchantsService.queryAll(criteria), response);
+    }
+
+    @GetMapping
+    @ApiOperation("查询商户信息")
+    @PreAuthorize("@el.check('merchants:list')")
+    public ResponseEntity<Object> queryMerchants(MerchantsQueryCriteria criteria){
+        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
+        return new ResponseEntity<>(R.success(merchantsService.queryAll(criteria,page)),HttpStatus.OK);
+    }
+
+    @PostMapping
+    @Log("新增商户信息")
+    @ApiOperation("新增商户信息")
+    @PreAuthorize("@el.check('merchants:add')")
+    public ResponseEntity<Object> createMerchants(@Validated @RequestBody Merchants resources){
+        merchantsService.create(resources);
+        return new ResponseEntity<>(R.success(),HttpStatus.CREATED);
+    }
+
+    @PutMapping
+    @Log("修改商户信息")
+    @ApiOperation("修改商户信息")
+    @PreAuthorize("@el.check('merchants:edit')")
+    public ResponseEntity<Object> updateMerchants(@Validated @RequestBody Merchants resources){
+        merchantsService.update(resources);
+        return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT);
+    }
+
+    @DeleteMapping
+    @Log("删除商户信息")
+    @ApiOperation("删除商户信息")
+    @PreAuthorize("@el.check('merchants:del')")
+    public ResponseEntity<Object> deleteMerchants(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) {
+        merchantsService.deleteAll(ids);
+        return new ResponseEntity<>(R.success(),HttpStatus.OK);
+    }
+}

--
Gitblit v1.9.3