From 601eb43f4de2d0615e5aeea3c98a5b17edb3b3f0 Mon Sep 17 00:00:00 2001 From: p6xft4ki7 <2244365857@qq.com> Date: Wed, 6 Apr 2022 16:33:17 +0800 Subject: [PATCH] ADD file via upload --- 代码/OA/src/com/oa/action/ForumAction.java | 78 ++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 代码/OA/src/com/oa/action/ForumAction.java diff --git a/代码/OA/src/com/oa/action/ForumAction.java b/代码/OA/src/com/oa/action/ForumAction.java new file mode 100644 index 0000000..e10ffba --- /dev/null +++ b/代码/OA/src/com/oa/action/ForumAction.java @@ -0,0 +1,78 @@ +package com.oa.action; + +import java.util.List; + +import com.oa.pojo.Forum; +import com.oa.pojo.Topic; +import com.oa.service.ForumManageService; +import com.oa.service.TopicService; +import com.oa.util.PageInfo; +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ActionSupport; +import com.opensymphony.xwork2.ModelDriven; + +public class ForumAction extends ActionSupport implements ModelDriven{ + + private ForumManageService forumManageService; + private TopicService topicService; + private Forum forum=new Forum(); + private PageInfo pageInfo; + + public String list(){ + List forumList=forumManageService.findAll(); + ActionContext.getContext().put("forumList",forumList); + return "forumList"; + } + + public ForumAction() { + pageInfo=new PageInfo(); + } + + //展示版块详细 + public String show(){ + Forum f=forumManageService.getById(forum.getId()); + //Set topic=f.getTopics(); + //List topics=new ArrayList(topic); + //ActionContext.getContext().put("topics",topics); + + ActionContext.getContext().put("forum",f); + + //List topicList=topicService.findByForum(f); + + //获取分页数据及总数量 + List topicList=topicService.findByForum(f,pageInfo); + int count=topicService.getCount(f); + pageInfo.setTotalRecord(count); + ActionContext.getContext().put("page",pageInfo); + ActionContext.getContext().put("topicList",topicList); + return "forumShow"; + } + + + public void setForumManageService(ForumManageService forumManageService) { + this.forumManageService = forumManageService; + } + + @Override + public Forum getModel() { + return forum; + } + + public TopicService getTopicService() { + return topicService; + } + + public void setTopicService(TopicService topicService) { + this.topicService = topicService; + } + + public PageInfo getPageInfo() { + return pageInfo; + } + + public void setPageInfo(PageInfo pageInfo) { + this.pageInfo = pageInfo; + } + + +}