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.AdsMatHyxtInvoiceD;
import com.ruoyi.hywz.mapper.AdsMatHyxtInvoiceDMapper;
import com.ruoyi.hywz.service.IAdsMatHyxtInvoiceDService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 发票表 服务实现类
 * </p>
 *
 * @author mybatisplus-generator
 * @date 2024-04-08 14:25:45
 */
@Service
public class AdsMatHyxtInvoiceDServiceImpl extends ServiceImpl<AdsMatHyxtInvoiceDMapper, AdsMatHyxtInvoiceD> implements IAdsMatHyxtInvoiceDService {

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

    @Override
    public List<AdsMatHyxtInvoiceD> getListByApplyId(String id) {
        LambdaQueryWrapper<AdsMatHyxtInvoiceD> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(AdsMatHyxtInvoiceD::getApplyId, id);
        queryWrapper.eq(AdsMatHyxtInvoiceD::getIsDeleted, 0);
        queryWrapper.orderByDesc(AdsMatHyxtInvoiceD::getCreateTime);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<AdsMatHyxtInvoiceD> selectNode12List() {
        return baseMapper.selectNode12List();
    }

}
