源码获取:俺的博客首页 "资源" 里下载! 

项目介绍

基于Springboot Vue教师人事档案管理系统

角色:管理员/教师两种角色,分为前后台;

教师:教师通过教师登录页面可以填写用户名和密码等信息进行登录操作,教师登录成功后,可查看首页、培训信息、论坛信息、系统公告、个人中心、客服等模块,进行相对应操作

管理员:管理员登录成功后进入到系统操作界面,可以对个人中心、住户管理、社区公告管理、维修工管理、维修订单管理、接单信息管理、订单信息管理、在线沟通管理、举报信息管理、留言板管理、系统管理等功能模块进行相对应操作。


环境需要

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+Layui+HTML+CSS+JS


使用说明

项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4.运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springbootpc161/front/index.html
教师:教师1/123456
后台地址:http://localhost:8080/springbootpc161/admin/dist/index.html#/login
管理员:abo/abo
教师:教师1/123456

项目结构介绍:

首页展示: 

培训信息展示: 

培训信息展示: 

论坛信息展示: 

个人中心展示:

后台管理教师管理:

档案变动展示:

个人档案展示:

后台培训信息展示:

教师管理控制层: 

@Controller
@RequestMapping("/teacher")
public class TeacherController extends BaseController {
	
	
	/**
	 * 依赖注入 start dao/service/===
	 */
	@Autowired
	private TeacherService teacherService;
	
	// --------------------------------------- 华丽分割线 ------------------------------
	
	/**
	 * 分页查询 返回list对象(通过对By Sql)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findBySql")
	public String findBySql(Teacher teacher, Model model, HttpServletRequest request, HttpServletResponse response) {
		//分页查询
		String sql = "SELECT * FROM teacher WHERE isDelete = 0 ";
        if(!isEmpty(teacher.getUsername())){
        	sql += " and username like '%"+teacher.getUsername()+"%'";
		}
        if(!isEmpty(teacher.getSex())){
        	sql += " and sex like '%"+teacher.getSex()+"%'";
		}
        if(!isEmpty(teacher.getPassword())){
        	sql += " and password like '%"+teacher.getPassword()+"%'";
		}
        if(!isEmpty(teacher.getXw())){
        	sql += " and xw like '%"+teacher.getXw()+"%'";
		}
        if(!isEmpty(teacher.getPhone())){
        	sql += " and phone like '%"+teacher.getPhone()+"%'";
		}
        if(!isEmpty(teacher.getIsDelete())){
        	sql += " and isDelete like '%"+teacher.getIsDelete()+"%'";
		}
       sql += " ORDER BY ID DESC ";
		Pager<Teacher> pagers = teacherService.findBySqlRerturnEntity(sql);
		model.addAttribute("pagers", pagers);
		//存储查询条件
		model.addAttribute("obj", teacher);
		return "teacher/teacher";
	}
	
	
	/**
	 * 分页查询 返回list对象(通过Map)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findByMap")
	public String findByMap(Teacher teacher, Model model, HttpServletRequest request, HttpServletResponse response) {
		//通过map查询
		Map<String,Object> params = new HashMap<String,Object>();
        if(!isEmpty(teacher.getUsername())){
        	params.put("username", teacher.getUsername());
		}
        if(!isEmpty(teacher.getSex())){
        	params.put("sex", teacher.getSex());
		}
        if(!isEmpty(teacher.getPassword())){
        	params.put("password", teacher.getPassword());
		}
        if(!isEmpty(teacher.getXw())){
        	params.put("xw", teacher.getXw());
		}
        if(!isEmpty(teacher.getPhone())){
        	params.put("phone", teacher.getPhone());
		}
        if(!isEmpty(teacher.getIsDelete())){
        	params.put("isDelete", teacher.getIsDelete());
		}
		//分页查询
		Pager<Teacher> pagers = teacherService.findByMap(params);
		model.addAttribute("pagers", pagers);
		//存储查询条件
		model.addAttribute("obj", teacher);
		return "teacher/teacher";
	}
	
	/**********************************【增删改】******************************************************/
	
