Browse Source

管理员可以看到所有app

master
nili 8 months ago
parent
commit
f9509d6743
  1. 5
      game-dao/src/main/java/awesome/group/game/dao/mapper/MatrixAppMapper.java
  2. 3
      game-service/src/main/java/awesome/group/game/service/AdminService.java

5
game-dao/src/main/java/awesome/group/game/dao/mapper/MatrixAppMapper.java

@ -6,10 +6,15 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface MatrixAppMapper extends BaseMapper<MatrixApp> {
@Select("select * from matrix_app where code = #{code}")
MatrixApp queryByCode(String code);
@Update("update matrix_app set name = #{app.name}, img=#{app.img}, url=#{app.url}, hide=#{app.hide} where code = #{app.code}")
int updateNameOrUrl(@Param("app") MatrixApp app);
@Select("select * from matrix_app where channel = #{channel}")
List<MatrixApp> selectByChannel(String channel);
}

3
game-service/src/main/java/awesome/group/game/service/AdminService.java

@ -360,6 +360,9 @@ public class AdminService {
if (admin.getRole() == SUPER_ADMIN) {
return appMapper.selectList(null).stream().map(MatrixApp::getId).toList();
}
if (admin.getRole() == NORMAL_ADMIN) {
return appMapper.selectByChannel(admin.getChannel()).stream().map(MatrixApp::getId).toList();
}
if (StringUtils.hasText(admin.getAppIds())) {
return Arrays.stream(admin.getAppIds().split(",")).map(Integer::parseInt).toList();
}

Loading…
Cancel
Save