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