gongchunyi
12 小时以前 64c5103ed52d6c07a3abaaf8cc62a2b5b7b4d249
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
package com.ruoyi.sales.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.sales.pojo.SalesLedgerProductProcess;
import com.ruoyi.sales.pojo.SalesLedgerProductProcessBind;
import com.ruoyi.sales.mapper.SalesLedgerProductProcessBindMapper;
import com.ruoyi.sales.service.ISalesLedgerProductProcessBindService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * <p>
 * 销售产品额外加工数量 服务实现类
 * </p>
 *
 * @author deslrey
 * @since 2026-03-25
 */
@Service
public class SalesLedgerProductProcessBindServiceImpl extends ServiceImpl<SalesLedgerProductProcessBindMapper, SalesLedgerProductProcessBind> implements ISalesLedgerProductProcessBindService {
 
    @Override
    public void updateProductProcessBind(List<SalesLedgerProductProcess> list, Long salesLedgerProductId) {
        if (salesLedgerProductId == null) {
            throw new ServiceException("新增/修改失败,销售台账产品异常");
        }
        baseMapper.delete(new LambdaQueryWrapper<SalesLedgerProductProcessBind>().in(SalesLedgerProductProcessBind::getSalesLedgerProductId, salesLedgerProductId));
        if (list != null && !list.isEmpty()) {
            list.forEach(s -> {
                SalesLedgerProductProcessBind salesLedgerProductProcessBind = new SalesLedgerProductProcessBind();
                salesLedgerProductProcessBind.setSalesLedgerProductId(salesLedgerProductId);
                salesLedgerProductProcessBind.setSalesLedgerProductProcessId(s.getId());
                salesLedgerProductProcessBind.setQuantity(s.getQuantity());
                baseMapper.insert(salesLedgerProductProcessBind);
            });
        }
    }
}