源码获取:俺的博客首页 "资源" 里下载!
#### 环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
#### 技术栈
后端:SpringBoot+Mybaits
前端:Vue + elementui
#### 使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springbootrpj39/front/index.html
后台地址
http://localhost:8080/springbootrpj39/admin/dist/index.html
管理员 abo 密码 abo
用户:用户1 密码: 123456
注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。
学生管理控制层:
@Controller
@RequestMapping("/easStudent")
public class EasStudentController {
@Autowired
private EasStudentService easStudentService;
@RequestMapping("/index")
public String index() throws Exception{
return "system/student/index";
}
@RequestMapping("/list")
@ResponseBody
public Map<String, Object> list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasStudent easStudent) throws Exception{
Map<String, Object> map = new HashMap<>();
// System.out.println("我是:" + easStudent.getClass_id());
Page<EasStudent> pager = PageHelper.startPage(page,limit);
// List<EasStudent> list = easStudentService.getList(easStudent);
List<EasStudent> list = easStudentService.findList(easStudent);
// System.out.println("获取信息总条数为:" + list.size());
// for (EasStudent e:list
// ) {
// System.out.println(e.getUser().getUsername());
// System.out.println(e.getName());
// System.out.println(e.getClass_id());
// }
map.put("count",pager.getTotal());
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
}
教师管理控制层:
@Controller
@RequestMapping("/easTeacher")
public class EasTeacherController {
@Autowired
private EasTeacherService easTeacherService;
@RequestMapping("/index")
public String index() throws Exception{
return "system/teacher/index";
}
@RequestMapping("/list")
@ResponseBody
public Map<String, Object> list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasTeacher easTeacher) throws Exception{
Map<String, Object> map = new HashMap<>();
// 分页不能用待修改。。。
Page<EasTeacher> pager = PageHelper.startPage(page,limit);
// List<EasTeacher> list = easTeacherService.getList(easTeacher);
List<EasTeacher> list = easTeacherService.findTeacherList(easTeacher);
// System.out.println("获取信息总条数为:" + list.size());
// for (EasTeacher e:list
// ) {
// System.out.println(e.getUser().getUsername());
// System.out.println(e.getName());
// }
map.put("count",pager.getTotal());
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/search")
@ResponseBody
public List<EasTeacher> search() throws Exception{
return easTeacherService.getAll();
}
}
角色管理控制层:
@Controller
@RequestMapping("/easRole")
public class EasRoleController {
@Autowired
private EasRoleMapper easRoleMapper;
@RequestMapping("/search")
@ResponseBody
public List<EasRole> search() throws Exception{
return easRoleMapper.getAll();
}
@RequestMapping("/index")
@RequiresPermissions("role:query")
public String index() throws Exception{
return "system/role/index";
}
@RequestMapping("/rolePers")
@ResponseBody
public List<Long> rolePers(Integer id) throws Exception {
return easRoleMapper.getPerIdsByRoleId(id);
}
@RequestMapping("/assignPers")
@ResponseBody
public Map<String,Object> assignPers(Integer roleId, String persIds) throws Exception{
Map<String,Object> map = new HashMap<>();
easRoleMapper.deleteRolePermissions(roleId);
easRoleMapper.addRolePermissions(roleId,persIds.split(","));
return map;
}
@RequestMapping("/list")
@ResponseBody
public Map<String,Object> list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasRole easRole) throws Exception {
Map<String,Object> map = new HashMap<>();
int count = easRoleMapper.getCount();
PageUtil pageUtil = new PageUtil(page,limit);
map.put("code",0);
map.put("msg",null);
map.put("data",easRoleMapper.getList(easRole,pageUtil));
map.put("count",count);
return map;
}
@RequestMapping("/roleForm")
public String roleForm() throws Exception {
return "system/role/roleForm";
}
@RequestMapping(value = "/addRole",method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> addRole(EasRole easRole) throws Exception{
Map<String,Object> map = new HashMap<>();
// System.out.println("角色名称:"+easRole.getName());
// System.out.println("角色是否可用:"+easRole.getAvailable());
List<EasRole> list = easRoleMapper.findRoleName(easRole.getName());
if (list.size() != 0){
map.put("msg","角色已存在");
map.put("result",false);
}else if(easRole.getName().length() <= 0){
map.put("msg","角色名称不能为空");
map.put("result",false);
}else{
//课程为null也可以添加 待完善
easRoleMapper.addRole(easRole);
map.put("msg","添加成功");
map.put("result",true);
}
return map;
}
@RequestMapping("/batchDeleteRole")
@ResponseBody
@RequiresPermissions("role:delete")
public Map<String, Object> batchDeleteRole(Integer[] ids) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
easRoleMapper.batchDeleteRole(ids);
map.put("msg","删除成功");
map.put("result",true);
return map;
}
@RequestMapping(value = "/getRoleView")
@ResponseBody
public EasRole getRoleView(Integer id) throws Exception {
return easRoleMapper.getRoleView(id);
}
@RequestMapping(value = "/editRole",method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> editRole(EasRole easRole) throws Exception{
Map<String, Object> map = new HashMap<>();
easRoleMapper.updateBaseCourse(easRole);
map.put("result",true);
return map;
}
}
源码获取:俺的博客首页 "资源" 里下载!