package com.jwipc.finance.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.jwipc.finance.entity.AccountStatementDetail;
import com.jwipc.finance.entity.CostAccountStatementDetail;
import com.jwipc.finance.mapper.CostAccountStatementDetailMapper;
import com.jwipc.finance.model.po.CostAccountStatementDetailPO;
import com.jwipc.finance.service.ICostAccountStatementDetailService;
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-03
 */
@Service
public class CostAccountStatementDetailServiceImpl extends ServiceImpl<CostAccountStatementDetailMapper, CostAccountStatementDetail> implements ICostAccountStatementDetailService {

    @Override
    public List<CostAccountStatementDetailPO> findByStatementId(Long asId) {
        return baseMapper.findByStatementId(asId);
    }

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