	/**
	 * 跳至添加页面
	 * @return
	 */
	@RequestMapping(value = "/add")
	public String add() {
		return "teacher/add";
	}

	/**
	 * 跳至详情页面
	 * @return
	 */
	@RequestMapping(value = "/view")
	public String view(Integer id,Model model) {
		Teacher obj = teacherService.load(id);
		model.addAttribute("obj",obj);
		return "teacher/view";
	}
	
	/**
	 * 添加执行
	 * @return
	 */
	@RequestMapping(value = "/exAdd")
	public String exAdd(Teacher teacher, Model model, HttpServletRequest request, HttpServletResponse response) {
		teacher.setIsDelete(0);
		teacher.setPassword("111111");
		teacherService.insert(teacher);
		return "redirect:/teacher/findBySql.action";
	}
	
	
	/**
	 * 跳至修改页面
	 * @return
	 */
	@RequestMapping(value = "/update")
	public String update(Integer id,Model model) {
		Teacher obj = teacherService.load(id);
		model.addAttribute("obj",obj);
		return "teacher/update";
	}
	
	/**
	 * 添加修改
	 * @return
	 */
	@RequestMapping(value = "/exUpdate")
	public String exUpdate(Teacher teacher, Model model, HttpServletRequest request, HttpServletResponse response) {
		teacherService.updateById(teacher);
		return "redirect:/teacher/findBySql.action";
	}
	
	/**
	 * 删除通过主键
	 * @return
	 */
	@RequestMapping(value = "/delete")
	public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
		Teacher load = teacherService.load(id);
		load.setIsDelete(1);
		teacherService.updateById(load);
		return "redirect:/teacher/findBySql.action";
	}
	
}

管理员管理控制层:

@Controller
@RequestMapping("/manage")
public class ManageController extends BaseController {
	
	
	/**
	 * 依赖注入 start dao/service/===
	 */
	@Autowired
	private ManageService manageService;
	
	// --------------------------------------- 华丽分割线 ------------------------------
	
	/*********************************查询列表【不分页】***********************************************/
	
	/**
	 * 【不分页 => 查询列表 => 无条件】
	* @Title: listAll 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @return 设定文件 
	* @author
	* @return String 返回类型 
	* @throws
	 */
	@RequestMapping(value = "/listAll")
	public String listAll(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response){
		List<Manage> listAll = manageService.listAll();
		model.addAttribute("list", listAll);
		return "manage/manage";
	}
	
	/**
	 *  【不分页=》查询列表=>有条件】
	* @Title: listByEntity 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @return 设定文件 
	* @author
	* @return String 返回类型 
	* @throws
	 */
	@RequestMapping(value = "/listByEntity")
	public String listByEntity(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response){
		List<Manage> listAll = manageService.listAllByEntity(manage);
		model.addAttribute("list", listAll);
		return "manage/manage";
	}
	
	/**
	 *  【不分页=》查询列表=>有条件】
	* @Title: listByMap 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @return 设定文件 
	* @author 
	* @return String 返回类型 
	* @throws
	 */
	@RequestMapping(value = "/listByMap")
	public String listByMap(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response){
		//通过map查询
		Map<String,Object> params = new HashMap<String,Object>();
	        if(!isEmpty(manage.getUserName())){
	        	params.put("userName", manage.getUserName());
			}
	        if(!isEmpty(manage.getPassWord())){
	        	params.put("passWord", manage.getPassWord());
			}
	        if(!isEmpty(manage.getRealName())){
	        	params.put("realName", manage.getRealName());
			}
	    List<Manage> listAll = manageService.listByMap(params);
		model.addAttribute("list", listAll);
		return "manage/manage";
	}
	
	
	/*********************************查询列表【分页】***********************************************/
	
	
	
