src/main/java/com/byh/biyesheji/controller/RoleController.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.byh.biyesheji.controller;

import com.byh.biyesheji.pojo.Permission;
import com.byh.biyesheji.pojo.Review;
import com.byh.biyesheji.pojo.Role;
import com.byh.biyesheji.service.PermissionService;
import com.byh.biyesheji.service.RolePermissionService;
import com.byh.biyesheji.service.RoleService;
import com.byh.biyesheji.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 管理员角色controler
 */
@Controller
@RequestMapping("/config")
public class RoleController {
    @Autowired
    RoleService roleService;
    @Autowired
    RolePermissionService rolePermissionService;
    @Autowired
    PermissionService permissionService;

    @RequestMapping("/addRoleUI")
    public String addRole(){

        return "syspage/admin-role-add";
    }

    @RequestMapping("/listRole")
    public String list(Model model, Page page){
        PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询
        List<Role> rs= roleService.list();
        int total = (int) new PageInfo<>(rs).getTotal();//总条数
        page.setTotal(total);

        model.addAttribute("rs", rs);

        model.addAttribute("roleSize",total);

        Map<Role,List<Permission>> role_permissions = new HashMap<>();
         
        for (Role role : rs) {
            List<Permission> ps = permissionService.list(role);
            role_permissions.put(role, ps);
        }
        model.addAttribute("role_permissions", role_permissions);

        return "syspage/admin-role";
    }
后面还有 35 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。