啊鑫
2025-02-12 076dd23c615e66b2c495bb123aadf041940f03b2
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
package com.gs.xky.service.Impl;
 
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gs.xky.dto.BarcodeDeliveryNo;
import com.gs.xky.entity.TblBarcodeInformation;
import com.gs.xky.mapper.TblBarcodeInformationMapper;
import com.gs.xky.service.TblBarcodeInformationService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author 28567
 * @description 针对表【TBL_BARCODE_INFORMATION(条码信息表)】的数据库操作Service实现
 * @createDate 2025-02-12 12:52:06
 */
@Service
@Transactional(rollbackFor = Exception.class)
@RequiredArgsConstructor
public class TblBarcodeInformationServiceImpl extends ServiceImpl<TblBarcodeInformationMapper, TblBarcodeInformation>
        implements TblBarcodeInformationService {
 
 
    @Override
    public boolean SaveBarcodeInformation(List<BarcodeDeliveryNo> barcodeList, String deliveryNo) {
 
        if (CollUtil.isEmpty(barcodeList)) {
            return false;
        }
 
        List<TblBarcodeInformation> tbBarcodeInformationList = new ArrayList<TblBarcodeInformation>();
 
        LambdaUpdateWrapper<TblBarcodeInformation> updateWrapper = new LambdaUpdateWrapper<>();
 
        for (BarcodeDeliveryNo barcodeDeliveryNo : barcodeList) {
 
            updateWrapper.clear();
            updateWrapper.eq(TblBarcodeInformation::getSmallBarcode, barcodeDeliveryNo.getSmallBarcode());
            remove(updateWrapper);
 
            TblBarcodeInformation barcodeInformation = new TblBarcodeInformation();
            BeanUtil.copyProperties(barcodeDeliveryNo, barcodeInformation);
 
            barcodeInformation.setDeliveryNo(deliveryNo);
 
            tbBarcodeInformationList.add(barcodeInformation);
        }
 
        return saveBatch(tbBarcodeInformationList);
    }
}