123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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;
- /**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author
- * @since 2023-08-30
- */
- @Service
- public class JySceneAuthServiceImpl extends ServiceImpl<IJySceneAuthMapper, JySceneAuth> implements IJySceneAuthService {
- @Override
- public JySceneAuth getByNum(String num) {
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(JySceneAuth::getNum,num);
- return this.getOne(wrapper);
- }
- @Override
- public HashMap<String, JySceneAuth> getByNumList(List<String> numList) {
- HashMap<String, JySceneAuth> map = new HashMap<>();
- if(numList.isEmpty()){
- return map;
- }
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.in(JySceneAuth::getNum,numList);
- List<JySceneAuth> 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<JySceneAuth> wrapper = new LambdaUpdateWrapper<>();
- wrapper.eq(JySceneAuth::getNum,num);
- wrapper.set(JySceneAuth::getAuthType,authType);
- this.update(wrapper);
- }
- }
|