基于javaweb+mysql的ssm固定资产管理系统(java+ssm+jsp+jquery+bootstrap+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM固定资产管理系统(java+ssm+jsp+jquery+bootstrap+mysql)
项目介绍
该固定资产管理系统共包含三种角色,分别是:管理员、普通员工、部门管理人员,其功能如下: 1.管理员 系统登陆、管理员管理、部门管理、资产类型管理、员工信息管 理、采购申请管理、资产采购管理、资产发放管理、固定资产管 理、设备维修管理、资产报废管理、设备借用归还管理、 盘点信息 管理、盘盈信息统计、盘亏信息统计等功能。 2.普通员工 个人信息管理、修改密码、资产类型信息、采购申请信息、资产 接收信息、固定资产信息、设备借用归还信息、盘点信息等功能。 3.部门管理人员 工作人员管理、基础信息管理、采购申请管理、资产发放管理、 固定资产管理、设备借用归还管理、盘点管理等功能。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具 有很高的实际应用价值。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目; 6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后台框架:Spring、SpringMVC、Mbytes UI界面:JSP、jQuery 、BootStrap 数据库:MySQL
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
}
if ("reason".equals(cond)) {
pwin.setReason(name);
}
if ("employid".equals(cond)) {
pwin.setEmployid(name);
}
if ("addtime".equals(cond)) {
pwin.setAddtime(name);
}
if ("memo".equals(cond)) {
pwin.setMemo(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.pwinService.getPwinByLike(pwin), "pwin", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/querypwin";
}
// 按主键查询数据
@RequestMapping("getPwinById.action")
public String getPwinById(String id) {
Pwin pwin = this.pwinService.getPwinById(id);
this.getRequest().setAttribute("pwin", pwin);
List<Dept> deptList = this.deptService.getAllDept();
this.getRequest().setAttribute("deptList", deptList);
List<Equipment> equipmentList = this.equipmentService.getAllEquipment();
this.getRequest().setAttribute("equipmentList", equipmentList);
List<Employ> employList = this.employService.getAllEmploy();
this.getRequest().setAttribute("employList", employList);
return "admin/editpwin";
}
}
employ.setDeptid(applyx.getDeptid());
List<Employ> employList = this.employService.getEmployByCond(employ);
this.getRequest().setAttribute("employList", employList);
return "admin/addsend";
}
// 添加数据
@RequestMapping("addSend.action")
public String addSend(Send send) {
String buyid = this.getRequest().getParameter("buyid");
Buy buy = this.buyService.getBuyById(buyid);
Applyx applyx = this.applyxService.getApplyxById(buy.getApplyxid());
applyx.setStatus("已发放");
this.applyxService.updateApplyx(applyx);
send.setApplyxid(applyx.getApplyxid());
send.setDeptid(applyx.getDeptid());
send.setEquipmentname(buy.getEquipmentname());
send.setAddtime(VeDate.getStringDateShort());
this.sendService.insertSend(send);
for (int i = 0; i < Integer.parseInt(send.getNum()); i++) {
Equipment x = new Equipment();
x.setAddtime(VeDate.getStringDateShort());
x.setApplyxid(applyx.getApplyxid());
x.setCateid(applyx.getCateid());
x.setDeptid(applyx.getDeptid());
x.setEno("E" + VeDate.getStringDatex() + i);
x.setEquipmentid("E" + VeDate.getStringDatex() + i);
x.setMemo("");
x.setStatus("正常");
x.setEquipmentname(buy.getEquipmentname() + (i + 1));
this.equipmentService.insertEquipment(x);
}
buy.setSendnum(send.getNum());
this.buyService.updateBuy(buy);
return "redirect:/buy/getAllBuy.action";
}
// 通过主键删除数据
@RequestMapping("deleteSend.action")
public String deleteSend(String id) {
return "admin/addscarp";
}
// 添加数据
@RequestMapping("addScarp.action")
public String addScarp(Scarp scarp) {
String deptid = (String) this.getSession().getAttribute("deptid");
String adminid = (String) this.getSession().getAttribute("adminid");
scarp.setDeptid(deptid);
scarp.setEmployid(adminid);
scarp.setAddtime(VeDate.getStringDateShort());
this.scarpService.insertScarp(scarp);
Equipment x = this.equipmentService.getEquipmentById(scarp.getEquipmentid());
x.setStatus("报废");
this.equipmentService.updateEquipment(x);
return "redirect:/scarp/createScarp.action";
}
// 通过主键删除数据
@RequestMapping("deleteScarp.action")
public String deleteScarp(String id) {
this.scarpService.deleteScarp(id);
return "redirect:/scarp/getAllScarp.action";
}
// 批量删除数据
@RequestMapping("deleteScarpByIds.action")
public String deleteScarpByIds() {
String[] ids = this.getRequest().getParameterValues("scarpid");
if (ids != null) {
for (String scarpid : ids) {
this.scarpService.deleteScarp(scarpid);
}
}
return "redirect:/scarp/getAllScarp.action";
}
// 更新数据
@RequestMapping("updateScarp.action")
public String updateScarp(Scarp scarp) {
this.scarpService.updateScarp(scarp);
return "redirect:/scarp/getAllScarp.action";
}
int maxPage = pageNumber;
if (maxPage % pageSize == 0) {
maxPage = maxPage / pageSize;
} else {
maxPage = maxPage / pageSize + 1;
}
if (number == null) {
number = "0";
}
int start = Integer.parseInt(number) * pageSize;
int over = (Integer.parseInt(number) + 1) * pageSize;
int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; i++) {
Object obj = list.get(i);
objList.add(obj);
}
buffer.append(" 共为");
buffer.append(maxPage);
buffer.append("页 共有");
buffer.append(pageNumber);
buffer.append("条 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"index/" + action + "?number=0" + path + "\">首页</a>");
}
buffer.append(" ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"index/" + action + "?number=" + (Integer.parseInt(number) - 1) + "" + path + "\">上一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("下一页");
} else {
buffer.append("<a href=\"index/" + action + "?number=" + (Integer.parseInt(number) + 1) + "" + path + "\">下一页</a>");
if (ids != null) {
for (String pwinid : ids) {
this.pwinService.deletePwin(pwinid);
}
}
return "redirect:/pwin/getAllPwin.action";
}
// 更新数据
@RequestMapping("updatePwin.action")
public String updatePwin(Pwin pwin) {
this.pwinService.updatePwin(pwin);
return "redirect:/pwin/getAllPwin.action";
}
// 显示全部数据
@RequestMapping("getAllPwin.action")
public String getAllPwin(String number) {
List<Pwin> pwinList = this.pwinService.getAllPwin();
PageHelper.getPage(pwinList, "pwin", null, null, 10, number, this.getRequest(), null);
return "admin/listpwin";
}
@RequestMapping("getDeptPwin.action")
public String getDeptPwin(String number) {
String deptid = (String) this.getSession().getAttribute("deptid");
Pwin pwin = new Pwin();
pwin.setDeptid(deptid);
List<Pwin> pwinList = this.pwinService.getPwinByCond(pwin);
PageHelper.getUserPage(pwinList, "pwin", "getDeptPwin", 10, number, this.getRequest());
return "admin/xlistpwin";
}
@RequestMapping("getMyPwin.action")
public String getMyPwin(String number) {
String adminid = (String) this.getSession().getAttribute("adminid");
Pwin pwin = new Pwin();
pwin.setEmployid(adminid);
List<Pwin> pwinList = this.pwinService.getPwinByCond(pwin);
PageHelper.getUserPage(pwinList, "pwin", "getMyPwin", 10, number, this.getRequest());
return "admin/ylistpwin";
}
}
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/chart", produces = "text/plain;charset=utf-8")
public class ChartController extends BaseController {
@Autowired
private PwinService pwinService;
@Autowired
private PlostService plostService;
@RequestMapping("getWin.action")
@ResponseBody
public String getWin() {
String start = this.getRequest().getParameter("start");
String end = this.getRequest().getParameter("end");
long days = VeDate.getDays(end, start);
JSONArray day = new JSONArray();// 定义day存放数值
JSONArray total = new JSONArray();// 定义total存放数值
for (int i = 0; i < days; i++) {
String nxtDay = VeDate.getNextDay(end, "-" + i);
Pwin pwin = new Pwin();
pwin.setAddtime(nxtDay);
List<Pwin> winList = this.pwinService.getPwinByCond(pwin);
total.add(winList.size());
day.add(nxtDay);
}
JSONObject json = new JSONObject();
json.put("total", total.toString());
json.put("days", day.toString().replaceAll("\"", ""));
System.out.println(json.toString());
return json.toString();
}
@RequestMapping("createCate.action")
public String createCate() {
return "admin/addcate";
}
// 添加数据
@RequestMapping("addCate.action")
public String addCate(Cate cate) {
cate.setAddtime(VeDate.getStringDateShort());
this.cateService.insertCate(cate);
return "redirect:/cate/createCate.action";
}
// 通过主键删除数据
@RequestMapping("deleteCate.action")
public String deleteCate(String id) {
this.cateService.deleteCate(id);
return "redirect:/cate/getAllCate.action";
}
// 批量删除数据
@RequestMapping("deleteCateByIds.action")
public String deleteCateByIds() {
String[] ids = this.getRequest().getParameterValues("cateid");
if (ids != null) {
for (String cateid : ids) {
this.cateService.deleteCate(cateid);
}
}
return "redirect:/cate/getAllCate.action";
}
// 更新数据
@RequestMapping("updateCate.action")
public String updateCate(Cate cate) {
this.cateService.updateCate(cate);
return "redirect:/cate/getAllCate.action";
}
// 显示全部数据
@RequestMapping("getAllCate.action")
public String getAllCate(String number) {
private EquipmentService equipmentService;
@Autowired
private EmployService employService;
// 准备添加数据
@RequestMapping("createPwin.action")
public String createPwin() {
List<Dept> deptList = this.deptService.getAllDept();
this.getRequest().setAttribute("deptList", deptList);
List<Equipment> equipmentList = this.equipmentService.getAllEquipment();
this.getRequest().setAttribute("equipmentList", equipmentList);
List<Employ> employList = this.employService.getAllEmploy();
this.getRequest().setAttribute("employList", employList);
this.getRequest().setAttribute("wno", "P" + VeDate.getStringDatex());
return "admin/addpwin";
}
// 添加数据
@RequestMapping("addPwin.action")
public String addPwin(Pwin pwin) {
String deptid = (String) this.getSession().getAttribute("deptid");
String adminid = (String) this.getSession().getAttribute("adminid");
pwin.setDeptid(deptid);
pwin.setEmployid(adminid);
pwin.setAddtime(VeDate.getStringDateShort());
this.pwinService.insertPwin(pwin);
return "redirect:/pwin/createPwin.action";
}
// 通过主键删除数据
@RequestMapping("deletePwin.action")
public String deletePwin(String id) {
this.pwinService.deletePwin(id);
return "redirect:/pwin/getAllPwin.action";
}
// 批量删除数据
@RequestMapping("deletePwinByIds.action")
public String deletePwinByIds() {
String[] ids = this.getRequest().getParameterValues("pwinid");
if (ids != null) {
for (String pwinid : ids) {
this.pwinService.deletePwin(pwinid);
}
}
return "redirect:/pwin/getAllPwin.action";
public String getDeptLend(String number) {
String deptid = (String) this.getSession().getAttribute("deptid");
Lend lend = new Lend();
lend.setDeptid(deptid);
List<Lend> lendList = this.lendService.getLendByCond(lend);
PageHelper.getUserPage(lendList, "lend", "getDeptLend", 10, number, this.getRequest());
return "admin/xlistlend";
}
@RequestMapping("getMyLend.action")
public String getMyLend(String number) {
String adminid = (String) this.getSession().getAttribute("adminid");
Lend lend = new Lend();
lend.setEmployid(adminid);
List<Lend> lendList = this.lendService.getLendByCond(lend);
PageHelper.getUserPage(lendList, "lend", "getMyLend", 10, number, this.getRequest());
return "admin/ylistlend";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryLendByCond.action")
public String queryLendByCond(String cond, String name, String number) {
Lend lend = new Lend();
if (cond != null) {
if ("lno".equals(cond)) {
lend.setLno(name);
}
if ("employid".equals(cond)) {
lend.setEmployid(name);
}
if ("deptid".equals(cond)) {
lend.setDeptid(name);
}
if ("equipmentid".equals(cond)) {
lend.setEquipmentid(name);
}
if ("reason".equals(cond)) {
lend.setReason(name);
}
if ("status".equals(cond)) {
lend.setStatus(name);
}
if ("addtime".equals(cond)) {
lend.setAddtime(name);
}
buffer.append(maxPage);
buffer.append("页 共有");
buffer.append(pageNumber);
buffer.append("条 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"index/" + action + "?number=0" + path + "\">首页</a>");
}
buffer.append(" ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"index/" + action + "?number=" + (Integer.parseInt(number) - 1) + "" + path + "\">上一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("下一页");
} else {
buffer.append("<a href=\"index/" + action + "?number=" + (Integer.parseInt(number) + 1) + "" + path + "\">下一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("尾页");
} else {
buffer.append("<a href=\"index/" + action + "?number=" + (maxPage - 1) + "" + path + "\">尾页</a>");
}
String html = buffer.toString();
request.setAttribute("html", html);
request.setAttribute(name + "List", objList);
}
}
@Autowired
private ApplyxService applyxService;
@Autowired
private DeptService deptService;
@Autowired
private EmployService employService;
@Autowired
private BuyService buyService;
@Autowired
private EquipmentService equipmentService;
// 准备添加数据
@RequestMapping("createSend.action")
public String createSend(String id) {
Buy buy = this.buyService.getBuyById(id);
this.getRequest().setAttribute("buy", buy);
Applyx applyx = this.applyxService.getApplyxById(buy.getApplyxid());
Employ employ = new Employ();
employ.setDeptid(applyx.getDeptid());
List<Employ> employList = this.employService.getEmployByCond(employ);
this.getRequest().setAttribute("employList", employList);
return "admin/addsend";
}
// 添加数据
@RequestMapping("addSend.action")
public String addSend(Send send) {
String buyid = this.getRequest().getParameter("buyid");
Buy buy = this.buyService.getBuyById(buyid);
Applyx applyx = this.applyxService.getApplyxById(buy.getApplyxid());
applyx.setStatus("已发放");
this.applyxService.updateApplyx(applyx);
send.setApplyxid(applyx.getApplyxid());
send.setDeptid(applyx.getDeptid());
send.setEquipmentname(buy.getEquipmentname());
send.setAddtime(VeDate.getStringDateShort());
this.sendService.insertSend(send);
for (int i = 0; i < Integer.parseInt(send.getNum()); i++) {
Equipment x = new Equipment();
x.setAddtime(VeDate.getStringDateShort());
x.setApplyxid(applyx.getApplyxid());
x.setCateid(applyx.getCateid());
x.setDeptid(applyx.getDeptid());
x.setEno("E" + VeDate.getStringDatex() + i);
x.setEquipmentid("E" + VeDate.getStringDatex() + i);
x.setMemo("");
cate.setAddtime(VeDate.getStringDateShort());
this.cateService.insertCate(cate);
return "redirect:/cate/createCate.action";
}
// 通过主键删除数据
@RequestMapping("deleteCate.action")
public String deleteCate(String id) {
this.cateService.deleteCate(id);
return "redirect:/cate/getAllCate.action";
}
// 批量删除数据
@RequestMapping("deleteCateByIds.action")
public String deleteCateByIds() {
String[] ids = this.getRequest().getParameterValues("cateid");
if (ids != null) {
for (String cateid : ids) {
this.cateService.deleteCate(cateid);
}
}
return "redirect:/cate/getAllCate.action";
}
// 更新数据
@RequestMapping("updateCate.action")
public String updateCate(Cate cate) {
this.cateService.updateCate(cate);
return "redirect:/cate/getAllCate.action";
}
// 显示全部数据
@RequestMapping("getAllCate.action")
public String getAllCate(String number) {
List<Cate> cateList = this.cateService.getAllCate();
PageHelper.getPage(cateList, "cate", null, null, 10, number, this.getRequest(), null);
return "admin/listcate";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryCateByCond.action")
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/employ", produces = "text/plain;charset=utf-8")
public class EmployController extends BaseController {
// @Autowired的作用是自动注入依赖的ServiceBean
@Autowired
private EmployService employService;
@Autowired
private DeptService deptService;
// 准备修改密码
@RequestMapping("prePwd.action")
public String prePwd() {
return "admin/deditpwd";
}
// 修改密码
@RequestMapping("editpwd.action")
public String editpwd() {
String adminid = (String) this.getSession().getAttribute("adminid");
String password = this.getRequest().getParameter("password");
String repassword = this.getRequest().getParameter("repassword");
Employ employ = this.employService.getEmployById(adminid);
if (password.equals(employ.getPassword())) {
employ.setPassword(repassword);
this.employService.updateEmploy(employ);
} else {
this.getRequest().setAttribute("message", "旧密码错误");
}
return "redirect:/employ/prePwd.action";
}
@RequestMapping("userinfo.action")
public String userinfo() {
String adminid = (String) this.getSession().getAttribute("adminid");
Employ employ = this.employService.getEmployById(adminid);
this.getRequest().setAttribute("employ", employ);
return "admin/userinfo";
}
@RequestMapping("personal.action")
public String personal(Employ employ) {
this.employService.updateEmploy(employ);
number = "0";
}
int start = Integer.parseInt(number) * pageSize;
int over = (Integer.parseInt(number) + 1) * pageSize;
int count = pageNumber - over;
if (count <= 0) {
over = pageNumber;
}
for (int i = start; i < over; i++) {
Object obj = list.get(i);
objList.add(obj);
}
buffer.append(" 共为");
buffer.append(maxPage);
buffer.append("页 共有");
buffer.append(pageNumber);
buffer.append("条 当前为第");
buffer.append((Integer.parseInt(number) + 1));
buffer.append("页 ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("首页");
} else {
buffer.append("<a href=\"" + name + "/" + action + "?number=0" + path + "\">首页</a>");
}
buffer.append(" ");
if ((Integer.parseInt(number) + 1) == 1) {
buffer.append("上一页");
} else {
buffer.append("<a href=\"" + name + "/" + action + "?number=" + (Integer.parseInt(number) - 1) + "" + path + "\">上一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("下一页");
} else {
buffer.append("<a href=\"" + name + "/" + action + "?number=" + (Integer.parseInt(number) + 1) + "" + path + "\">下一页</a>");
}
buffer.append(" ");
if (maxPage <= (Integer.parseInt(number) + 1)) {
buffer.append("尾页");
} else {
// @Autowired的作用是自动注入依赖的ServiceBean
@Autowired
private PlostService plostService;
@Autowired
private DeptService deptService;
@Autowired
private EquipmentService equipmentService;
@Autowired
private EmployService employService;
// 准备添加数据
@RequestMapping("createPlost.action")
public String createPlost() {
List<Dept> deptList = this.deptService.getAllDept();
this.getRequest().setAttribute("deptList", deptList);
List<Equipment> equipmentList = this.equipmentService.getAllEquipment();
this.getRequest().setAttribute("equipmentList", equipmentList);
List<Employ> employList = this.employService.getAllEmploy();
this.getRequest().setAttribute("employList", employList);
this.getRequest().setAttribute("wno", "P" + VeDate.getStringDatex());
return "admin/addplost";
}
// 添加数据
@RequestMapping("addPlost.action")
public String addPlost(Plost plost) {
String deptid = (String) this.getSession().getAttribute("deptid");
String adminid = (String) this.getSession().getAttribute("adminid");
plost.setDeptid(deptid);
plost.setEmployid(adminid);
plost.setAddtime(VeDate.getStringDateShort());
this.plostService.insertPlost(plost);
return "redirect:/plost/createPlost.action";
}
// 通过主键删除数据
@RequestMapping("deletePlost.action")
public String deletePlost(String id) {
this.plostService.deletePlost(id);
return "redirect:/plost/getAllPlost.action";
}
// 批量删除数据
@RequestMapping("deletePlostByIds.action")
public String deletePlostByIds() {
String[] ids = this.getRequest().getParameterValues("plostid");
if (ids != null) {
return "admin/queryequipment";
}
// 按主键查询数据
@RequestMapping("getEquipmentById.action")
public String getEquipmentById(String id) {
Equipment equipment = this.equipmentService.getEquipmentById(id);
this.getRequest().setAttribute("equipment", equipment);
List<Applyx> applyxList = this.applyxService.getAllApplyx();
this.getRequest().setAttribute("applyxList", applyxList);
List<Dept> deptList = this.deptService.getAllDept();
this.getRequest().setAttribute("deptList", deptList);
List<Cate> cateList = this.cateService.getAllCate();
this.getRequest().setAttribute("cateList", cateList);
return "admin/editequipment";
}
}
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/admin", produces = "text/plain;charset=utf-8")
public class AdminController extends BaseController {
// @Autowired的作用是自动注入依赖的ServiceBean
@Autowired
private AdminService adminService;
// 管理员准备
@RequestMapping("index.action")
public String createPwin() {
List<Dept> deptList = this.deptService.getAllDept();
this.getRequest().setAttribute("deptList", deptList);
List<Equipment> equipmentList = this.equipmentService.getAllEquipment();
this.getRequest().setAttribute("equipmentList", equipmentList);
List<Employ> employList = this.employService.getAllEmploy();
this.getRequest().setAttribute("employList", employList);
this.getRequest().setAttribute("wno", "P" + VeDate.getStringDatex());
return "admin/addpwin";
}
// 添加数据
@RequestMapping("addPwin.action")
public String addPwin(Pwin pwin) {
String deptid = (String) this.getSession().getAttribute("deptid");
String adminid = (String) this.getSession().getAttribute("adminid");
pwin.setDeptid(deptid);
pwin.setEmployid(adminid);
pwin.setAddtime(VeDate.getStringDateShort());
this.pwinService.insertPwin(pwin);
return "redirect:/pwin/createPwin.action";
}
// 通过主键删除数据
@RequestMapping("deletePwin.action")
public String deletePwin(String id) {
this.pwinService.deletePwin(id);
return "redirect:/pwin/getAllPwin.action";
}
// 批量删除数据
@RequestMapping("deletePwinByIds.action")
public String deletePwinByIds() {
String[] ids = this.getRequest().getParameterValues("pwinid");
if (ids != null) {
for (String pwinid : ids) {
this.pwinService.deletePwin(pwinid);
}
}
return "redirect:/pwin/getAllPwin.action";
}
// 更新数据
@RequestMapping("updatePwin.action")
public String updatePwin(Pwin pwin) {
this.pwinService.updatePwin(pwin);
return "redirect:/pwin/getAllPwin.action";
}
// 显示全部数据
this.getRequest().setAttribute("send", send);
List<Applyx> applyxList = this.applyxService.getAllApplyx();
this.getRequest().setAttribute("applyxList", applyxList);
List<Dept> deptList = this.deptService.getAllDept();
this.getRequest().setAttribute("deptList", deptList);
List<Employ> employList = this.employService.getAllEmploy();
this.getRequest().setAttribute("employList", employList);
return "admin/editsend";
}
}
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/lend", produces = "text/plain;charset=utf-8")
public class LendController extends BaseController {
// @Autowired的作用是自动注入依赖的ServiceBean
@Autowired
private LendService lendService;
@Autowired
private EmployService employService;
@Autowired
private DeptService deptService;
@Autowired
private EquipmentService equipmentService;
// 准备添加数据
@RequestMapping("createLend.action")
public String createLend() {
String deptid = (String) this.getSession().getAttribute("deptid");
Equipment x = new Equipment();
x.setDeptid(deptid);
x.setStatus("正常");
List<Equipment> equipmentList = this.equipmentService.getEquipmentByCond(x);