首页>代码>springMVC+Mybatis+Spring+Easyui+zTree+ueditor+highchart企业IT信息管理系统>/IT_M - 副本/src/com/gree/ssm/controller/DepartController.java
package com.gree.ssm.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.github.pagehelper.PageInfo; import com.gree.ssm.po.Depart; import com.gree.ssm.service.DepartService; /** * 部门 * * @author Administrator * */ @Controller @RequestMapping("/depart") public class DepartController { @Autowired private DepartService departService; @RequestMapping("/opDepart") public String opDepart(Model model, HttpServletRequest request, HttpServletResponse response) throws Exception { // 页面转发 return "depart/departList"; } @RequestMapping("/add") public @ResponseBody Map<String, Object> add(Model model, Depart depart) { Map<String, Object> re = new HashMap<String, Object>(); boolean result = departService.add(depart); if (result) { re.put("success", true); re.put("msg", "添加成功"); } else { re.put("success", false); re.put("msg", "添加失败"); } return re; } @RequestMapping("/update") public @ResponseBody Map<String, Object> update(Model model, Depart depart) { Map<String, Object> re = new HashMap<String, Object>(); boolean result = departService.update(depart); if (result) { re.put("success", true); re.put("msg", "修改成功"); } else { re.put("success", false); re.put("msg", "修改失败"); } return re; } @RequestMapping("/query") public @ResponseBody Map<String, Object> query(HttpServletRequest request, HttpServletResponse response, String dName, Integer page, Integer rows) throws Exception { Map<String, Object> re = new HashMap<String, Object>(); PageInfo<Depart> pageInfo = departService.findListByNamePage(dName, page, rows); re.put("total", pageInfo.getTotal()); re.put("rows", pageInfo.getList()); return re; } @RequestMapping("/queryAll") public @ResponseBody List<Depart> queryAll(HttpServletRequest request, HttpServletResponse response, String dName) throws Exception { if (dName != null) dName = new String(dName.getBytes("ISO-8859-1"), "UTF-8"); List<Depart> departs = departService.findListByNameAll(dName); return departs; } /** * 删除 * * @return */ @RequestMapping("/delete") public @ResponseBody Map<Object, Object> delete(Integer[] ids) { Map<Object, Object> re = new HashMap<Object, Object>(); boolean result = departService.deleteByIds(ids); if (result) { re.put("success", true); re.put("msg", "删除成功"); } else { re.put("success", false); re.put("msg", "删除失败"); } return re; } }

zhaoyangwfd LV17
2022年1月20日
wanglinddad LV55
2022年1月19日
543666826 LV34
2021年11月18日
2231788897 LV6
2021年10月20日
lewis365 LV2
2021年8月22日
ericxu1116 LV24
2021年6月7日
幸运疯子 LV13
2021年5月16日
小屁孩 LV7
2021年4月11日
skipple3 LV39
2020年11月26日
ddqddqddq LV14
2020年9月5日

xiaohuaidan455 LV2
2月23日
xianyu091012 LV5
2024年12月26日
255921158 LV5
2024年12月20日
张春青 LV6
2024年11月14日
shaohuaqingfu LV3
2024年11月6日
唐唐丶 LV34
2024年9月12日
a801824 LV1
2024年7月4日
sunlea LV20
2024年6月23日
李俊雄 LV3
2024年5月8日
educationAAA LV11
2024年5月2日