首页>代码>Hibernate+Spring+Spring MVC+ExtJs开发新闻发布后台管理系统,前端通过bootstrap实现>/Platform/src/org/platform/system/client/controller/ClientController.java
package org.platform.system.client.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.platform.system.client.service.news.NewsCategoryClientService;
import org.platform.system.client.service.news.NewsContentClientService;
import org.platform.system.entity.news.NewsCategory;
import org.platform.system.entity.news.NewsContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 客户端控制器。
*
* @author 钱佳明。
*
*/
@Controller
public class ClientController {
/**
* 资讯栏目客户端服务。
*/
@Autowired
public NewsCategoryClientService newsCategoryClientService;
/**
* 资讯内容客户端服务。
*/
@Autowired
public NewsContentClientService newsContentClientService;
/**
* 返回首页。
*
* @param map
* 数据集。
* @return 首页。
*/
@RequestMapping(value = "home")
public String showIndex(Map<String, Object> map) {
List<NewsCategory> newsCategoryList = newsCategoryClientService.list();
List<NewsContent> newsContentList = new ArrayList<NewsContent>();
for (int index = 0; index < newsCategoryList.size(); index++) {
Integer id = newsCategoryList.get(index).getId();
newsContentList.addAll(newsContentClientService.list(id, 0, 10));
}
map.put("newsCategoryList", newsCategoryList);
map.put("newsContentList", newsContentList);
return "index";
}
/**
* 返回列表页。
*
* @param map
* 数据集。
* @param id
* 资讯栏目编号。
* @return 列表页。
*/
@RequestMapping(value = "list")
public String showList(Map<String, Object> map,
@RequestParam(value = "id", required = true) Integer id) {
map.put("newsCategory", newsCategoryClientService.get(id));
map.put("newsCategoryList", newsCategoryClientService.list());
map.put("newsContentList", newsContentClientService.list(id, 0, 10));
return "list";
}
/**
* 返回内容页。
*
* @param map
* 数据集。
* @param id
* 资讯内容编号。
* @return 内容页。
*/
@RequestMapping(value = "content")
public String showContent(Map<String, Object> map,
@RequestParam(value = "id", required = true) Integer id) {
map.put("newsCategoryList", newsCategoryClientService.list());
map.put("newsContent", newsContentClientService.get(id));
return "content";
}
}
最近下载更多
benbosn LV15
2022年8月31日
xxxhhh1314 LV7
2022年1月9日
zhllzhll LV7
2021年12月8日
wurongchuyu LV5
2021年5月14日
aybk666 LV1
2021年4月5日
Jayant-YXY LV6
2021年2月20日
maicuminte LV2
2020年6月22日
倪卟懂 LV18
2020年5月26日
jaonsang LV25
2020年3月21日
hzq1498279624 LV2
2020年3月13日
最近浏览更多
krispeng LV15
5月29日
educationAAA LV11
2024年6月23日
lmj12345 LV2
2024年5月19日
WBelong LV8
2023年12月27日
微信网友_6784866726285312
2023年12月26日
暂无贡献等级
pangzhihui LV14
2023年5月11日
Mr_VVcat LV9
2023年4月19日
泓鼎168 LV20
2023年4月14日
微信网友_6403344757608448
2023年3月24日
暂无贡献等级
hesu2020 LV1
2023年3月18日

