package com.jwipc.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jwipc.sys.entity.Dict;
import com.jwipc.sys.mapper.DictMapper;
import com.jwipc.sys.model.po.DictByTypePO;
import com.jwipc.sys.service.IDictService;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 数据字典主数据表 服务实现类
 * </p>
 *
 * @author zhangjie
 * @since 2024-01-29
 */
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements IDictService {

    @Override
    public List<DictByTypePO> findDictByType(String type) {
        return this.baseMapper.selectDictByType(type);
    }

    @Override
    public List<DictByTypePO> findDictByTypes(List<String> typeCodes) {
        if (typeCodes.size() <= 0) {
            return Collections.emptyList();
        }
        return this.baseMapper.selectDictByTypes(typeCodes);
    }

    @Override
    public DictByTypePO findDictByTypeAndCode(String type, String code) {
        return this.baseMapper.selectDictByTypeAndCode(type,code);
    }

    @Override
    public DictByTypePO findDictByTypeAndName(String type, String name) {
        return this.baseMapper.selectDictByTypeAndName(type,name);
    }
}
