package com.hao.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.hao.entity.Actor;
import com.hao.entity.Count;
import com.hao.entity.Middle;
import com.hao.entity.Teacher;
import com.hao.service.ActorService;
@Controller
public class ActorController {
@Autowired
private ActorService actorService;
@RequestMapping("login")//登录跳转页面
public ModelAndView login() {
ModelAndView mv = new ModelAndView();
mv.setViewName("actorlogin");
return mv;
}
@RequestMapping("actorLogin")//演员登录成功页面
public ModelAndView actorLogin(Actor actor,HttpSession session) {
System.out.println(actor);
ModelAndView mv = new ModelAndView();
Actor ac = actorService.actorLogin(actor);
System.out.println(ac);
if(ac!=null) {
List<Teacher> teacherList = actorService.findTeaList();
session.setAttribute("ac", ac);
mv.addObject("teacherList", teacherList);
mv.setViewName("actorPage");
}else {
session.setAttribute("error", "登陆失败,请重新登陆");
mv.setViewName("actorlogin");
}
return mv;
}
@RequestMapping("suppose")//审核页面
public ModelAndView suppose(Integer aid,Integer tid,HttpSession session,HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
System.out.println("aid"+aid+"tid"+tid);
List<Teacher> teacherList = actorService.findTeaList();
mv.addObject("teacherList", teacherList);
Middle middle = actorService.getMiddle(aid,tid);
if(middle!=null) {
int i = actorService.updateMiddle(aid,tid);
}else {
actorService.addMiddle(aid,tid);
}
System.out.println("状态号"+middle.getState());
if(middle.getState()==1) {
mv.addObject("state", "待审核(刚申请)");
}else if(middle.getState()==2) {
mv.addObject("state", "审核通过");
}else {
mv.addObject("state", "拒绝");
}
mv.setViewName("supposeState");
return mv;
}
@RequestMapping("toactorPage")
public ModelAndView toactorPage() {
ModelAndView mv = new ModelAndView();
mv.setViewName("actorPage");
return mv;
}
@RequestMapping("info")
public ModelAndView info() {//造型师信息方法
ModelAndView mv = new ModelAndView();
List<Count> couList = actorService.getCount();
mv.addObject("couList", couList);
mv.setViewName("info");
return mv;
}
}
package com.hao.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.hao.entity.Teacher;
import com.hao.entity.supState;
import com.hao.service.TeacherService;
@Controller
public class TeacherController {
@Autowired
private TeacherService teacherService;
@RequestMapping("login")//跳转登录页面代码
public ModelAndView login() {
ModelAndView mv = new ModelAndView();
mv.setViewName("teacherlogin");
return mv;
}
@RequestMapping("teacherLogin")//教师登录方法
public ModelAndView teacherLogin(Teacher teacher,HttpSession session) {
System.out.println(teacher);
ModelAndView mv = new ModelAndView();
Teacher te = teacherService.teacherLogin(teacher);
System.out.println(te);
if(te!=null) {
List<supState> teacherList = teacherService.findTeaList();
System.out.println(teacherList);
session.setAttribute("te", te);
mv.addObject("teacherList", teacherList);
mv.setViewName("teacherPage");
}else {
session.setAttribute("error", "登陆失败,请重新登陆");
mv.setViewName("teacherlogin");
}
return mv;
}
}
喜怒形于色是需要资本的。
《你好,旧时光》