liding
2025-05-08 602a2d4fd650ded48e8f4cd1a48f0e6de3b98053
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
package com.ruoyi.sales.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.service.ISalesLedgerProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Arrays;
import java.util.List;
 
/**
 * 产品信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-08
 */
@Service
public class SalesLedgerProductServiceImpl extends ServiceImpl<SalesLedgerProductMapper, SalesLedgerProduct> implements ISalesLedgerProductService {
    @Autowired
    private SalesLedgerProductMapper salesLedgerProductMapper;
 
    @Override
    public SalesLedgerProduct selectSalesLedgerProductById(Long id) {
        return salesLedgerProductMapper.selectById(id);
    }
 
    @Override
    public List<SalesLedgerProduct> selectSalesLedgerProductList(SalesLedgerProduct salesLedgerProduct) {
        LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId,salesLedgerProduct.getSalesLedgerId());
        return salesLedgerProductMapper.selectList(queryWrapper);
    }
 
    @Override
    public int deleteSalesLedgerProductByIds(Long[] ids) {
        return salesLedgerProductMapper.deleteBatchIds(Arrays.asList(ids));
    }
 
    @Override
    public int addOrUpdateSalesLedgerProduct(SalesLedgerProduct salesLedgerProduct) {
        if (salesLedgerProduct.getId() == null){
            return salesLedgerProductMapper.insert(salesLedgerProduct);
        }else {
            return  salesLedgerProductMapper.updateById(salesLedgerProduct);
        }
    }
}