Commit 5effcffb authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/MVP1.5.8' into MVP1.5.8

parents 95506d0d 0626bd5b
...@@ -216,53 +216,56 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs ...@@ -216,53 +216,56 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
sql.append(" 1=2 "); sql.append(" 1=2 ");
// 继续下一步,找数据权限配置 // 继续下一步,找数据权限配置
List<SysUserPermission> permissionList = sysUserPermissionMapper.getUserPermissionByUserId(userId); List<SysUserPermission> permissionList = sysUserPermissionMapper.getUserPermissionByUserId(userId);
if (permissionList != null && !permissionList.isEmpty() && Common.isNotNull(menu.getCustomerId())) { if (permissionList != null && !permissionList.isEmpty() ) {
setAuthSql(sql, "1", menu.getCustomerId(), permissionList); setAuthSql(sql, "1", menu.getCustomerId(), permissionList);
setAuthSql(sql, "2", menu.getBussinessId(), permissionList); setAuthSql(sql, "2", menu.getBussinessId(), permissionList);
setAuthSql(sql, "3", menu.getQuotationId(), permissionList); setAuthSql(sql, "3", menu.getQuotationId(), permissionList);
setAuthSql(sql, "4", menu.getContractId(), permissionList); setAuthSql(sql, "4", menu.getContractId(), permissionList);
setAuthSql(sql, "5", menu.getDomainId(), permissionList); setAuthSql(sql, "5", menu.getDomainId(), permissionList);
setAuthSql(sql, "6", menu.getBuId(), permissionList); setAuthSql(sql, "6", menu.getBuId(), permissionList);
setAuthSql(sql, "7", menu.getLineId(), permissionList); setAuthSql(sql, "7", menu.getLineId(), permissionList);
setAuthSql(sql, "9", menu.getIncomeId(), permissionList); setAuthSql(sql, "9", menu.getIncomeId(), permissionList);
// TODO-部门
// TODO-部门 setAuthSqlByDept(sql, menu.getDeptId(), permissionList);
setAuthSqlByDept(sql, menu.getDeptId(), permissionList);
} }
} }
} }
if (Common.isNotNull(sql)) { if (Common.isNotNull(sql) && sql.length() > 0) {
return " or ( " + sql + " ) "; return " or ( " + sql + " ) ";
} }
return ""; return "";
} }
private void setAuthSql(StringBuilder sql, String type, String shuXing, List<SysUserPermission> permissionList) { private void setAuthSql(StringBuilder sql, String type, String shuXing, List<SysUserPermission> permissionList) {
StringBuilder tempValue = new StringBuilder(); if (Common.isNotNull(shuXing)) {
for (SysUserPermission permission : permissionList) { StringBuilder tempValue = new StringBuilder();
if (("6".equals(type) || "7".equals(type)) && type.equals(permission.getPermissionType())) { for (SysUserPermission permission : permissionList) {
tempValue.append("'").append(permission.getName()).append("',"); if (("6".equals(type) || "7".equals(type)) && type.equals(permission.getPermissionType()) && Common.isNotNull(permission.getName())) {
} else if (type.equals(permission.getPermissionType())) { tempValue.append("'").append(permission.getName()).append("',");
tempValue.append("'").append(permission.getCode()).append("',"); } else if (type.equals(permission.getPermissionType()) && Common.isNotNull(permission.getCode())) {
tempValue.append("'").append(permission.getCode()).append("',");
}
} }
if (tempValue.length() > 0) {
tempValue.deleteCharAt(tempValue.length() - 1);
}
sql.append(" or (").append(shuXing).append(" in (").append(tempValue).append("))");
} }
if (tempValue.length() > 0) {
tempValue.deleteCharAt(tempValue.length() - 1);
}
sql.append(" or (").append(shuXing).append(" in (").append(tempValue).append("))");
} }
private void setAuthSqlByDept(StringBuilder sql, String shuXing, List<SysUserPermission> permissionList) { private void setAuthSqlByDept(StringBuilder sql, String shuXing, List<SysUserPermission> permissionList) {
StringBuilder tempValue = new StringBuilder(); if (Common.isNotNull(shuXing)) {
for (SysUserPermission permission : permissionList) { StringBuilder tempValue = new StringBuilder();
if ("8".equals(permission.getPermissionType())) { for (SysUserPermission permission : permissionList) {
tempValue.append("'").append(permission.getCode()).append("',"); if ("8".equals(permission.getPermissionType()) && Common.isNotNull(permission.getCode())) {
tempValue.append("'").append(permission.getCode()).append("',");
}
} }
if (tempValue.length() > 0) {
tempValue.deleteCharAt(tempValue.length() - 1);
}
sql.append(" or (").append(shuXing).append(" in (").append(tempValue).append("))");
} }
if (tempValue.length() > 0) {
tempValue.deleteCharAt(tempValue.length() - 1);
}
sql.append(" or (").append(shuXing).append(" in (").append(tempValue).append("))");
} }
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM sys_menu a FROM sys_menu a
where a.DELETE_STATUS = '1' and a.PERMISSION_STATUS='0' and a.MODEL_ID = {modelId} where a.DELETE_STATUS = '1' and a.PERMISSION_STATUS='0' and a.MODEL_ID = #{modelId}
limit 1 limit 1
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment