创建controler类-SysRoleController
package com.yun.oa.controller;
import com.yun.model.model.system.SysRole;
import com.yun.oa.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/*
* @paragram: myyunshangbangong
* @description:
* @author:
* @create: 2024-01-11
*/
@RestController
@RequestMapping("/admin/system/sysRole")
public class SysRoleController {
// 注入service
@Autowired
private SysRoleService sysRoleService;
// 查询所有角色
@GetMapping("/findAll")
public List<SysRole> findAll(){
List<SysRole> sysRoles = sysRoleService.list();
return sysRoles;
}
}
启动类启动项目,显示8080,启动成功
访问:http:locaihost:8080/admin/system/sysRole/findAll