maven
10 小时以前 834e3231b9ca0e5a5f43f55ce2675ace9e90dd4e
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.ruoyi.sales.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.sales.mapper.PaymentShippingMapper;
import com.ruoyi.sales.pojo.PaymentShipping;
import com.ruoyi.sales.service.PaymentShippingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * @author :yys
 * @date : 2025/9/15 14:02
 */
@RestController
@RequestMapping("/paymentShipping")
@Api(tags = "支付与发货管理")
public class PaymentShippingController extends BaseController {
 
    @Autowired
    private PaymentShippingService paymentShippingService;
 
    @Autowired
    private PaymentShippingMapper paymentShippingMapper;
 
    @GetMapping("/listPage")
    @ApiOperation("分页查询支付与发货信息")
    public AjaxResult listPage(Page page, PaymentShipping paymentShipping) {
        IPage<PaymentShipping> listPage = paymentShippingService.listPage(page, paymentShipping);
        return AjaxResult.success(listPage);
    }
 
    @PostMapping("/add")
    @ApiOperation("添加支付与发货信息")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult add(@RequestBody PaymentShipping paymentShipping) {
        String ord = OrderUtils.countTodayByCreateTime(paymentShippingMapper, "ORD");
        paymentShipping.setOrderNo(ord);
        boolean save = paymentShippingService.save(paymentShipping);
        return save ? success() : error();
    }
 
    @PostMapping("/update")
    @ApiOperation("修改支付与发货信息")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult update(@RequestBody PaymentShipping paymentShipping) {
        boolean update = paymentShippingService.updateById(paymentShipping);
        return update ? success() : error();
    }
 
    @DeleteMapping("/delete")
    @ApiOperation("删除支付与发货信息")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult delete(@RequestBody List<Long> ids){
        if (CollectionUtils.isEmpty(ids)){
            return AjaxResult.error("请传入要删除的ID");
        }
        return AjaxResult.success(paymentShippingService.removeByIds(ids));
    }
 
}