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
sql.append(" 1=2 ");
// 继续下一步,找数据权限配置
List<SysUserPermission> permissionList = sysUserPermissionMapper.getUserPermissionByUserId(userId);
if (permissionList != null && !permissionList.isEmpty() && Common.isNotNull(menu.getCustomerId())) {
setAuthSql(sql, "1", menu.getCustomerId(), permissionList);
setAuthSql(sql, "2", menu.getBussinessId(), permissionList);
setAuthSql(sql, "3", menu.getQuotationId(), permissionList);
setAuthSql(sql, "4", menu.getContractId(), permissionList);
setAuthSql(sql, "5", menu.getDomainId(), permissionList);
setAuthSql(sql, "6", menu.getBuId(), permissionList);
setAuthSql(sql, "7", menu.getLineId(), permissionList);
setAuthSql(sql, "9", menu.getIncomeId(), permissionList);
// TODO-部门
setAuthSqlByDept(sql, menu.getDeptId(), permissionList);
if (permissionList != null && !permissionList.isEmpty() ) {
setAuthSql(sql, "1", menu.getCustomerId(), permissionList);
setAuthSql(sql, "2", menu.getBussinessId(), permissionList);
setAuthSql(sql, "3", menu.getQuotationId(), permissionList);
setAuthSql(sql, "4", menu.getContractId(), permissionList);
setAuthSql(sql, "5", menu.getDomainId(), permissionList);
setAuthSql(sql, "6", menu.getBuId(), permissionList);
setAuthSql(sql, "7", menu.getLineId(), permissionList);
setAuthSql(sql, "9", menu.getIncomeId(), permissionList);
// TODO-部门
setAuthSqlByDept(sql, menu.getDeptId(), permissionList);
}
}
}
if (Common.isNotNull(sql)) {
if (Common.isNotNull(sql) && sql.length() > 0) {
return " or ( " + sql + " ) ";
}
return "";
}
private void setAuthSql(StringBuilder sql, String type, String shuXing, List<SysUserPermission> permissionList) {
StringBuilder tempValue = new StringBuilder();
for (SysUserPermission permission : permissionList) {
if (("6".equals(type) || "7".equals(type)) && type.equals(permission.getPermissionType())) {
tempValue.append("'").append(permission.getName()).append("',");
} else if (type.equals(permission.getPermissionType())) {
tempValue.append("'").append(permission.getCode()).append("',");
if (Common.isNotNull(shuXing)) {
StringBuilder tempValue = new StringBuilder();
for (SysUserPermission permission : permissionList) {
if (("6".equals(type) || "7".equals(type)) && type.equals(permission.getPermissionType()) && Common.isNotNull(permission.getName())) {
tempValue.append("'").append(permission.getName()).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) {
StringBuilder tempValue = new StringBuilder();
for (SysUserPermission permission : permissionList) {
if ("8".equals(permission.getPermissionType())) {
tempValue.append("'").append(permission.getCode()).append("',");
if (Common.isNotNull(shuXing)) {
StringBuilder tempValue = new StringBuilder();
for (SysUserPermission permission : permissionList) {
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 @@
SELECT
<include refid="Base_Column_List"/>
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
</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