package cn.com.ctop.performanceappraisal.service.impl;

import cn.com.ctop.performanceappraisal.entity.OptimizerConfig;
import cn.com.ctop.performanceappraisal.mapper.OptimizerConfigMapper;
import cn.com.ctop.performanceappraisal.service.IOptimizerConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 优化师配置信息表
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2019-12-13
 */
@Service
public class OptimizerConfigServiceImpl extends ServiceImpl<OptimizerConfigMapper, OptimizerConfig> implements IOptimizerConfigService {

    @Override
    public OptimizerConfig getEnabledConfigByMediaType(String mediaType, String orgCode) {
        QueryWrapper<OptimizerConfig> queryWrapper = new QueryWrapper();
        queryWrapper.eq("enabled", "1")
                .eq("app_type", mediaType)
                .eq("org_code", orgCode)
                .orderByDesc("id")
                .last(" limit 1");
        return this.getOne(queryWrapper);
    }
}
