package com.fdkankan.manage.service.impl; import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.fdkankan.manage.entity.JySceneAuth; import com.fdkankan.manage.mapper.IJySceneAuthMapper; import com.fdkankan.manage.service.IJySceneAuthService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; /** *

* 服务实现类 *

* * @author * @since 2023-08-30 */ @Service public class JySceneAuthServiceImpl extends ServiceImpl implements IJySceneAuthService { @Override public JySceneAuth getByNum(String num) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(JySceneAuth::getNum,num); return this.getOne(wrapper); } @Override public HashMap getByNumList(List numList) { HashMap map = new HashMap<>(); if(numList.isEmpty()){ return map; } LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.in(JySceneAuth::getNum,numList); List list = this.list(wrapper); list.forEach(e -> map.put(e.getNum(),e)); return map; } @Override public void updateAuthTypeByNum(String num, Integer authType) { JySceneAuth auth = this.getByNum(num); if(auth == null){ auth = new JySceneAuth(authType); auth.setNum(num); this.save(auth); return; } LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); wrapper.eq(JySceneAuth::getNum,num); wrapper.set(JySceneAuth::getAuthType,authType); this.update(wrapper); } }