package com.ruoyi.hywz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.hywz.entity.AdsMatHyxtInvoiceFileD;
import com.ruoyi.hywz.mapper.AdsMatHyxtInvoiceFileDMapper;
import com.ruoyi.hywz.service.IAdsMatHyxtInvoiceFileDService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 发票附件表 服务实现类
 * </p>
 *
 * @author mybatisplus-generator
 * @date 2024-04-08 14:25:45
 */
@Service
public class AdsMatHyxtInvoiceFileDServiceImpl extends ServiceImpl<AdsMatHyxtInvoiceFileDMapper, AdsMatHyxtInvoiceFileD> implements IAdsMatHyxtInvoiceFileDService {

    @Override
    public void logicDelete(String applyId) {
        LambdaUpdateWrapper<AdsMatHyxtInvoiceFileD> updateWrapper = Wrappers.lambdaUpdate();
        updateWrapper.eq(AdsMatHyxtInvoiceFileD::getApplyId, applyId);
        updateWrapper.set(AdsMatHyxtInvoiceFileD::getIsDeleted, 1);
        this.update(updateWrapper);
    }

    @Override
    public void logicDeleteByInvoiceId(String invoiceId) {
        LambdaUpdateWrapper<AdsMatHyxtInvoiceFileD> updateWrapper = Wrappers.lambdaUpdate();
        updateWrapper.eq(AdsMatHyxtInvoiceFileD::getInvoiceId, invoiceId);
        updateWrapper.set(AdsMatHyxtInvoiceFileD::getIsDeleted, 1);
        this.update(updateWrapper);
    }

    @Override
    public List<AdsMatHyxtInvoiceFileD> getListByInvoiceId(String invoiceId) {
        LambdaQueryWrapper<AdsMatHyxtInvoiceFileD> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(AdsMatHyxtInvoiceFileD::getInvoiceId, invoiceId);
        queryWrapper.eq(AdsMatHyxtInvoiceFileD::getIsDeleted, 0);
        return baseMapper.selectList(queryWrapper);
    }
}
