package cn.bdqn.controller; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import common.PagerMySQL; import cn.bdqn.biz.OaBiz; import cn.bdqn.entity.Department; import cn.bdqn.entity.Leave; @Controller public class OaLeaveController { @Resource(name="Oabiz") private OaBiz oaBiz; public void setOaBiz(OaBiz oaBiz) { this.oaBiz = oaBiz; } @RequestMapping("/servletLeave") public String select( String starttime,String endtime, Model mode, @RequestParam(value="pageNo",defaultValue="1")Integer curPage, @RequestParam(value="pageSize",defaultValue="4")Integer pageSize ){ PageHelper.startPage(curPage, pageSize); List<Leave> list=oaBiz.findLeave(starttime, endtime); PageInfo<Leave> pageInfo = new PageInfo<Leave>(list); PagerMySQL<Leave> pager=new PagerMySQL<Leave>(curPage,pageSize,new Long(pageInfo.getTotal()).intValue()); pager.setEntitiesList(list); if(starttime!=null && endtime!=null){ mode.addAttribute("huixianstarttime",starttime); mode.addAttribute("huixianendtime",endtime); } mode.addAttribute("pagerBooks", pager); return "jsp/leave/leave_list.jsp"; } @RequestMapping("/servletLeaves") public String selects( String starttime,String endtime,String employee_sn, Model mode, @RequestParam(value="pageNo",defaultValue="1")Integer curPage, @RequestParam(value="pageSize",defaultValue="4")Integer pageSize ){ PageHelper.startPage(curPage, pageSize); List<Leave> list=oaBiz.findLeaves(employee_sn, starttime, endtime); PageInfo<Leave> pageInfo = new PageInfo<Leave>(list); PagerMySQL<Leave> pager=new PagerMySQL<Leave>(curPage,pageSize,new Long(pageInfo.getTotal()).intValue()); pager.setEntitiesList(list); if(starttime!=null && endtime!=null){ mode.addAttribute("huixianstarttime",starttime); mode.addAttribute("huixianendtime",endtime); } mode.addAttribute("pagerBooks", pager); return "jsp/leave/leave_list.jsp"; } @RequestMapping("/selectLeave") public ModelAndView select(Integer id,HttpSession session){ ModelAndView mode=new ModelAndView(); Leave leave=oaBiz.findLeaveById(id); session.setAttribute("lea", leave); mode.setViewName("jsp/leave/leave_view.jsp"); return mode; } @RequestMapping("/servletDe") public ModelAndView selectId(){ ModelAndView mode=new ModelAndView(); List<Department> departments=oaBiz.findDepartments(); mode.addObject("list", departments); mode.setViewName("jsp/leave/leave_edit.jsp"); return mode; } @RequestMapping("/AddLeave") public ModelAndView InsertBook(String name,Integer txtDepartment,String startTime,String endTime,String leaveDay,String leaveType,String reason,String next_deal_sn){ ModelAndView mode=new ModelAndView(); int num=oaBiz.addLeave(name, txtDepartment, startTime, endTime, leaveDay, leaveType, reason, next_deal_sn); if(num==1){ mode.setViewName("servletLeaves"); }else{ mode.setViewName("jsp/leave/leave_edit.jsp"); } return mode; } @RequestMapping("/selectleavenshen") public ModelAndView selectshen(Integer id,HttpSession session){ ModelAndView mode=new ModelAndView(); Leave leave=oaBiz.findLeaveById(id); session.setAttribute("lea", leave); mode.setViewName("jsp/leave/leave_check.jsp"); return mode; } @RequestMapping("/updateShen") public String UpdateId(String status,String approveOpinion,Integer id ){ Leave leave=new Leave(); leave.setId(id); leave.setStatus(status); leave.setStatus(approveOpinion); int num=oaBiz.Updateleave(leave); if(status.equals("已审批")){ approveOpinion="同意"; leave.setApprove_opinion(approveOpinion); }else { approveOpinion="不同意"; leave.setApprove_opinion(approveOpinion); } if(num==1){ return "servletLeave"; } return "selectleavenshen"; } }
最近下载更多
mazihao12138 LV2
2023年7月3日
c469893928 LV2
2023年6月10日
kkkaaaa LV3
2023年5月16日
微信网友_5963854197018624 LV7
2023年4月6日
微信网友_6164511365238784 LV7
2022年10月10日
赖小宝 LV3
2022年8月26日
最代码-宋家辉 LV61
2022年8月22日
2039995605 LV9
2022年6月5日
www-chrome LV6
2022年5月20日
cx123123 LV7
2022年5月18日