-
大小: 10.82MB文件類型: .7z金幣: 1下載: 0 次發(fā)布日期: 2023-10-10
- 語言: 數(shù)據(jù)庫
- 標(biāo)簽: SpringMVC??SSM??Mybatis??JavaWeb??
資源簡介
基于SSM框架的完整項(xiàng)目 Spring+SpringMVC+Mybatis+mysql 前段bootstrap 簡單的一個(gè)后臺管理系統(tǒng)
代碼片段和文件信息
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?{
//?注入U(xiǎn)serService
@Autowired
private?CommunityService?communityService;
/**
?*?
?*?@param:?@return
?*?@param:?@throws?Exception
?*?@return:?ModelAndView
?*?@author?zhanglei
?*?@Date?2016年9月3日?下午2:35:53
?*?@Description:?顯示小區(qū)列表
?*/
@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:?顯示添加小區(qū)頁面
?*/
@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:?添加小區(qū)
?*/
@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:?顯示編輯小區(qū)頁面
?*/
@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:?編輯小區(qū)信息
?*/
@RequestMa
評論
共有 條評論