xin
2025-06-03 7e2117e6e7382d942d5cdbb2ac5d35b7d278a478
oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java
File was renamed from oying-system/src/main/java/com/oying/modules/system/rest/MerchantsController.java
@@ -1,8 +1,8 @@
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.Merchant;
import com.oying.modules.system.service.MerchantService;
import com.oying.modules.system.domain.dto.MerchantsQueryCriteria;
import lombok.RequiredArgsConstructor;
import java.util.List;
@@ -24,50 +24,50 @@
@RestController
@RequiredArgsConstructor
@Api(tags = "系统:商户信息")
@RequestMapping("/api/merchants")
public class MerchantsController {
@RequestMapping("/api/merchant")
public class MerchantController {
    private final MerchantsService merchantsService;
    private final MerchantService merchantService;
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('merchants:list')")
    @PreAuthorize("@el.check('merchant:list')")
    public void exportMerchants(HttpServletResponse response, MerchantsQueryCriteria criteria) throws IOException {
        merchantsService.download(merchantsService.queryAll(criteria), response);
        merchantService.download(merchantService.queryAll(criteria), response);
    }
    @GetMapping
    @ApiOperation("查询商户信息")
    @PreAuthorize("@el.check('merchants:list')")
    public ResponseEntity<PageResult<Merchants>> queryMerchants(MerchantsQueryCriteria criteria){
    @PreAuthorize("@el.check('merchant:list')")
    public ResponseEntity<PageResult<Merchant>> queryMerchants(MerchantsQueryCriteria criteria){
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        return new ResponseEntity<>(merchantsService.queryAll(criteria,page),HttpStatus.OK);
        return new ResponseEntity<>(merchantService.queryAll(criteria,page),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增商户信息")
    @ApiOperation("新增商户信息")
    @PreAuthorize("@el.check('merchants:add')")
    public ResponseEntity<Object> createMerchants(@Validated @RequestBody Merchants resources){
        merchantsService.create(resources);
    @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('merchants:edit')")
    public ResponseEntity<Object> updateMerchants(@Validated @RequestBody Merchants resources){
        merchantsService.update(resources);
    @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('merchants:del')")
    @PreAuthorize("@el.check('merchant:del')")
    public ResponseEntity<Object> deleteMerchants(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) {
        merchantsService.deleteAll(ids);
        merchantService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}