package com.jwipc.finance.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jwipc.finance.entity.CompanyAccountStatementDetail;
import com.jwipc.finance.entity.CompanyAccountStatementDetail;
import com.jwipc.finance.mapper.CompanyAccountStatementDetailMapper;
import com.jwipc.finance.model.po.CompanyAccountStatementDetailPO;
import com.jwipc.finance.service.ICompanyAccountStatementDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 对账模块-公司间销售对账单明细表 服务实现类
 * </p>
 *
 * @author shenyang.ou
 * @since 2025-11-18
 */
@Service
public class CompanyAccountStatementDetailServiceImpl extends ServiceImpl<CompanyAccountStatementDetailMapper, CompanyAccountStatementDetail> implements ICompanyAccountStatementDetailService {
    @Override
    public List<CompanyAccountStatementDetailPO> findByStatementId(Long asId) {
        return baseMapper.findByStatementId(asId);
    }

    @Override
    public boolean deleteByAsIdList(List<Long> asIdList) {
        if(CollectionUtils.isNotEmpty(asIdList)){
            baseMapper.update(new LambdaUpdateWrapper<CompanyAccountStatementDetail>().set(CompanyAccountStatementDetail::getDeleteFlag,1).in(CompanyAccountStatementDetail::getAsId,asIdList));
        }
        return true;
    }
}
