commit
This commit is contained in:
+3
-1
@@ -16,6 +16,7 @@ import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -197,7 +198,8 @@ public class ActivityUnionYearSummaryController {
|
||||
SELECT sur.stid FROM sys_user_role sur
|
||||
$condition
|
||||
""");
|
||||
sql.setCondition(Cnd.NEW().and("sur.userId", "=", ShiroUtil.getPrincipalProperty("id")).and("sur.roleId", "=", Roles.CLUB_FZR));
|
||||
sql.setCondition(Cnd.NEW().and("sur.userId", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and(new Static("sur.roleId IN (SELECT id FROM sys_role WHERE id = '" + Roles.CLUB_FZR + "' OR code = '" + Roles.CLUB_JBR_CODE + "')")));
|
||||
List<Record> list = baseService.list(sql);
|
||||
List<String> stids = list.stream().map(x -> x.getString("stid")).collect(Collectors.toList());
|
||||
return stids;
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
@@ -96,7 +97,8 @@ public class Vi {
|
||||
* @return 当前登录用户的所负责的社团id
|
||||
*/
|
||||
public String getClubId() {
|
||||
Sys_user_role userRole = sysUserRoleService.fetch(Cnd.where("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("roleId", "=", Roles.CLUB_FZR));
|
||||
Sys_user_role userRole = sysUserRoleService.fetch(Cnd.where("userId", "=", ShiroUtil.getPrincipalProperty("id"))
|
||||
.and(new Static("roleId IN " + getClubManageRoleSql())));
|
||||
return userRole == null ? "" : userRole.getStid();
|
||||
}
|
||||
|
||||
@@ -104,7 +106,13 @@ public class Vi {
|
||||
* @return 当前登录用户管理的协会社团
|
||||
*/
|
||||
public String getMangeClubStr() {
|
||||
return "(SELECT sur.stid FROM sys_user_role sur WHERE sur.userId = '" + ShiroUtil.getPrincipalProperty("id") + "' and sur.roleId = '" + Roles.CLUB_FZR + "')";
|
||||
return "(SELECT sur.stid FROM sys_user_role sur WHERE sur.userId = '" + ShiroUtil.getPrincipalProperty("id")
|
||||
+ "' AND sur.roleId IN " + getClubManageRoleSql() + ")";
|
||||
}
|
||||
|
||||
// 协会社团管理角色范围:会长和经办人保持相同的数据权限。
|
||||
private String getClubManageRoleSql() {
|
||||
return "(SELECT id FROM sys_role WHERE id = '" + Roles.CLUB_FZR + "' OR code = '" + Roles.CLUB_JBR_CODE + "')";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ import io.v.nutz.util.ViResource;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
@@ -374,9 +375,9 @@ public class ViCommonCon {
|
||||
sys_club club
|
||||
LEFT JOIN `sys_user_role` role ON club.id = role.stid
|
||||
$condition
|
||||
""");
|
||||
""");
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("role.roleId", "=", Roles.CLUB_FZR);
|
||||
cnd.and(new Static("role.roleId IN (SELECT id FROM sys_role WHERE id = '" + Roles.CLUB_FZR + "' OR code = '" + Roles.CLUB_JBR_CODE + "')"));
|
||||
cnd.and("role.userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
cnd.and("club.isjs", "=", false);
|
||||
|
||||
@@ -208,7 +208,7 @@ public class SysClubCon {
|
||||
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
} else {
|
||||
cnd.and("club.fzr", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and(new Static("(club.fzr = '" + ShiroUtil.getPrincipalProperty("id") + "' OR " + getClubManageRoleCnd("club.id") + ")"));
|
||||
}
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ public class SysClubCon {
|
||||
record.set("child", sysClubService.query(Cnd.NEW().asc("code")));
|
||||
} else {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(new Static("id in (select stid from sys_user_role where userId = '" + ShiroUtil.getPrincipalProperty("id") + "' and roleid = '" + Roles.CLUB_FZR + "')"));
|
||||
cnd.and(new Static(getClubManageRoleCnd("id")));
|
||||
record.set("child", sysClubService.query(cnd));
|
||||
}
|
||||
|
||||
@@ -341,4 +341,12 @@ public class SysClubCon {
|
||||
return Result.error("获取工会信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 协会社团管理角色范围:会长和经办人都可以进入对应协会数据。
|
||||
private String getClubManageRoleCnd(String clubIdColumn) {
|
||||
return clubIdColumn + " IN ( SELECT stid FROM sys_user_role WHERE userId = '"
|
||||
+ ShiroUtil.getPrincipalProperty("id")
|
||||
+ "' AND stid IS NOT NULL AND roleid IN (SELECT id FROM sys_role WHERE id = '"
|
||||
+ Roles.CLUB_FZR + "' OR code = '" + Roles.CLUB_JBR_CODE + "') )";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user