liyong
5 小时以前 1ca5584d7e3200a9af65a099bd26d3593e2ba702
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
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.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
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")
@Tag(name = "支付与发货管理")
@AllArgsConstructor
public class PaymentShippingController extends BaseController {
 
    private PaymentShippingService paymentShippingService;
    private PaymentShippingMapper paymentShippingMapper;
 
    @GetMapping("/listPage")
    @Operation(summary = "分页查询支付与发货信息")
    public AjaxResult listPage(Page page, PaymentShipping paymentShipping) {
        IPage<PaymentShipping> listPage = paymentShippingService.listPage(page, paymentShipping);
        return AjaxResult.success(listPage);
    }
 
    @PostMapping("/add")
    @Operation(summary = "添加支付与发货信息")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult add(@RequestBody PaymentShipping paymentShipping) {
        String ord = OrderUtils.countTodayByCreateTime(paymentShippingMapper, "ORD","order_no");
        paymentShipping.setOrderNo(ord);
        boolean save = paymentShippingService.save(paymentShipping);
        return save ? success() : error();
    }
 
    @PostMapping("/update")
    @Operation(summary = "修改支付与发货信息")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult update(@RequestBody PaymentShipping paymentShipping) {
        boolean update = paymentShippingService.updateById(paymentShipping);
        return update ? success() : error();
    }
 
    @DeleteMapping("/delete")
    @Operation(summary = "删除支付与发货信息")
    @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));
    }
 
}