优化用户角色的关联关系接口的逻辑
This commit is contained in:
@@ -55,8 +55,8 @@ public class TenantConfig {
|
||||
if (tenantId!=0L) {
|
||||
// 这里可以判断是否过滤表
|
||||
if ("jsh_material_property".equals(tableName) || "jsh_sequence".equals(tableName)
|
||||
|| "jsh_user_business".equals(tableName) || "jsh_function".equals(tableName)
|
||||
|| "jsh_platform_config".equals(tableName) || "jsh_tenant".equals(tableName)) {
|
||||
|| "jsh_function".equals(tableName) || "jsh_platform_config".equals(tableName)
|
||||
|| "jsh_tenant".equals(tableName)) {
|
||||
res = true;
|
||||
} else {
|
||||
res = false;
|
||||
@@ -85,6 +85,8 @@ public class TenantConfig {
|
||||
return true;
|
||||
} else if ("com.jsh.erp.datasource.mappers.LogMapperEx.insertLogWithUserId".equals(ms.getId())) {
|
||||
return true;
|
||||
} else if ("com.jsh.erp.datasource.mappers.UserBusinessMapperEx.getBasicDataByKeyIdAndType".equals(ms.getId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.UserBusiness;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
@@ -34,8 +30,6 @@ public class UserBusinessController {
|
||||
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.UserBusiness;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date; /**
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @Author: qiankunpingtai
|
||||
@@ -12,4 +16,7 @@ public interface UserBusinessMapperEx {
|
||||
|
||||
int batchDeleteUserBusinessByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
||||
|
||||
List<UserBusiness> getBasicDataByKeyIdAndType(
|
||||
@Param("keyId") String keyId,
|
||||
@Param("type") String type);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,14 @@ package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.entities.UserBusiness;
|
||||
import com.jsh.erp.datasource.entities.UserBusinessExample;
|
||||
import com.jsh.erp.datasource.mappers.UserBusinessMapper;
|
||||
import com.jsh.erp.datasource.mappers.UserBusinessMapperEx;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.CommonQueryManager;
|
||||
import com.jsh.erp.service.functions.FunctionService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -21,7 +19,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserBusinessService {
|
||||
@@ -36,12 +35,6 @@ public class UserBusinessService {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private FunctionService functionService;
|
||||
|
||||
@Resource
|
||||
private CommonQueryManager configResourceManager;
|
||||
|
||||
public UserBusiness getUserBusiness(long id)throws Exception {
|
||||
UserBusiness result=null;
|
||||
try{
|
||||
@@ -69,14 +62,6 @@ public class UserBusinessService {
|
||||
UserBusiness userBusiness = JSONObject.parseObject(obj.toJSONString(), UserBusiness.class);
|
||||
int result=0;
|
||||
try{
|
||||
String token = "";
|
||||
if(request!=null) {
|
||||
token = request.getHeader("X-Access-Token");
|
||||
Long tenantId = Tools.getTenantIdByToken(token);
|
||||
if(tenantId!=0L) {
|
||||
userBusiness.setTenantId(tenantId);
|
||||
}
|
||||
}
|
||||
String value = userBusiness.getValue();
|
||||
String newValue = value.replaceAll(",","\\]\\[");
|
||||
newValue = newValue.replaceAll("\\[0\\]","").replaceAll("\\[\\]","");
|
||||
@@ -139,23 +124,7 @@ public class UserBusinessService {
|
||||
public List<UserBusiness> getBasicData(String keyId, String type)throws Exception{
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andKeyIdEqualTo(keyId).andTypeEqualTo(type)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
list= userBusinessMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<UserBusiness> getListBy(String keyId, String type)throws Exception{
|
||||
List<UserBusiness> list=null;
|
||||
try{
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andKeyIdEqualTo(keyId).andTypeEqualTo(type)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
list= userBusinessMapper.selectByExample(example);
|
||||
list= userBusinessMapperEx.getBasicDataByKeyIdAndType(keyId, type);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user