源码获取:俺的博客首页 "资源" 里下载!
环境需要
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("/User")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private PowerService powerService;
@Autowired
private RoleService roleService;
@Autowired
private NoticeService noticeService;
@RequestMapping("/Main")
public String res(HttpServletRequest request){
String time = DateUtil.getStringToday();
request.getSession().setAttribute("time", time);
Notice notice = new Notice();
List<Notice> list = noticeService.queryAll(notice);
notice = list.get(0);
User user = userService.selectByPrimaryKey(notice.getUserid());
notice.setUserid(user.getName());
request.getSession().setAttribute("notice", notice);
return "Main";
}
@RequestMapping("/changePa")
public String res1(){
return "changePass";
}
@RequestMapping("/Login")
public ModelAndView login(HttpServletRequest request,String id,String password) throws Exception{
ModelAndView mav = new ModelAndView();
User user1 = userService.selectByPrimaryKey(id);
if(user1 == null || !password.equals(user1.getPassword())){
mav.setViewName("index");
request.getSession().setAttribute("info", "error");
return mav;
}else{
Role role = new Role();
role.setRoleid(user1.getRoleid());
List<Role> list =roleService.QueryAll(role);
role =list.get(0);
request.getSession().setAttribute("roleName", role.getRolename());
Power power = powerService.selectByPrimaryKey(role.getPowerid());
if(!StringUtil.isNullOrEmpty(power.getPower())){
request.getSession().setAttribute("power", power.getPower());
}
String time = DateUtil.getStringToday();
request.getSession().setAttribute("time", time);
request.getSession().setAttribute("user", user1);
mav.setViewName("redirect:/User/Main");
}
return mav;
}
@RequestMapping("/updateStudent")
public String update(User user){
userService.updateByPrimaryKey(user);
return "redirect:

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



