package com.corewing.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.corewing.app.entity.BizDict;
import com.corewing.app.mapper.BizDictMapper;
import com.corewing.app.service.BizDictService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BizDictServiceImpl extends ServiceImpl<BizDictMapper, BizDict> implements BizDictService {


    @Override
    public List<BizDict> getDataListByKey() {
        LambdaQueryWrapper<BizDict> parentQueryWrapper = new LambdaQueryWrapper<>();
        parentQueryWrapper.eq(BizDict::getDictValue, "PUBLIC_FIRMWARE_TYPE");
        BizDict parentDict = getOne(parentQueryWrapper);
        LambdaQueryWrapper<BizDict> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BizDict::getParentId, parentDict.getId());
        return list(queryWrapper);
    }
}
