package com.ruoyi.hywz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.hywz.entity.AdsMatHyxtStampTaxWarningRuleD;
import com.ruoyi.hywz.mapper.AdsMatHyxtStampTaxWarningRuleDMapper;
import com.ruoyi.hywz.service.IAdsMatHyxtStampTaxWarningRuleDService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 【印花税】预警规则表 服务实现类
 * </p>
 *
 * @author mybatisplus-generator
 * @date 2024-08-20 09:35:44
 */
@Service
public class AdsMatHyxtStampTaxWarningRuleDServiceImpl extends ServiceImpl<AdsMatHyxtStampTaxWarningRuleDMapper, AdsMatHyxtStampTaxWarningRuleD> implements IAdsMatHyxtStampTaxWarningRuleDService {

    @Override
    public List<AdsMatHyxtStampTaxWarningRuleD> getList() {
        LambdaQueryWrapper<AdsMatHyxtStampTaxWarningRuleD> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.orderByAsc(AdsMatHyxtStampTaxWarningRuleD::getSort);
        return this.list(queryWrapper);
    }

    @Override
    public AdsMatHyxtStampTaxWarningRuleD getByWarningType(String warningType) {
        LambdaQueryWrapper<AdsMatHyxtStampTaxWarningRuleD> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(AdsMatHyxtStampTaxWarningRuleD::getWarningType, warningType);
        List<AdsMatHyxtStampTaxWarningRuleD> list = baseMapper.selectList(queryWrapper);
        if (!list.isEmpty()) {
            return list.get(0);
        }
        return null;
    }
}
