✨作者主页:IT研究室✨
个人简介:曾从事计算机专业培训教学,擅长Java、Python、微信小程序、Golang、安卓Android等。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。
☑文末获取源码☑
精彩专栏推荐⬇⬇⬇
Java项目
Python项目
安卓项目
微信小程序项目
// 添加员工信息
@RequestMapping("/employee/addEmployee")
public String addEmployee(Integer flag, Integer jid, HttpSession session, TbEmployee employee,
HttpServletResponse resonse) {
if (flag == 1) {
List deptList = employeeService.selectDept();
List jobList = employeeService.selectJob();
session.setAttribute("deptList", deptList);
session.setAttribute("jobList", jobList);
return "employee/showAddEmployee";
} else {
// 添加
Date date = new Date();
employee.setCreatedate(date);
if (employeeService.addEmployee(employee)) {
try {
resonse.getWriter().print("success");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
try {
resonse.getWriter().print("error");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return null;
}
// 删除
// /employee/removeEmployee
@RequestMapping("/employee/removeEmployee")
public String deleteEmployee(Integer flag, Integer id,
@RequestParam(required = false, value = "ids[]") Integer[] ids, HttpServletResponse response) {
boolean result = false;
if (flag == 1) {
System.out.println("AAAA");
if (employeeService.deleteById(id)) {
return "employee/employee";
}
} else {
result = employeeService.deleteBybatch(ids);
}
if (result) {
try {
response.getWriter().print("success");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
try {
response.getWriter().print("error");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
}
大家可以帮忙点赞、收藏、关注、评论啦~
源码获取:私信我