資源簡介
基于SSM框架的完整項目 Spring+SpringMVC+Mybatis+mysql 前段bootstrap 簡單的一個后臺管理系統
代碼片段和文件信息
package?com.controller;
import?java.util.List;
import?javax.servlet.http.HttpServletRequest;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.stereotype.Controller;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.servlet.ModelAndView;
import?com.entity.Community;
import?com.service.CommunityService;
@Controller
//?定義該Controller的根訪問路徑?/admin
@RequestMapping(“/community“)
public?class?CommunityController?{
//?注入UserService
@Autowired
private?CommunityService?communityService;
/**
?*?
?*?@param:?@return
?*?@param:?@throws?Exception
?*?@return:?ModelAndView
?*?@author?zhanglei
?*?@Date?2016年9月3日?下午2:35:53
?*?@Description:?顯示小區列表
?*/
@RequestMapping(“/communitylist“)
public?ModelAndView?communitylist(String?serach)?throws?Exception?{
ModelAndView?modelAndView?=?new?ModelAndView();
Community?community?=?new?Community();
community.setCname(serach);
List?communityList?=?communityService
.findCommunityList(community);
modelAndView.addobject(“communityList“?communityList);
modelAndView.setViewName(“community/admin_community_list“);
return?modelAndView;
}
/**
?*?
?*?@param:?@return
?*?@param:?@throws?Exception
?*?@return:?String
?*?@author?zhanglei
?*?@Date?2016年11月12日?上午11:08:49
?*?@Description:?顯示添加小區頁面
?*/
@RequestMapping(“/add“)
public?String?add()?throws?Exception?{
return?“community/admin_community_add“;
}
/**
?*?
?*?@param:?@param?request
?*?@param:?@param?cname
?*?@param:?@param?address
?*?@param:?@return
?*?@param:?@throws?Exception
?*?@return:?String
?*?@author?zhanglei
?*?@Date?2016年11月12日?上午11:09:04
?*?@Description:?添加小區
?*/
@RequestMapping(“/add_do“)
public?String?add_do(HttpServletRequest?request?String?cname
String?address)?throws?Exception?{
Community?community?=?new?Community();
community.setCname(cname);
community.setAddress(address);
community.setIsdelete(0);
communityService.add(community);
return?“forward:communitylist.action“;
}
/**
?*?
?*?@param:?@param?id
?*?@param:?@return
?*?@param:?@throws?Exception
?*?@return:?ModelAndView
?*?@author?zhanglei
?*?@Date?2016年11月12日?上午11:09:21
?*?@Description:?顯示編輯小區頁面
?*/
@RequestMapping(“/edit“)
public?ModelAndView?edit(Integer?id)?throws?Exception?{
ModelAndView?modelAndView?=?new?ModelAndView();
Community?communityinf?=?communityService.findCommunityById(id);
modelAndView.addobject(“communityinf“?communityinf);
modelAndView.setViewName(“community/admin_community_edit“);
return?modelAndView;
}
/**
?*?
?*?@param:?@param?request
?*?@param:?@param?id
?*?@param:?@param?cname
?*?@param:?@param?address
?*?@param:?@return
?*?@param:?@throws?Exception
?*?@return:?String
?*?@author?zhanglei
?*?@Date?2016年11月12日?上午11:09:34
?*?@Description:?編輯小區信息
?*/
@RequestMa
評論
共有 條評論