package com.njcn.product.system.dict.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;

import com.njcn.db.mybatisplus.constant.DbConstant;
import com.njcn.product.system.dict.mapper.DictDataMapper;
import com.njcn.product.system.dict.pojo.enums.DicDataEnum;
import com.njcn.product.system.dict.pojo.enums.DicDataTypeEnum;
import com.njcn.product.system.dict.pojo.enums.SystemResponseEnum;
import com.njcn.product.system.dict.pojo.param.DictDataParam;
import com.njcn.product.system.dict.pojo.po.DictData;
import com.njcn.product.system.dict.pojo.po.DictType;
import com.njcn.product.system.dict.pojo.vo.DictDataVO;
import com.njcn.product.system.dict.service.IDictDataService;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author hongawen
 * @since 2021-12-13
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements IDictDataService {



    @Override
    public DictData getDicDataById(String dicIndex) {

        return this.baseMapper.selectById(dicIndex);
    }

    @Override
    public DictData getDicDataByNameAndTypeName(String dicTypeName, String dicDataName) {
        return this.baseMapper.getDicDataByNameAndTypeName(dicTypeName, dicDataName);
    }


    @Override
    public DictData getDicDataByCodeAndType(String dicCode, String typeCode) {
        return this.baseMapper.getDicDataByCodeAndType(dicCode, typeCode);
    }


    @Override
    public List<DictData> getDicDataByTypeCode(String dictTypeCode) {
        return this.baseMapper.getDicDataByTypeCode(dictTypeCode);
    }


}
