首页>代码>java web开发简单BBS论坛系统>/forum/src/com/chen/action/CategoryAction.java
/**
 * 
 */
package com.chen.action;

import java.util.List;

import com.chen.bean.Categorys;
import com.chen.bean.Pages;
import com.chen.bean.Topics;
import com.chen.bean.Types;
import com.chen.service.CategoryService;

/**
 * @author chenguoji
 * @email chenguo_ji@163.com
 * 
 * 
 */
public class CategoryAction {

	private Categorys category;
	private CategoryService cateService;
	private List<Categorys> listCate;
	private List<Types> listType;
	private List<Topics> listTopic;
	private Pages pageBean;
	private int nowPage = 1;

	public String ManageAdd() throws Exception{
		this.cateService.add(category);
		return "cate_manageAdd_ok";
	}
	
	public String ManageUpdate() throws Exception{
		this.cateService.update(category);
		return "cate_manageUpdate_ok";
	}
	
	/**
	 * 新建帖子时获取所有大类型
	 * 
	 * @return
	 * @throws Exception
	 */
	public String new_getAll() throws Exception {
		this.listCate = this.cateService.getAll();
		return "cate_new_getAll_ok";
	}

	/**
	 * 新建帖子时获取所有小类型
	 * 
	 * @return
	 * @throws Exception
	 */
	public String new_getType() throws Exception {
		this.listType = this.cateService.new_getType(category.getId());
		return "cate_new_getType_ok_json";
	}

	/**
	 * 大模块获取所有类型
	 * @return
	 * @throws Exception
	 */
	public String getAll() throws Exception {
		this.listCate = this.cateService.getAll();
		return "cate_getAll_ok";
	}

	public String getType() throws Exception {
		this.listType = this.cateService.getType(category.getId());
		return "cate_getType_ok";
	}

	public String goCate() throws Exception {
		this.listType = this.cateService.getType(category.getId());
		if(listType.size()==0){
			return "error";
		}
		category.setName(listType.get(0).getTypesCategory().getName());
		this.pageBean = this.cateService.getAllForPages(10, nowPage, listType);
		this.listTopic = this.pageBean.getListTopics();
		return "cate_go_ok";
	}
	
	/**
	 * 后台管理获取所有大类型
	 * @return
	 * @throws Exception
	 */
	public String ManageAll() throws Exception {
		this.listCate = this.cateService.getAll();
		return "cate_manageAll_ok";
	}
	/**
	 * 后台管理获取所有小类型,类似新建帖子
	 * @return
	 * @throws Exception
	 */
	public String ManageAllType() throws Exception {
		this.category = this.cateService.find(category.getId());
		this.listType = this.cateService.manageType(category.getId());
		return "cate_manageAllType_ok_json";
	}
	
	

	public Categorys getCategory() {
		return category;
	}

	public void setCategory(Categorys category) {
		this.category = category;
	}

	public CategoryService getCateService() {
		return cateService;
	}

	public void setCateService(CategoryService cateService) {
		this.cateService = cateService;
	}

	public List<Categorys> getListCate() {
		return listCate;
	}

	public void setListCate(List<Categorys> listCate) {
		this.listCate = listCate;
	}

	public List<Types> getListType() {
		return listType;
	}

	public void setListType(List<Types> listType) {
		this.listType = listType;
	}

	public List<Topics> getListTopic() {
		return listTopic;
	}

	public void setListTopic(List<Topics> listTopic) {
		this.listTopic = listTopic;
	}

	public Pages getPageBean() {
		return pageBean;
	}

	public void setPageBean(Pages pageBean) {
		this.pageBean = pageBean;
	}

	public int getNowPage() {
		return nowPage;
	}

	public void setNowPage(int nowPage) {
		this.nowPage = nowPage;
	}

}
最近下载更多
123ggf  LV8 2023年6月14日
limin123  LV6 2023年6月11日
0011100  LV12 2023年5月31日
微信网友_6495054193971200  LV2 2023年5月29日
1796527961  LV1 2023年3月23日
wouldbb  LV6 2023年3月21日
tyyeng  LV18 2023年1月1日
long123_356  LV8 2022年12月10日
akbar2020  LV9 2022年9月4日
yazhiyjs  LV4 2022年8月30日
最近浏览更多
ChanLain  LV2 3月3日
taoshen95  LV16 2024年12月19日
微信网友_7300409508155392 2024年12月17日
暂无贡献等级
asdxvfvfs 2024年12月3日
暂无贡献等级
短巷拥猫  LV12 2024年10月22日
cong58cong  LV8 2024年6月26日
tjnu123 2024年6月18日
暂无贡献等级
Rinkia 2024年3月28日
暂无贡献等级
xiaopengzep  LV1 2024年3月24日
lvhongquan  LV11 2023年12月31日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友