package com.qmth.exam.reserve.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qmth.exam.reserve.dao.SystemPropertyDao;
import com.qmth.exam.reserve.entity.SystemPropertyEntity;
import com.qmth.exam.reserve.service.SystemPropertyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class SystemPropertyServiceImpl extends ServiceImpl<SystemPropertyDao, SystemPropertyEntity> implements SystemPropertyService {

    private static final Logger log = LoggerFactory.getLogger(SystemPropertyServiceImpl.class);

    @Override
    public SystemPropertyEntity findByPropKey(Long orgId, String propKey) {
        LambdaQueryWrapper<SystemPropertyEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SystemPropertyEntity::getPropKey, propKey);
        if (orgId != null) {
            wrapper.eq(SystemPropertyEntity::getOrgId, orgId);
        }
        return baseMapper.selectOne(wrapper);
    }

}
