package com.tofly.third.service;


import cn.hutool.core.util.ObjectUtil;
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.tofly.third.common.exception.BusinessException;
import com.tofly.third.entity.SysGdcsb;
import com.tofly.third.mapper.SysGdcsbMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class SysGdcsbService extends ServiceImpl<SysGdcsbMapper, SysGdcsb> {

    public String selectCwrq() {
        LambdaQueryWrapper<SysGdcsb> wrapper = Wrappers.<SysGdcsb>lambdaQuery()
                .eq(SysGdcsb::getGdbz, "0");
        SysGdcsb gdcsb = getOne(wrapper);
        if (ObjectUtil.isNull(gdcsb)) {
            throw new BusinessException("系统归档参数配置错误");
        }

        return gdcsb.getCwrq();
    }
}
