xin
2025-09-27 b500e0ad05da794f2b3764b81fb1181e1debf597
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.oying.rest;
 
import com.oying.annotation.Log;
import com.oying.domain.PayConfig;
import com.oying.service.PayConfigService;
import com.oying.domain.dto.PayConfigQueryCriteria;
import lombok.RequiredArgsConstructor;
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-09-25
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "工具:支付配置")
@RequestMapping("/api/payConfig")
public class PayConfigController {
 
    private final PayConfigService payConfigService;
 
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('payConfig:list')")
    public void exportPayConfig(HttpServletResponse response, PayConfigQueryCriteria criteria) throws IOException {
        payConfigService.download(payConfigService.queryAll(criteria), response);
    }
 
    @GetMapping
    @ApiOperation("查询支付配置")
    @PreAuthorize("@el.check('payConfig:list')")
    public ResponseEntity<PageResult<PayConfig>> queryPayConfig(PayConfigQueryCriteria criteria){
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        return new ResponseEntity<>(payConfigService.queryAll(criteria,page),HttpStatus.OK);
    }
 
    @PutMapping
    @Log("启用支付配置")
    @ApiOperation("启用支付配置")
    @PreAuthorize("@el.check('payConfig:edit')")
    public ResponseEntity<Object> updatePayConfig(@Validated @RequestBody PayConfig resources){
        payConfigService.using(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
}