package com.direct.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.direct.entity.EmployeeInfoEntity;
import com.direct.entity.TransferInfo;
import com.direct.service.IEmployeeInfoService;
import com.google.gson.Gson;
@Controller
@RequestMapping(value="/EMPC")
public class EmployeeInfoController {
@Autowired
@Qualifier("EmpService")
private IEmployeeInfoService iemp;
//时间转换
@InitBinder()
public void binder(WebDataBinder binder){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
CustomDateEditor cde=new CustomDateEditor(sdf, true);
binder.registerCustomEditor(Date.class,cde);
}
//退出系统
@RequestMapping("/exit.do")
private void exit(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//创建作用域对象
HttpSession session = request.getSession();
//清除作用域对象
session.invalidate();
//清除完成跳转到登陆页面
request.getRequestDispatcher("../admin/index/login.jsp").forward(request, response);
}
//调岗之前获取员工旧岗位的信息
@RequestMapping("/selectTg.do")
public ModelAndView sleectTg(HttpServletRequest req,HttpServletResponse res){
ModelAndView mav=new ModelAndView();
int ids=Integer.parseInt(req.getParameter("ids"));
EmployeeInfoEntity emp=iemp.selectTg(ids);
System.out.println("111111\t"+emp.getEmpName()+"\t"+emp.getPos().getPname()+"\t"+emp.getPos().getDept().getDeptName());
mav.setViewName("EmployeeInfo_tg");//跳转到指定页面
mav.addObject("em", emp); //为跳转的指定页面存值
return mav;
}
//员工调岗添加记录表
@RequestMapping("/tg.do")
public void tg(HttpServletRequest req,HttpServletResponse res ,TransferInfo tra) throws IOException{
Logger.getLogger(EmployeeInfoController.class).debug("进入Conmtroller");
System.out.println("编号:"+tra.getEmp().getEmpId()+"\t姓名:"+tra.getEmp().getEmpName()+"\t时间:"+tra.getExpendTime()+"\t备注:"+tra.getRemark()+"\t旧职位\t"+tra.getJformer()+"\t旧部门:"+tra.getJdep()+"\t新职位:"+tra.getFormer().getPid());
Logger.getLogger(EmployeeInfoController.class).debug("进入Controller");
int i=iemp.updateTg(tra);
res.getWriter().print(i);
}
//分页查询调岗记录表
@RequestMapping("selectTgjl.do")
public void selectTgjl(HttpServletRequest req,HttpServletResponse res) throws IOException{
Logger.getLogger(EmployeeInfoController.class).debug("进入Conmtroller");
res.setCharacterEncoding("utf-8");
Logger.getLogger(EmployeeInfoController.class).debug("进入Conmtroller");
//获取当前页
int curr=req.getParameter("page")==null?1:Integer.parseInt(req.getParameter("page"));
//获取显示条数、
int size=req.getParameter("limit")==null?3:Integer.parseInt(req.getParameter("limit"));
//获取模糊查询参数
String key=req.getParameter("key")==null?"":req.getParameter("key");
EmployeeInfoEntity emp=new EmployeeInfoEntity();
emp.setEmpName(key);
TransferInfo tra =new TransferInfo();
tra.setEmp(emp);
System.out.println(emp+"\t11111111111111111111111111");
String jsonEmp=iemp.selectTgjl(tra, curr, size);
System.out.println(jsonEmp);
res.getWriter().print(jsonEmp);
}
//员工离职
@RequestMapping("lz.do")
public void lz(HttpServletRequest req,HttpServletResponse res) throws IOException{
Logger.getLogger(EmployeeInfoController.class).debug("进入Controller");
String ids= req.getParameter("ids");
int idsStr=iemp.updateLz(ids);
res.getWriter().print(idsStr);
}
//修改员工
@RequestMapping("/update.do")
public void updateEmp(HttpServletRequest req,HttpServletResponse res,EmployeeInfoEntity emp) throws IOException{
res.setCharacterEncoding("utf-8");
Logger.getLogger(EmployeeInfoController.class).debug("进入Controller");
int i=iemp.updateEmp(emp);
res.getWriter().print(i);
}
//添加员工
@RequestMapping("/add.do")
public void add(HttpServletRequest req,HttpServletResponse res,EmployeeInfoEntity emp) throws IOException{
Logger.getLogger(EmployeeInfoController.class).debug("进入Conmtroller");
int i=iemp.insertEmp(emp);
res.getWriter().print(i);
}
//分页查询
@RequestMapping("/select.do")
public void select(EmployeeInfoEntity emp,HttpServletRequest req, HttpServletResponse res) throws IOException{
res.setCharacterEncoding("utf-8");
Logger.getLogger(EmployeeInfoController.class).debug("进入Conmtrollerselect.do");
//获取当前页
int curr=req.getParameter("page")==null?1:Integer.parseInt(req.getParameter("page"));
//获取显示条数、
int size=req.getParameter("limit")==null?3:Integer.parseInt(req.getParameter("limit"));
//获取模糊查询参数
String key=req.getParameter("key")==null?"":req.getParameter("key");
EmployeeInfoEntity emp1=new EmployeeInfoEntity();
emp1.setEmpName(key);
String jsonEmp=iemp.selEmp(emp1, curr, size);
res.getWriter().print(jsonEmp);
}
//删除员工
@RequestMapping("delete.do")
public void delete(HttpServletRequest req, HttpServletResponse res) throws IOException{
Logger.getLogger(EmployeeInfoController.class).debug("进入Conmtroller");
int empId=Integer.parseInt(req.getParameter("empId"));
int i=iemp.deleteEmp(empId);
res.getWriter().print(i);
}
//查询所有数据
@RequestMapping("/selectById.do")
public void selectById(HttpServletRequest req,HttpServletResponse res) throws IOException{
res.setCharacterEncoding("utf-8");
Logger.getLogger(DepartmentInfoController.class).debug("进入controller ");
List<EmployeeInfoEntity> dlist=iemp.selectEmpById();
Gson g=new Gson();
String jsonEmp=g.toJson(dlist);
System.out.println(jsonEmp);
res.getWriter().print(jsonEmp);
}
//员工登陆
@RequestMapping("/login.do")
public void login(EmployeeInfoEntity ee,HttpServletRequest request, HttpServletResponse response) throws IOException{
//创建作用域对象
HttpSession session = request.getSession();
//调用登录查询方法
EmployeeInfoEntity emp=iemp.login(ee);
System.out.println(emp.getEmpName());
//判断emp是否为空
if(emp!=null)
{
//将管理员实体存入作用域
session.setAttribute("emp", emp);
response.getWriter().print("true");//返回成功信息
}
else
{
response.getWriter().print("false");//返回失败信息
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 1、该资源包括项目的全部源码,下载可以直接使用! 2、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 3、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 基于maven+SSM框架实现的云端汽修后台管理系统源码(毕设项目).zip # 4SShop-SSM 这是maven项目,使用SSM框架做的。这是云端汽修后台管理系统<br/> 开发工具:eclipse<br/> jdk版本:1.7
资源推荐
资源详情
资源评论
收起资源包目录
基于maven+SSM框架实现的云端汽修后台管理系统源码(毕设项目).zip (1526个子文件)
all-wcprops 9KB
all-wcprops 5KB
all-wcprops 5KB
all-wcprops 4KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 3KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 1KB
all-wcprops 772B
all-wcprops 762B
all-wcprops 737B
all-wcprops 733B
all-wcprops 730B
all-wcprops 698B
all-wcprops 640B
all-wcprops 619B
all-wcprops 571B
all-wcprops 570B
all-wcprops 492B
all-wcprops 479B
all-wcprops 476B
all-wcprops 391B
all-wcprops 374B
all-wcprops 372B
all-wcprops 372B
all-wcprops 369B
all-wcprops 355B
all-wcprops 347B
all-wcprops 293B
all-wcprops 289B
all-wcprops 283B
all-wcprops 260B
all-wcprops 256B
all-wcprops 244B
all-wcprops 236B
all-wcprops 234B
all-wcprops 232B
all-wcprops 222B
all-wcprops 129B
all-wcprops 121B
all-wcprops 119B
all-wcprops 118B
all-wcprops 108B
all-wcprops 107B
all-wcprops 105B
all-wcprops 105B
all-wcprops 104B
all-wcprops 101B
all-wcprops 98B
all-wcprops 97B
all-wcprops 94B
all-wcprops 93B
all-wcprops 93B
all-wcprops 88B
all-wcprops 88B
all-wcprops 86B
all-wcprops 83B
.classpath 2KB
org.eclipse.wst.common.component 737B
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 158KB
bootstrap.min.css 150KB
layui.css 71KB
admin.css 36KB
font-awesome.min.css 30KB
settings.css 29KB
layer.css 14KB
step.css 11KB
layui.mobile.css 10KB
laydate.css 7KB
demo.css 6KB
magnific-popup.css 5KB
nice-select.css 3KB
slick-theme.css 3KB
ion.rangeSlider.css 2KB
fonts.css 2KB
slick.css 2KB
login.css 2KB
iconfont.css 1KB
ion.rangeSlider.skinFlat.css 1KB
code.css 1KB
entries 11KB
entries 6KB
entries 5KB
共 1526 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
土豆片片
- 粉丝: 1722
- 资源: 5642
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功