package org.gyk.modules.sz.bjpz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.gyk.modules.sssj.entity.YasuojiBjCanshu;
import org.gyk.modules.sz.bjpz.entity.CxcSssjSzBjsz;
import org.gyk.modules.sz.bjpz.mapper.CxcSssjSzBjszMapper;
import org.gyk.modules.sz.bjpz.service.ICxcSssjSzBjszService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Description: 参数报警信息表
 * @Author: jeecg-boot
 * @Date:   2021-03-08
 * @Version: V1.0
 */
@Service
public class CxcSssjSzBjszServiceImpl extends ServiceImpl<CxcSssjSzBjszMapper, CxcSssjSzBjsz> implements ICxcSssjSzBjszService {
    @Override
    @Cacheable(value = "sqlBj", key = "#root.methodName")
    public List<CxcSssjSzBjsz> GetBjz() {
        LambdaQueryWrapper<CxcSssjSzBjsz> queryWrapper = new LambdaQueryWrapper<CxcSssjSzBjsz>();
        List<CxcSssjSzBjsz> listAll = baseMapper.selectList(queryWrapper);
        return listAll;
    }

    @Override
    @Cacheable(value = "sqlBj", key = "#root.methodName")
    public Map<String,YasuojiBjCanshu> GetYsjBjz() {
        List<YasuojiBjCanshu> list = baseMapper.getYasuojBjCanshu();
        Map<String,YasuojiBjCanshu> map = list.stream().collect(Collectors.toMap(YasuojiBjCanshu::getGykbz,obj->obj,(key1,key2)->key1));
        return map;
    }

}
