修复了选择权限组成员时出现多个重复权限的问题

This commit is contained in:
zhangyuheng 2024-07-01 21:05:36 +08:00
parent 2f7ae111a9
commit 9a36ddbc06
4 changed files with 8 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.34.5-beta</version>
<version>1.34.6-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>

View File

@ -55,7 +55,7 @@ public class Helper {
if (dominion == null) return players_name;
GroupDTO group = GroupDTO.select(dominion.getId(), groupName);
if (group == null) return players_name;
List<PlayerPrivilegeDTO> privileges = PlayerPrivilegeDTO.selectByGroupId(group.getId());
List<PlayerPrivilegeDTO> privileges = PlayerPrivilegeDTO.selectByDomGroupId(dominion.getId(), group.getId());
for (PlayerPrivilegeDTO privilege : privileges) {
PlayerDTO player = PlayerDTO.select(privilege.getPlayerUUID());
if (player == null) continue;

View File

@ -115,6 +115,11 @@ public class PlayerPrivilegeDTO {
return query(sql, groupId);
}
public static List<PlayerPrivilegeDTO> selectByDomGroupId(Integer domId, Integer groupId) {
String sql = "SELECT * FROM player_privilege WHERE group_id = ? AND dom_id = ?;";
return query(sql, groupId, domId);
}
Field id = new Field("id", FieldType.INT);
Field playerUUID = new Field("player_uuid", FieldType.STRING);
Field admin = new Field("admin", FieldType.BOOLEAN);

View File

@ -43,7 +43,7 @@ public class SelectMember {
Line sub = Line.create().append("选择成员添加到权限组 " + group.getName())
.append(Button.create("返回").setExecuteCommand("/dominion group list " + dominion.getName() + " " + backPage).build());
view.subtitle(sub);
List<PlayerPrivilegeDTO> members = PlayerPrivilegeDTO.selectByGroupId(-1);
List<PlayerPrivilegeDTO> members = PlayerPrivilegeDTO.selectByDomGroupId(dominion.getId(), -1);
for (PlayerPrivilegeDTO member : members) {
PlayerDTO p = PlayerDTO.select(member.getPlayerUUID());
if (p == null) continue;