From 01572e1f679e789e434e9cdfac491b54b68a0ec0 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 12 Sep 2025 15:09:18 +0800
Subject: [PATCH] 商户信息
---
oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 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
index 096a90c..187dc4e 100644
--- 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
@@ -4,23 +4,28 @@
import com.oying.modules.system.domain.Merchant;
import com.oying.modules.system.service.MerchantService;
import com.oying.modules.system.domain.dto.MerchantsQueryCriteria;
+import com.oying.utils.R;
+import com.oying.utils.SecurityUtils;
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
-**/
+ * @author lixin
+ * @date 2025-05-29
+ **/
@RestController
@RequiredArgsConstructor
@Api(tags = "系统:商户信息")
@@ -39,27 +44,34 @@
@GetMapping
@ApiOperation("查询商户信息")
@PreAuthorize("@el.check('merchant:list')")
- public ResponseEntity<PageResult<Merchant>> queryMerchants(MerchantsQueryCriteria criteria){
+ public ResponseEntity<Object> queryMerchants(MerchantsQueryCriteria criteria) {
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
- return new ResponseEntity<>(merchantService.queryAll(criteria,page),HttpStatus.OK);
+ return new ResponseEntity<>(R.success(merchantService.queryAll(criteria, page)), HttpStatus.OK);
+ }
+
+ @GetMapping("findByUserId")
+ @ApiOperation("根据用户查询商户信息")
+ @PreAuthorize("@el.check('merchant:list')")
+ public ResponseEntity<Object> findByUserId() {
+ return new ResponseEntity<>(R.success(merchantService.findByUserId(SecurityUtils.getCurrentUserId())), HttpStatus.OK);
}
@PostMapping
@Log("新增商户信息")
@ApiOperation("新增商户信息")
@PreAuthorize("@el.check('merchant:add')")
- public ResponseEntity<Object> createMerchants(@Validated @RequestBody Merchant resources){
+ public ResponseEntity<Object> createMerchants(@Validated @RequestBody Merchant resources) {
merchantService.create(resources);
- return new ResponseEntity<>(HttpStatus.CREATED);
+ return new ResponseEntity<>(R.success(), HttpStatus.CREATED);
}
@PutMapping
@Log("修改商户信息")
@ApiOperation("修改商户信息")
@PreAuthorize("@el.check('merchant:edit')")
- public ResponseEntity<Object> updateMerchants(@Validated @RequestBody Merchant resources){
+ public ResponseEntity<Object> updateMerchants(@Validated @RequestBody Merchant resources) {
merchantService.update(resources);
- return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT);
}
@DeleteMapping
@@ -68,6 +80,6 @@
@PreAuthorize("@el.check('merchant:del')")
public ResponseEntity<Object> deleteMerchants(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) {
merchantService.deleteAll(ids);
- return new ResponseEntity<>(HttpStatus.OK);
+ return new ResponseEntity<>(R.success(), HttpStatus.OK);
}
}
--
Gitblit v1.9.3