package com.lian.demo.controller; import com.lian.demo.pojo.staff; import com.lian.demo.pojo.user; import com.lian.demo.service.StaffService; import org.mybatis.spring.annotation.MapperScan; 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 org.springframework.web.servlet.ModelAndView; import javax.servlet.ServletResponse; import javax.servlet.http.HttpSession; import java.util.List; @Controller public class mainController { @Autowired private StaffService staffService; @RequestMapping(value = "/logout") public String logout(HttpSession session){ session.invalidate(); return "login"; } @RequestMapping(value = "/tozhuce") public String tozhuce(){ return "sign-up"; } @RequestMapping(value ="/toDoctor-Patient" ) public String toDoctorPatient(){ return "toDoctor-patient"; } @RequestMapping(value = "/toAdd") public String toAdd(){ return "add-doctor"; } @RequestMapping(value = "/baoxiu") public String baoxiu(){ return "add-baoxiu"; } @RequestMapping("/queryStaff") public ModelAndView queryStaff(){ List<staff> patientList= staffService.AlistPatient(); ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject("patient",patientList); modelAndView.setViewName("patientsList"); return modelAndView; } @RequestMapping(value = "/userLogin") public String userLogin(String username, String password, Model model, HttpSession session){ user user= staffService.login(username,password); String role = user.getRole(); if (user!=null&&role.equals("用户")){ session.setAttribute("user",user); return "index1"; }if (user!=null&&role.equals("管理员")){ session.setAttribute("user",user); return "index"; } else{ model.addAttribute("msg","用户名或密码错误"); return "login"; } } //注册 @RequestMapping(value = "/sign") public String sign(user user){ staffService.save(user); return "login"; } @RequestMapping("/showlogin") public String showlogin(){ return "login"; } @RequestMapping(value = "/index") public String index(){ return "index"; } }
最近下载更多
Luck_ZDM LV11
4月12日
together love LV2
3月26日
wsl566666 LV2
2月20日
3311545828 LV3
1月19日
南波万 LV1
1月17日
YhXyHx523 LV6
2023年12月24日
wuge123 LV8
2023年12月21日
gecongkai LV8
2023年12月21日
yuanshun LV6
2023年12月17日
故里逢春 LV2
2023年12月15日
最近浏览更多
whb5566 LV10
前天
一个小学码 LV4
4月16日
Luck_ZDM LV11
4月12日
阿昌先生 LV13
3月27日
together love LV2
3月24日
15103432984 LV2
3月16日
entity123456
3月15日
暂无贡献等级
西瓜哥哥 LV4
3月5日
escape1023
3月4日
暂无贡献等级
lyhlyh LV10
2月20日