	/**
	 * 分页查询 返回list对象(通过对象)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findByObj")
	public String findByObj(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
		//分页查询
		Pager<Manage> pagers = manageService.findByEntity(manage);
		model.addAttribute("pagers", pagers);
		//存储查询条件
		model.addAttribute("obj", manage);
		return "manage/manage";
	}
	
	/**
	 * 分页查询 返回list对象(通过对By Sql)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findBySql")
	public String findBySql(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
		//分页查询
		String sql = "SELECT * FROM manage WHERE 1=1 ";
        if(!isEmpty(manage.getUserName())){
        	sql += " and userName like '%"+manage.getUserName()+"%'";
		}
        if(!isEmpty(manage.getPassWord())){
        	sql += " and passWord like '%"+manage.getPassWord()+"%'";
		}
        if(!isEmpty(manage.getRealName())){
        	sql += " and realName like '%"+manage.getRealName()+"%'";
		}
       sql += " ORDER BY ID DESC ";
		Pager<Manage> pagers = manageService.findBySqlRerturnEntity(sql);
		model.addAttribute("pagers", pagers);
		//存储查询条件
		model.addAttribute("obj", manage);
		return "manage/manage";
	}
	
	
	/**
	 * 分页查询 返回list对象(通过Map)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findByMap")
	public String findByMap(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
		//通过map查询
		Map<String,Object> params = new HashMap<String,Object>();
        if(!isEmpty(manage.getUserName())){
        	params.put("userName", manage.getUserName());
		}
        if(!isEmpty(manage.getPassWord())){
        	params.put("passWord", manage.getPassWord());
		}
        if(!isEmpty(manage.getRealName())){
        	params.put("realName", manage.getRealName());
		}
		//分页查询
		Pager<Manage> pagers = manageService.findByMap(params);
		model.addAttribute("pagers", pagers);
		//存储查询条件
		model.addAttribute("obj", manage);
		return "manage/manage";
	}
	
	/**********************************【增删改】******************************************************/
	
	/**
	 * 跳至添加页面
	 * @return
	 */
	@RequestMapping(value = "/add")
	public String add() {
		return "manage/add";
	}

	/**
	 * 跳至详情页面
	 * @return
	 */
	@RequestMapping(value = "/view")
	public String view(Integer id,Model model) {
		Manage obj = manageService.load(id);
		model.addAttribute("obj",obj);
		return "manage/view";
	}
	
	/**
	 * 添加执行
	 * @return
	 */
	@RequestMapping(value = "/exAdd")
	public String exAdd(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
		manageService.insert(manage);
		return "redirect:/manage/findBySql.action";
	}
	
	
	/**
	 * 跳至修改页面
	 * @return
	 */
	@RequestMapping(value = "/update")
	public String update(Integer id,Model model) {
		Manage obj = manageService.load(id);
		model.addAttribute("obj",obj);
		return "manage/update";
	}
	
	/**
	 * 添加修改
	 * @return
	 */
	@RequestMapping(value = "/exUpdate")
	public String exUpdate(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
		//1.通过实体类修改,可以多传修改条件
		manageService.updateById(manage);
		//2.通过主键id修改
		//manageService.updateById(manage);
		return "redirect:/manage/findBySql.action";
	}
	
