【fix sonar】OnlAuthRelationServiceImpl文件

This commit is contained in:
梁琦涛
2023-03-13 14:08:05 +08:00
parent 55c7e2c332
commit 93b4a9bc91
@@ -1,35 +1,36 @@
package com.jero.generater.modules.online.auth.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.generater.modules.online.auth.entity.OnlAuthRelation;
import com.jero.generater.modules.online.auth.mapper.OnlAuthRelationMapper;
import com.jero.generater.modules.online.auth.service.IOnlAuthRelationService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service("OnlAuthRelationServiceImpl")
@Service("onlAuthRelationServiceImpl")
public class OnlAuthRelationServiceImpl extends ServiceImpl<OnlAuthRelationMapper, OnlAuthRelation> implements IOnlAuthRelationService {
@Override
public void saveRoleAuth(String roleId, String cgformId, int type, List<String> authIds) {
LambdaQueryWrapper<OnlAuthRelation> lambdaQueryWrapper = new LambdaQueryWrapper();
LambdaQueryWrapper<OnlAuthRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OnlAuthRelation::getCgformId, cgformId)
.eq(OnlAuthRelation::getType, Integer.valueOf(type))
.eq(OnlAuthRelation::getType, type)
.eq(OnlAuthRelation::getRoleId, roleId);
this.baseMapper.delete((Wrapper)lambdaQueryWrapper);
this.baseMapper.delete(lambdaQueryWrapper);
ArrayList<OnlAuthRelation> arrayList = new ArrayList();
ArrayList<OnlAuthRelation> arrayList = new ArrayList<>();
for (String str : authIds) {
OnlAuthRelation onlAuthRelation = new OnlAuthRelation();
onlAuthRelation.setAuthId(str);
onlAuthRelation.setCgformId(cgformId);
onlAuthRelation.setRoleId(roleId);
onlAuthRelation.setType(Integer.valueOf(type));
arrayList.add(onlAuthRelation);
OnlAuthRelation onlAuthRelation = new OnlAuthRelation();
onlAuthRelation.setAuthId(str);
onlAuthRelation.setCgformId(cgformId);
onlAuthRelation.setRoleId(roleId);
onlAuthRelation.setType(type);
arrayList.add(onlAuthRelation);
}
saveBatch(arrayList);