【添加】service文件添加
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
package com.jero.generater.modules.online.auth.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthData;
|
||||
|
||||
public interface IOnlAuthDataService extends IService<OnlAuthData> {
|
||||
void deleteOne(String str);
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.jero.generater.modules.online.auth.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthPage;
|
||||
import com.jero.generater.modules.online.auth.vo.AuthColumnVO;
|
||||
import com.jero.generater.modules.online.auth.vo.AuthPageVO;
|
||||
|
||||
public interface IOnlAuthPageService extends IService<OnlAuthPage> {
|
||||
void disableAuthColumn(AuthColumnVO authColumnVO);
|
||||
|
||||
void enableAuthColumn(AuthColumnVO authColumnVO);
|
||||
|
||||
List<AuthPageVO> queryAuthByFormId(String str, int i);
|
||||
|
||||
List<String> queryFormDisabledCode(String str);
|
||||
|
||||
List<String> queryFormHideButton(String str, String str2);
|
||||
|
||||
List<String> queryFormHideColumn(String str, String str2);
|
||||
|
||||
List<String> queryHideCode(String str, String str2, boolean z);
|
||||
|
||||
List<String> queryHideCode(String str, boolean z);
|
||||
|
||||
List<String> queryListHideButton(String str, String str2);
|
||||
|
||||
List<String> queryListHideColumn(String str, String str2);
|
||||
|
||||
List<AuthPageVO> queryRoleAuthByFormId(String str, String str2, int i);
|
||||
|
||||
List<AuthPageVO> queryRoleDataAuth(String str, String str2);
|
||||
|
||||
List<String> queryRoleNoAuthCode(String str, Integer num, Integer num2);
|
||||
|
||||
void switchAuthColumn(AuthColumnVO authColumnVO);
|
||||
|
||||
void switchFormEditable(String str, String str2, boolean z);
|
||||
|
||||
void switchFormShow(String str, String str2, boolean z);
|
||||
|
||||
void switchListShow(String str, String str2, boolean z);
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.jero.generater.modules.online.auth.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthRelation;
|
||||
|
||||
public interface IOnlAuthRelationService extends IService<OnlAuthRelation> {
|
||||
void saveRoleAuth(String str, String str2, int i, List<String> list);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthData;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthRelation;
|
||||
import com.jero.generater.modules.online.auth.mapper.OnlAuthDataMapper;
|
||||
import com.jero.generater.modules.online.auth.mapper.OnlAuthRelationMapper;
|
||||
import com.jero.generater.modules.online.auth.service.IOnlAuthDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("onlAuthDataServiceImpl")
|
||||
public class onlAuthDataServiceImpl extends ServiceImpl<OnlAuthDataMapper, OnlAuthData> implements IOnlAuthDataService
|
||||
{
|
||||
@Autowired
|
||||
private OnlAuthRelationMapper onlAuthRelationMapper;
|
||||
|
||||
public void deleteOne(String id) {
|
||||
removeById(id);
|
||||
LambdaQueryWrapper<OnlAuthRelation> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
this.onlAuthRelationMapper.delete((Wrapper)lambdaQueryWrapper.eq(OnlAuthRelation::getAuthId, id));
|
||||
}
|
||||
}
|
||||
|
||||
+198
@@ -0,0 +1,198 @@
|
||||
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 com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthPage;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthRelation;
|
||||
import com.jero.generater.modules.online.auth.mapper.OnlAuthPageMapper;
|
||||
import com.jero.generater.modules.online.auth.mapper.OnlAuthRelationMapper;
|
||||
import com.jero.generater.modules.online.auth.service.IOnlAuthPageService;
|
||||
import com.jero.generater.modules.online.auth.vo.AuthColumnVO;
|
||||
import com.jero.generater.modules.online.auth.vo.AuthPageVO;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Service("onlAuthPageServiceImpl")
|
||||
public class onlAuthPageServiceImpl extends ServiceImpl<OnlAuthPageMapper, OnlAuthPage> implements IOnlAuthPageService {
|
||||
@Autowired
|
||||
private OnlAuthRelationMapper onlAuthRelationMapper;
|
||||
|
||||
public void disableAuthColumn(AuthColumnVO authColumnVO) {
|
||||
LambdaUpdateWrapper<OnlAuthPage> lambdaUpdateWrapper = new LambdaUpdateWrapper();
|
||||
lambdaUpdateWrapper.eq(OnlAuthPage::getCgformId, authColumnVO.getCgformId())
|
||||
.eq(OnlAuthPage::getCode, authColumnVO.getCode())
|
||||
.eq(OnlAuthPage::getType, Integer.valueOf(1))
|
||||
.set(OnlAuthPage::getStatus, Integer.valueOf(0));
|
||||
update((Wrapper) lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void enableAuthColumn(AuthColumnVO authColumnVO) {
|
||||
String cgformId = authColumnVO.getCgformId();
|
||||
String code = authColumnVO.getCode();
|
||||
|
||||
LambdaQueryWrapper<OnlAuthPage> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.eq(OnlAuthPage::getCgformId, cgformId)
|
||||
.eq(OnlAuthPage::getCode, code)
|
||||
.eq(OnlAuthPage::getType, Integer.valueOf(1));
|
||||
List<OnlAuthPage> list = list((Wrapper) lambdaQueryWrapper);
|
||||
if (list != null && list.size() > 0) {
|
||||
LambdaUpdateWrapper<OnlAuthPage> lambdaUpdateWrapper = new LambdaUpdateWrapper();
|
||||
lambdaUpdateWrapper.eq(OnlAuthPage::getCgformId, cgformId)
|
||||
.eq(OnlAuthPage::getCode, code)
|
||||
.eq(OnlAuthPage::getType, Integer.valueOf(1))
|
||||
.set(OnlAuthPage::getStatus, Integer.valueOf(1));
|
||||
update((Wrapper) lambdaUpdateWrapper);
|
||||
} else {
|
||||
list = new ArrayList();
|
||||
list.add(new OnlAuthPage(cgformId, code, 3, 5));
|
||||
list.add(new OnlAuthPage(cgformId, code, 5, 5));
|
||||
list.add(new OnlAuthPage(cgformId, code, 5, 3));
|
||||
saveBatch(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void switchAuthColumn(AuthColumnVO authColumnVO) {
|
||||
String str1 = authColumnVO.getCgformId();
|
||||
String str2 = authColumnVO.getCode();
|
||||
int i = authColumnVO.getSwitchFlag();
|
||||
if (i == 1) {
|
||||
switchListShow(str1, str2, authColumnVO.isListShow());
|
||||
} else if (i == 2) {
|
||||
switchFormShow(str1, str2, authColumnVO.isFormShow());
|
||||
} else if (i == 3) {
|
||||
switchFormEditable(str1, str2, authColumnVO.isFormEditable());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void switchFormShow(String cgformId, String code, boolean flag) {
|
||||
a(cgformId, code, 5, 5, flag);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void switchFormEditable(String cgformId, String code, boolean flag) {
|
||||
a(cgformId, code, 3, 5, flag);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void switchListShow(String cgformId, String code, boolean flag) {
|
||||
a(cgformId, code, 5, 3, flag);
|
||||
}
|
||||
|
||||
|
||||
public List<AuthPageVO> queryRoleAuthByFormId(String roleId, String cgformId, int type) {
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleAuthByFormId(roleId, cgformId, type);
|
||||
}
|
||||
|
||||
|
||||
public List<AuthPageVO> queryRoleDataAuth(String roleId, String cgformId) {
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleDataAuth(roleId, cgformId);
|
||||
}
|
||||
|
||||
|
||||
public List<AuthPageVO> queryAuthByFormId(String cgformId, int type) {
|
||||
if (type == 1) {
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryAuthColumnByFormId(cgformId);
|
||||
}
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryAuthButtonByFormId(cgformId);
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryRoleNoAuthCode(String cgformId, Integer control, Integer page) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String str = loginUser.getId();
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(str, cgformId, control, page, null);
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryFormDisabledCode(String cgformId) {
|
||||
return queryRoleNoAuthCode(cgformId, Integer.valueOf(3), Integer.valueOf(5));
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryHideCode(String userId, String cgformId, boolean isList) {
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, Integer.valueOf(5), Integer.valueOf(isList ? 3 : 5), null);
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryListHideColumn(String userId, String cgformId) {
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, Integer.valueOf(5), Integer.valueOf(3), Integer.valueOf(1));
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryFormHideColumn(String userId, String cgformId) {
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, Integer.valueOf(5), Integer.valueOf(5), Integer.valueOf(1));
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryFormHideButton(String userId, String cgformId) {
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, Integer.valueOf(5), Integer.valueOf(5), Integer.valueOf(2));
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryHideCode(String cgformId, boolean isList) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String str = loginUser.getId();
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(str, cgformId, Integer.valueOf(5), Integer.valueOf(isList ? 3 : 5), null);
|
||||
}
|
||||
|
||||
|
||||
public List<String> queryListHideButton(String userId, String cgformId) {
|
||||
if (userId == null) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
userId = loginUser.getId();
|
||||
}
|
||||
return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, Integer.valueOf(5), Integer.valueOf(3), Integer.valueOf(2));
|
||||
}
|
||||
|
||||
private void a(String paramString1, String paramString2, int paramInt1, int paramInt2, boolean paramBoolean) {
|
||||
LambdaQueryWrapper<OnlAuthPage> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.eq(OnlAuthPage::getCgformId, paramString1)
|
||||
.eq(OnlAuthPage::getCode, paramString2)
|
||||
.eq(OnlAuthPage::getControl, Integer.valueOf(paramInt1))
|
||||
.eq(OnlAuthPage::getPage, Integer.valueOf(paramInt2))
|
||||
.eq(OnlAuthPage::getType, Integer.valueOf(1));
|
||||
|
||||
OnlAuthPage onlAuthPage = (OnlAuthPage) ((OnlAuthPageMapper) this.baseMapper).selectOne((Wrapper) lambdaQueryWrapper);
|
||||
if (paramBoolean) {
|
||||
if (onlAuthPage == null) {
|
||||
|
||||
OnlAuthPage onlAuthPage1 = new OnlAuthPage();
|
||||
onlAuthPage1.setCgformId(paramString1);
|
||||
onlAuthPage1.setCode(paramString2);
|
||||
onlAuthPage1.setControl(Integer.valueOf(paramInt1));
|
||||
onlAuthPage1.setPage(Integer.valueOf(paramInt2));
|
||||
onlAuthPage1.setType(Integer.valueOf(1));
|
||||
onlAuthPage1.setStatus(Integer.valueOf(1));
|
||||
((OnlAuthPageMapper) this.baseMapper).insert(onlAuthPage1);
|
||||
|
||||
} else if (onlAuthPage.getStatus().intValue() == 0) {
|
||||
onlAuthPage.setStatus(Integer.valueOf(1));
|
||||
((OnlAuthPageMapper) this.baseMapper).updateById(onlAuthPage);
|
||||
}
|
||||
|
||||
} else if (!paramBoolean && onlAuthPage != null) {
|
||||
|
||||
String str = onlAuthPage.getId();
|
||||
((OnlAuthPageMapper) this.baseMapper).deleteById(str);
|
||||
this.onlAuthRelationMapper.delete((Wrapper) (new LambdaQueryWrapper<OnlAuthRelation>()).eq(OnlAuthRelation::getAuthId, str));
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Service("onlAuthRelationServiceImpl")
|
||||
public class onlAuthRelationServiceImpl extends ServiceImpl<OnlAuthRelationMapper, OnlAuthRelation> implements IOnlAuthRelationService {
|
||||
public void saveRoleAuth(String roleId, String cgformId, int type, List<String> authIds) {
|
||||
LambdaQueryWrapper<OnlAuthRelation> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.eq(OnlAuthRelation::getCgformId, cgformId)
|
||||
.eq(OnlAuthRelation::getType, Integer.valueOf(type))
|
||||
.eq(OnlAuthRelation::getRoleId, roleId);
|
||||
|
||||
this.baseMapper.delete((Wrapper)lambdaQueryWrapper);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
saveBatch(arrayList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user