给用户/角色/模块关系表增加租户字段

This commit is contained in:
季圣华
2021-11-05 21:50:09 +08:00
parent 69742cf392
commit c469520641
8 changed files with 180 additions and 59 deletions

View File

@@ -11,6 +11,7 @@ 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;
@@ -68,6 +69,14 @@ 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(",","\\]\\[");
userBusiness.setValue(newValue);
@@ -138,6 +147,19 @@ public class UserBusinessService {
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){
JshException.readFail(logger, e);
}
return list;
}
public String getUBValueByTypeAndKeyId(String type, String keyId) throws Exception {
String ubValue = "";
List<UserBusiness> ubList = getBasicData(keyId, type);