6 小时以前 7bf754a7835d06f26240c4ca15bc5f83650de377
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.ruoyi.sales.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.sales.dto.SalesLedgerArrivalDto;
import com.ruoyi.sales.pojo.SalesLedgerArrival;
import org.apache.ibatis.annotations.Param;
 
import java.math.BigDecimal;
import java.util.List;
 
/**
 * 销售台账到货记录Mapper接口
 *
 * @author ruoyi
 * @date 2026-09-21
 */
public interface SalesLedgerArrivalMapper extends BaseMapper<SalesLedgerArrival> {
 
    /**
     * 到货记录列表
     */
    IPage<SalesLedgerArrivalDto> listPage(Page page, @Param("req") SalesLedgerArrivalDto req);
 
    /**
     * 单条到货记录(修改时取身份字段,口径与列表一致:跳过数据权限)
     */
    SalesLedgerArrivalDto selectArrivalById(@Param("id") Long id);
 
    /**
     * 某台账在某出库单上累计已到货数量(吨),用于到货上限校验。
     * 必须跳过数据权限,否则会漏掉他人录入的到货记录,导致上限被绕过
     */
    BigDecimal sumArrivedQuantity(@Param("stockOutRecordId") Long stockOutRecordId,
                                 @Param("salesLedgerId") Long salesLedgerId,
                                 @Param("excludeId") Long excludeId);
 
    /**
     * 按出库单批量取到货记录(发货台账组装子行用)
     */
    List<SalesLedgerArrivalDto> listByStockOutRecordIds(@Param("stockOutRecordIds") List<Long> stockOutRecordIds);
 
    /**
     * 可到货的车辆下拉:只出绑定了该台账、且审批通过的出库记录里用过的车
     */
    List<SalesLedgerArrivalDto> bindableVehicles(@Param("salesLedgerId") Long salesLedgerId);
 
    /**
     * 该出库单下已有多少条到货记录。删除出库单 / 改绑台账的守卫,必须跳过数据权限,
     * 否则看不到别人录的到货记录,守卫会被绕过
     */
    Long countByStockOutRecordId(@Param("stockOutRecordId") Long stockOutRecordId);
}