首页>代码>spring+spring mvc+mybatis开发java医院HR人事管理系统(加强版本+ shiro)>/HR/src/main/java/edu/hebeu/controller/HistoryController.java
package edu.hebeu.controller; import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import com.baomidou.mybatisplus.plugins.Page; import edu.hebeu.entity.Employee; import edu.hebeu.entity.History; import edu.hebeu.security.PermissionSign; import edu.hebeu.service.EmployeeService; import edu.hebeu.service.HistoryService; import edu.hebeu.util.MTimeUtil; @Controller @RequestMapping("/history") public class HistoryController { @Autowired private HistoryService historyService; @Autowired private EmployeeService employeeService; @RequestMapping("/retireListPage.do") @RequiresPermissions(value = PermissionSign.HISTORY_LIST) public String selectRetireByPage(Model model, int pageNo){ Page<History> page = historyService.selectRetireByPage(pageNo); model.addAttribute("page", page); return "admin/retire_list"; } @RequestMapping("/{id}/detail.do") @RequiresPermissions(value = PermissionSign.HISTORY_DETAIL) public String selectHistory(@PathVariable Integer id, Model model){ History history = historyService.selectHistory(id); model.addAttribute("history", history); return "admin/history_detail"; } @RequestMapping("/{id}/toUpdate.do") @RequiresPermissions(value = PermissionSign.HISTORY_UPDATE) public String toUpdate(Model model, @PathVariable Integer id){ History history = historyService.selectHistory(id); if (history.getStatus().equals("在职")) { Employee employee = employeeService.selectByNumber(history.getEmployeeNumber()); return "forward:/employee/"+ employee.getId() +"/toUpdate.do"; }else{ model.addAttribute("history", history); return "admin/history_update"; } } @RequestMapping("/{id}/updateRetire.do") @RequiresPermissions(value = PermissionSign.HISTORY_UPDATE_SUBMIT) public String updateRetire(@PathVariable Integer id, History history, String date){ history.setId(id); history.setBirthday(MTimeUtil.stringParse(date)); historyService.updateById(history); return "forward:/history/retireListPage.do?pageNo=1"; } @RequestMapping("/listPage.do") public String selectListByPage(Model model, int pageNo){ Page<History> page = historyService.selectLisByPage(pageNo); model.addAttribute("page", page); return "admin/history_list"; } @RequestMapping("/{id}/update.do") public String updateById(@PathVariable Integer id, History history, String date){ history.setId(id); history.setBirthday(MTimeUtil.stringParse(date)); historyService.updateById(history); return "forward:/history/listPage.do?pageNo=1"; } @RequestMapping("/list.do") @RequiresPermissions(value = PermissionSign.EMPLOYEE_LIST) public String list(Model model){ List<History> hList = historyService.selectList(); model.addAttribute("hList", hList); return "admin/history_list"; } }

zolscy LV24
2024年11月29日
TY0165 LV20
2024年6月25日
嘲讽脸 LV5
2024年5月15日
minjing123 LV8
2024年1月4日
小安同学 LV7
2023年12月7日
微信网友_6372890284232704 LV7
2023年8月30日
dowell_liu LV1
2023年8月2日
哇塞塞哈哈哈 LV8
2023年5月4日
bibibi234 LV1
2023年4月4日
a562571298 LV8
2023年3月23日