package com.ruoyi.base.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.DlBaseEntity;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.base.mapper.BaseConfigMapper;
import com.ruoyi.base.domain.BaseConfig;
import com.ruoyi.base.service.IBaseConfigService;

/**
 * 基础配置-账户配置、小程序配置的内容Service业务层处理
 * 
 * @author vinjor-m
 * @date 2025-03-17
 */
@Service
public class BaseConfigServiceImpl extends ServiceImpl<BaseConfigMapper,BaseConfig>  implements IBaseConfigService
{
    @Autowired
    private BaseConfigMapper baseConfigMapper;

    @Override
    public IPage<BaseConfig> queryListPage(BaseConfig pageReqVO, Page<BaseConfig> page) {
        return baseConfigMapper.queryListPage(pageReqVO, page);
    }

    /**
     * 通过code获取配置
     *
     * @param code code
     * @return java.util.List<com.ruoyi.base.domain.BaseConfig>
     * @author PQZ
     * @date 16:17 2025/4/25
     **/
    @Override
    public List<BaseConfig> queryConfigByCode(String code) {
        LambdaQueryWrapper<BaseConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(DlBaseEntity::getDelFlag,0)
                .eq(BaseConfig::getCode,code);
        return list(lambdaQueryWrapper);
    }
}
