資源簡介
springmvc+mybatis 企業開發實戰 項目源碼
代碼片段和文件信息
package?org.fkit.hrm.controller;
import?java.util.List;
import?org.fkit.hrm.domain.Dept;
import?org.fkit.hrm.service.HrmService;
import?org.fkit.hrm.util.tag.PageModel;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.beans.factory.annotation.Qualifier;
import?org.springframework.stereotype.Controller;
import?org.springframework.ui.Model;
import?org.springframework.web.bind.annotation.ModelAttribute;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.servlet.ModelAndView;
/**???
?*?@Description:?處理部門請求控制器
?*?
網站:瘋狂Java?
?*?@author?肖文吉 36750064@qq.com???
?*?@version?V1.0???
?*/
@Controller
public?class?DeptController?{
/**
?*?自動注入UserService
?*?*/
@Autowired
@Qualifier(“hrmService“)
private?HrmService?hrmService;
/**
?*?處理/login請求
?*?*/
@RequestMapping(value=“/dept/selectDept“)
?public?String?selectDept(Model?modelInteger?pageIndex
?@ModelAttribute?Dept?dept){
System.out.println(“selectDept?-->>“);
System.out.println(“pageIndex?=?“?+?pageIndex);
System.out.println(“dept?=?“?+?dept);
PageModel?pageModel?=?new?PageModel();
System.out.println(“getPageIndex?=?“?+?pageModel.getPageIndex());
System.out.println(“getPageSize?=?“?+?pageModel.getPageSize());
System.out.println(“getRecordCount?=?“?+?pageModel.getRecordCount());
if(pageIndex?!=?null){
pageModel.setPageIndex(pageIndex);
}
/**?查詢用戶信息?????*/
List?depts?=?hrmService.findDept(dept?pageModel);
model.addAttribute(“depts“?depts);
model.addAttribute(“pageModel“?pageModel);
return?“dept/dept“;
}
/**
?*?處理刪除部門請求
?*?@param?String?ids?需要刪除的id字符串
?*?@param?ModelAndView?mv
?*?*/
@RequestMapping(value=“/dept/removeDept“)
?public?ModelAndView?removeDept(String?idsModelAndView?mv){
//?分解id字符串
String[]?idArray?=?ids.split(““);
for(String?id?:?idArray){
//?根據id刪除部門
hrmService.removeDeptById(Integer.parseInt(id));
}
//?設置客戶端跳轉到查詢請求
mv.setViewName(“redirect:/dept/selectDept“);
//?返回ModelAndView
return?mv;
}
/**
?*?處理添加請求
?*?@param?String?flag?標記,?1表示跳轉到添加頁面,2表示執行添加操作
?*?@param?Dept??dept??要添加的部門對象
?*?@param?ModelAndView?mv
?*?*/
@RequestMapping(value=“/dept/addDept“)
?public?ModelAndView?addDept(
?String?flag
?@ModelAttribute?Dept?dept
?ModelAndView?mv){
if(flag.equals(“1“)){
//?設置跳轉到添加頁面
mv.setViewName(“dept/showAddDept“);
}else{
//?執行添加操作
hrmService.addDept(dept);
//?設置客戶端跳轉到查詢請求
mv.setViewName(“redirect:/dept/selectDept“);
}
//?返回
return?mv;
}
/**
?*?處理修改部門請求
?*?@param?String?flag?標記,?1表示跳轉到修改頁面,2表示執行修改操作
?*?@param?Dept?dept?要修改部門的對象
?*?@param?ModelAndView?mv
?*?*/
@RequestMapping(value=“/dept/updateDept“)
?public?ModelAndView?updateDpet(
?String?flag
?@ModelAttribute?Dept?dept
?ModelAndView?mv){
if(flag.equals
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-06-18?21:08??hrm\
?????文件????????8196??2017-06-18?21:08??hrm\.DS_Store
?????目錄???????????0??2017-06-18?21:45??__MACOSX\
?????目錄???????????0??2017-06-18?21:45??__MACOSX\hrm\
?????文件?????????120??2017-06-18?21:08??__MACOSX\hrm\._.DS_Store
?????文件????????4357??2016-07-28?23:02??hrm\hrm.sql
?????目錄???????????0??2017-06-18?21:11??hrm\hrmapp\
?????文件?????????845??2016-07-09?17:11??hrm\hrmapp\.classpath
?????目錄???????????0??2017-06-18?21:44??hrm\hrmapp\.idea\
?????目錄???????????0??2017-06-18?21:21??hrm\hrmapp\.idea\artifacts\
?????文件????????3554??2017-06-18?21:21??hrm\hrmapp\.idea\artifacts\hrmapp_war_exploded.xm
?????文件?????????686??2017-06-18?21:09??hrm\hrmapp\.idea\compiler.xm
?????目錄???????????0??2017-06-18?21:09??hrm\hrmapp\.idea\copyright\
?????文件??????????74??2017-06-18?21:09??hrm\hrmapp\.idea\copyright\profiles_settings.xm
?????文件?????????212??2017-06-18?21:11??hrm\hrmapp\.idea\encodings.xm
?????目錄???????????0??2017-06-18?21:09??hrm\hrmapp\.idea\libraries\
?????文件????????4494??2017-06-18?21:09??hrm\hrmapp\.idea\libraries\lib.xm
?????文件????????2968??2017-06-18?21:11??hrm\hrmapp\.idea\misc.xm
?????文件?????????252??2017-06-18?21:09??hrm\hrmapp\.idea\modules.xm
?????文件???????57267??2017-06-18?21:44??hrm\hrmapp\.idea\workspace.xm
?????文件????????1039??2016-07-09?17:11??hrm\hrmapp\.project
?????目錄???????????0??2017-03-29?15:49??hrm\hrmapp\.settings\
?????文件?????????503??2016-07-09?17:11??hrm\hrmapp\.settings\.jsdtscope
?????文件?????????364??2016-07-09?17:11??hrm\hrmapp\.settings\org.eclipse.jdt.core.prefs
?????文件?????????470??2016-07-09?17:11??hrm\hrmapp\.settings\org.eclipse.wst.common.component
?????文件?????????345??2016-07-09?17:11??hrm\hrmapp\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2016-07-09?17:11??hrm\hrmapp\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2016-07-09?17:11??hrm\hrmapp\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2017-06-18?21:44??hrm\hrmapp\build\
?????文件????????1614??2017-06-18?21:11??hrm\hrmapp\hrmapp.iml
?????目錄???????????0??2017-06-18?21:44??hrm\hrmapp\out\
............此處省略1392個文件信息
評論
共有 條評論