	/**
	 * 删除通过主键
	 * @return
	 */
	@RequestMapping(value = "/delete")
	public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
		///1.通过主键删除
		manageService.deleteById(id);
		/*以下是多种删除方式*/
//		//2.通过实体条件删除
//		manageService.deleteByEntity(manage);
//		//3.通过参数删除
//     //通过map查询
//		Map<String,Object> params = new HashMap<String,Object>();
//		
//        if(!isEmpty(manage.getUserName())){
//        	params.put("userName", manage.getUserName());
//		}
//       
//        if(!isEmpty(manage.getPassWord())){
//        	params.put("passWord", manage.getPassWord());
//		}
//       
//        if(!isEmpty(manage.getRealName())){
//        	params.put("realName", manage.getRealName());
//		}
//       
//		manageService.deleteByMap(params);
//		//4.状态删除
//		Manage load = manageService.getById(manage.getId())
//		load.setIsDelete(1);
//		manageService.update(load);
		//5.状态删除
		//Manage load = manageService.load(id);
		//load.setIsDelete(1);
		//manageService.update(load);
		return "redirect:/manage/findBySql.action";
	}
	
	// --------------------------------------- 华丽分割线 ------------------------------
	// --------------------------------------- 【下面是ajax操作的方法。】 ------------------------------

	/*********************************查询列表【不分页】***********************************************/
	
	/**
	 * 【不分页 => 查询列表 => 无条件】
	* @Title: listAll 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @return 设定文件 
	* @author
	* @return String 返回类型 
	* @throws
	 */
	@RequestMapping(value = "/listAllJson", method = RequestMethod.POST)
	@ResponseBody
	public String listAllJson(Manage manage, HttpServletRequest request, HttpServletResponse response){
		List<Manage> listAll = manageService.listAll();
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("list", listAll);
		jsonObject.put("obj", manage);
		return jsonObject.toString();
	}
	
	/**
	 *  【不分页=》查询列表=>有条件】
	* @Title: listByEntity 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @return 设定文件 
	* @author
	* @return String 返回类型 
	* @throws
	 */
	@RequestMapping(value = "/listByEntityJson", method = RequestMethod.POST)
	@ResponseBody
	public String listByEntityJson(Manage manage,  HttpServletRequest request, HttpServletResponse response){
		List<Manage> listAll = manageService.listAllByEntity(manage);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("list", listAll);
		jsonObject.put("obj", manage);
		return jsonObject.toString();
	}
	
	/**
	 *  【不分页=》查询列表=>有条件】
	* @Title: listByMap 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param @return 设定文件 
	* @author 
	* @return String 返回类型 
	* @throws
	 */
	@RequestMapping(value = "/listByMapJson", method = RequestMethod.POST)
	@ResponseBody
	public String listByMapJson(Manage manage,HttpServletRequest request, HttpServletResponse response){
		//通过map查询
		Map<String,Object> params = new HashMap<String,Object>();
	        if(!isEmpty(manage.getUserName())){
	        	params.put("userName", manage.getUserName());
			}
	        if(!isEmpty(manage.getPassWord())){
	        	params.put("passWord", manage.getPassWord());
			}
	        if(!isEmpty(manage.getRealName())){
	        	params.put("realName", manage.getRealName());
			}
	    List<Manage> listAll = manageService.listByMap(params);
	    JSONObject jsonObject = new JSONObject();
		jsonObject.put("list", listAll);
		jsonObject.put("obj", manage);
		return jsonObject.toString();
	}
	
	
	/**
	 * 分页查询 返回list json(通过对象)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findByObjJson", method = RequestMethod.POST)
	@ResponseBody
	public String findByObjByEntityJson(Manage manage, HttpServletRequest request, HttpServletResponse response) {
		//分页查询
		Pager<Manage> pagers = manageService.findByEntity(manage);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("pagers", pagers);
		jsonObject.put("obj", manage);
		return jsonObject.toString();
	}
	
	  
	/**
	 * 分页查询 返回list json(通过Map)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findByMapJson",  method = RequestMethod.POST)
	@ResponseBody
	public String findByMapJson(Manage manage,HttpServletRequest request, HttpServletResponse response) {
		//通过map查询
		Map<String,Object> params = new HashMap<String,Object>();
        if(!isEmpty(manage.getUserName())){
        	params.put("userName", manage.getUserName());
		}
        if(!isEmpty(manage.getPassWord())){
        	params.put("passWord", manage.getPassWord());
		}
        if(!isEmpty(manage.getRealName())){
        	params.put("realName", manage.getRealName());
		}
		//分页查询
		Pager<Manage> pagers = manageService.findByMap(params);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("pagers", pagers);
		jsonObject.put("obj", manage);
		return jsonObject.toString();
	}
	
	
	/**
	 * ajax 添加
	 * @param 
	 * @return
	 */
	@RequestMapping(value = "/exAddJson", method = RequestMethod.POST)
	@ResponseBody
	public String exAddJson(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
		manageService.insert(manage);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("message", "添加成功");
		return jsonObject.toString();
	}
	

	/**
	 * ajax 修改
	 * @param 
	 * @return
	 */
	@RequestMapping(value = "/exUpdate.json", method = RequestMethod.POST)
	@ResponseBody
	public String exUpdateJson(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
		//1.通过实体类修改,可以多传修改条件
		manageService.updateById(manage);
		//2.通过主键id修改
		//manageService.updateById(manage);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("message", "修改成功");
		return jsonObject.toString();
	}

	/**
	 * ajax 删除
	 * @return
	 */
	@RequestMapping(value = "/delete.json", method = RequestMethod.POST)
	@ResponseBody
	public String exDeleteJson(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
		///1.通过主键删除
		manageService.deleteById(id);
		/*以下是多种删除方式*/
//		//2.通过实体条件删除
//		manageService.deleteByEntity(manage);
//		//3.通过参数删除
//        //通过map查询
//		Map<String,Object> params = new HashMap<String,Object>();
//		
//        if(!isEmpty(manage.getUserName())){
//        	params.put("userName", manage.getUserName());
//		}
//       
//        if(!isEmpty(manage.getPassWord())){
//        	params.put("passWord", manage.getPassWord());
//		}
//       
//        if(!isEmpty(manage.getRealName())){
//        	params.put("realName", manage.getRealName());
//		}
//       
//		manageService.deleteByMap(params);
//		//4.状态删除
//		Manage load = manageService.getById(manage.getId())
//		load.setIsDelete(1);
//		manageService.updateById(load);
		//5.状态删除
		//Manage load = manageService.load(id);
		//load.setIsDelete(1);
		//manageService.updateById(load);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("message", "删除成功");
		return jsonObject.toString();
	}
	/**
	 * 单文件上传
	 * @param file
	 * @param request
	 * @param model
	 * @return
	 */
    @RequestMapping(value = "/saveFile")  
    public String saveFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, Model model) {  
  
        System.out.println("开始");  
        String path = request.getSession().getServletContext().getRealPath("/upload");  
        String fileName = file.getOriginalFilename();  
        System.out.println(path);  
        File targetFile = new File(path, fileName);  
        if(!targetFile.exists()){  
            targetFile.mkdirs();  
        }  
        //保存  
        try {  
            file.transferTo(targetFile);  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
  
        return "";  
    }  
	
	
	/**
	 * springMvc多文件上传
	 * @param files
	 * @param id
	 * @return
	 */
    @RequestMapping(value = "/saveFiles")
    public String saveFiles(@RequestParam("file") CommonsMultipartFile[] files,Integer id,HttpServletRequest request){
		for(int i = 0;i<files.length;i++){
	      	System.out.println("fileName---------->" + files[i].getOriginalFilename());
		  if(!files[i].isEmpty()){
            int pre = (int) System.currentTimeMillis();
	     	try {
			//拿到输出流,同时重命名上传的文件
			 String filePath = request.getRealPath("/upload");
			 File f=new File(filePath);
			 if(!f.exists()){
				f.mkdirs();
			 }
		     String fileNmae=new Date().getTime() + files[i].getOriginalFilename();
		     File file=new File(filePath+"/"+pre + files[i].getOriginalFilename());
			  if(!file.exists()){
				  file.createNewFile();
			 }
			  files[i].transferTo(file);
		     } catch (Exception e) {
				e.printStackTrace();
				System.out.println("上传出错");
			 }
		  }
		}
	  return "";
	}
 // --------------------------------------- 华丽分割线 ------------------------------
	
	
}

