public String queryOneJump(HttpServletRequest req, HttpServletResponse resp) { // System.out.println(req.getParameter("sjob")); // System.out.println(req.getParameter("sdept")); String jobname = req.getParameter("sjob"); String deptid = req.getParameter("sdept"); DepartmentDAO de = new DepartmentDAO(); JobDAO jb = new JobDAO(); String jobid = jb.queryJobByJobName(jobname).getJobId(); String deptname = de.queryDeptById(deptid).getDepartmentName(); req.setAttribute("jobname", jobname); req.setAttribute("deptname", deptname); SalaryManageOP sam = new SalaryManageOP(); DeptJobRel dept = sam.querySalary(jobid, deptid); String deptjobid = dept.getDeptJobRelId(); req.setAttribute("deptjobid", deptjobid); // Salary salary=sam.querySalary(jobid, deptid).getSalary(); req.setAttribute("dept", dept); // 现在可以获得到选取的部门与职位,需要调用方法查询该部门该职位的薪资 System.out.println("运行了salaryJump方法"); // String info="对"+deptname+"部门"+jobname+"职位进行了查询操作"; // operateLogService.add(operaterService.getById(((Operater)req.getSession().getAttribute("operater")).getOpId()), // info); return "jsps/salary/salarymanage/QueryOneSalary.jsp"; }
public String changeSalary(HttpServletRequest req, HttpServletResponse resp) { // //从表单中获得到所有的信息 // double bonus=Double.parseDouble(req.getParameter("bonus")); // double // lunchSalary=Double.parseDouble(req.getParameter("lunchSalary")); // double // trafficSalary=Double.parseDouble(req.getParameter("trafficSalary")); // double // basicSalary=Double.parseDouble(req.getParameter("basicSalary")); // double allSalary=Double.parseDouble(req.getParameter("allSalary")); // String id=req.getParameter("id"); // //获取完毕 // SalaryDAO sa=new SalaryDAO(); // Salary salary=sa.querySalary(id); // salary.setBasicSalary(basicSalary); // salary.setAllSalary(allSalary); // salary.setBonus(bonus); // salary.setLunchSalary(lunchSalary); // salary.setTrafficSalary(trafficSalary); // SalaryManageOP sal=new SalaryManageOP(); // sal.updateSalary(salary); double bonus = Double.parseDouble(req.getParameter("bonus")); double lunchSalary = Double.parseDouble(req.getParameter("lunchSalary")); double trafficSalary = Double.parseDouble(req.getParameter("trafficSalary")); double basicSalary = Double.parseDouble(req.getParameter("basicSalary")); double allSalary = Double.parseDouble(req.getParameter("allSalary")); // String id=req.getParameter("id"); // 获取完毕 // SalaryDAO sa=new SalaryDAO(); // Salary salary=sa.querySalary(id); // salary.setBasicSalary(basicSalary); // salary.setAllSalary(allSalary); // salary.setBonus(bonus); // salary.setLunchSalary(lunchSalary); // salary.setTrafficSalary(trafficSalary); SalaryManageOP sal = new SalaryManageOP(); // sal.updateSalary(salary); Salary newsalary = sal.dealSaveSalary(bonus, lunchSalary, trafficSalary, basicSalary, allSalary); /* * 新生成一个salary */ String deptjobid = req.getParameter("deptjobid"); System.out.println("***" + deptjobid); SalaryDAO saldao = new SalaryDAO(); DeptJobRel dept = saldao.queryDeptJobRelbyId(deptjobid); // 查出来0 sal.savesalaryadjust(dept); dept.setSalary(newsalary); // 改变 saldao.update(dept); // 不知道好不好用 更新 /* * 上面是将deptjobrel表中salaryid的值改为新的值 */ // String // info="对"+dept.getDepartment().getDepartmentName()+"部门"+dept.getJob().getJobName()+"部门进行了工资调整的操作"; // operateLogService.add(operaterService.getById(((Operater)req.getSession().getAttribute("operater")).getOpId()), // info); return "../salarymanage.sal?method=SalaryManageJump"; }