登录管理控制层: 

@Controller
@RequestMapping("/login")
public class LoginController  extends BaseController{
	
	@Autowired
	private ManageService manageService;
	
	@Autowired
	private TeacherService teacherService;
	
	/**
	 * 跳转登陆
	 * @return
	 */
	@RequestMapping("/login")
	public String login(){
		return "login/mLogin";
	}
	
	
	@RequestMapping("/mtuichu")
	public String mtuichu(HttpServletRequest request){
		//request.getSession().invalidate();
		return "login/mLogin";
	}
	@RequestMapping("/welcome")
	private String welcome(){
		return "login/welcome";
	}
	
	@RequestMapping("/toLogin")
	public String toLogin(Manage manage, Integer type,HttpServletRequest request, HttpServletResponse response){
		
		if (type == null){
			return "redirect:/login/mtuichu";	
		}
		
		if (type == 1){
			Manage byEntity = manageService.getByEntity(manage);
			if(byEntity == null){
				return "redirect:/login/mtuichu";	
			}else{
				request.getSession().setAttribute("role", 1);
				request.getSession().setAttribute("username", byEntity.getUserName());
				request.getSession().setAttribute("userId", byEntity.getId());
			}
		}
		if (type == 2){
			Teacher t = new Teacher();
			t.setPassword(manage.getPassWord());
			t.setUsername(manage.getUserName());
			t.setIsDelete(0);
			Teacher byEntity = teacherService.getByEntity(t);
			if(byEntity == null){
				return "redirect:/login/mtuichu";	
			}else{
				request.getSession().setAttribute("role", 2);
				request.getSession().setAttribute("username", byEntity.getUsername());
				request.getSession().setAttribute("userId", byEntity.getId());
			}
		}
		
		
		return "login/mIndex";
	}
	
	/**
	 * 退出
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/tuichu")
	public String tuichu( HttpServletRequest request, HttpServletResponse response){
		HttpSession session = request.getSession();
		session.invalidate();
		return "login/login";
	}

	@RequestMapping("/head")
	private String head(){
		return "inc/head";
	}
	
	@RequestMapping("/left")
	private String left(){
		return "inc/left";
	}
	
	
	@RequestMapping(value = "/update")
	public String update(Integer id,Model model,HttpServletRequest request) {
		
		Object attribute = request.getSession().getAttribute("userId");
		
		if (attribute == null){
			return "redirect:/login/mtuichu";	
		}
		
		Integer userId = Integer.valueOf(attribute.toString());
		Teacher byId = teacherService.getById(userId);
		model.addAttribute("obj",byId);
		return "login/update";
	}
	

	@RequestMapping(value = "/toUpdate")
	public String toUpdate(Integer id,String phone,Model model,HttpServletRequest request) {
		
		Object attribute = request.getSession().getAttribute("userId");
		
		if (attribute == null){
			return "redirect:/login/mtuichu";	
		}
		
		Integer userId = Integer.valueOf(attribute.toString());
		Teacher byId = teacherService.getById(userId);
		byId.setPhone(phone);
		teacherService.updateById(byId);
		model.addAttribute("obj",byId);
		return "login/update";
	}
	
	@RequestMapping(value = "/pass")
	public String pass(Integer id,Model model,HttpServletRequest request) {
		
		Object attribute = request.getSession().getAttribute("userId");
		
		if (attribute == null){
			return "redirect:/login/mtuichu";	
		}
		
		Integer userId = Integer.valueOf(attribute.toString());
		Teacher byId = teacherService.getById(userId);
		model.addAttribute("obj",byId);
		return "login/pass";
	}
	
	@RequestMapping("/upass")
	@ResponseBody
	public String upass(HttpServletRequest request,String password){
      Object attribute = request.getSession().getAttribute("userId");
      JSONObject j = new  JSONObject();
	   	if (attribute == null){
	   		j.put("res", 0);
	   		return j.toString();
		}
			Integer userId = Integer.valueOf(attribute.toString());
			Teacher byId = teacherService.getById(userId);
			byId.setPassword(password);
			teacherService.updateById(byId);
			j.put("res", 1);
			return j.toString();
			
	}
	
}

源码获取:俺的博客首页 "资源" 里下载!

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