package action;

import java.util.List;

import util.MyJson;
import util.Page;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;

import entity.Affiche;
import entity.OaUser;
import entity.Task;
import biz.CommonBiz;

public class AfficheAction {
	private static final String TOAFFICHE = "toaffiche";
	private static final String TOAFFICHEMANAGE = "toaffichemanage";
	private CommonBiz commonBiz;
	private Affiche affiche;
	private int start;
	private int limit;
	private String sort;
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
	public String getSort() {
		return sort;
	}
	public void setSort(String sort) {
		this.sort = sort;
	}
	public String getDir() {
		return dir;
	}
	public void setDir(String dir) {
		this.dir = dir;
	}



	private String dir;
	public CommonBiz getCommonBiz() {
		return commonBiz;
	}
	public void setCommonBiz(CommonBiz commonBiz) {
		this.commonBiz = commonBiz;
	}
	public Affiche getAffiche() {
		return affiche;
	}
	public void setAffiche(Affiche affiche) {
		this.affiche = affiche;
	}
	
	/**
	 * 跳转到公告页面
	 * @return
	 */
	public String toAffiche(){
		return TOAFFICHE;
	}
	public String toAfficheManage(){
		return TOAFFICHEMANAGE;
	}
	/**
	 * 查询公告
	 * @return
	 */
	public String findAfficheList(){
		// 获取当前用户的事务列表
		List<Affiche> afficheList=commonBiz.getAfficheDAO().findAll();
		String msg = "{totalCount:" + afficheList.size() + ",result:";
		msg += MyJson.toJsonStr(afficheList, "oaRole");
		msg += "}";
		ActionContext.getContext().put("msg", msg);
		return Action.SUCCESS;
	}
	/**
	 * 添加公告
	 * @return
	 */
	public String addAffiche(){
		commonBiz.getAfficheDAO().save(affiche);
		ActionContext.getContext().put("msg", "{success:true,msg:'添加成功'}");
		return Action.SUCCESS;
	}
	
	/**
	 * 修改公告
	 * @return
	 */
	public String updateAffiche(){
		commonBiz.getAfficheDAO().merge(affiche);
		ActionContext.getContext().put("msg", "{success:true,msg:'修改成功'}");
		return Action.SUCCESS;
	}
	
	/**
	 * 删除公告
	 * @return
	 */
	public String deleteAffiche(){
		commonBiz.getAfficheDAO().delete(affiche);
		ActionContext.getContext().put("msg", "{success:true,msg:'删除成功'}");
		return Action.SUCCESS;
	}
	
	
	
	public String findAfficheListByPage(){
		Page page=commonBiz.findByPage(Affiche.class, start, limit, sort, dir);
		String msg = "{totalCount:" + page.getTotalCount() + ",result:";
		msg += MyJson.toJsonStr(page.getResult(), "oaRole");
		msg += "}";
		ActionContext.getContext().put("msg", msg);
		return Action.SUCCESS;
	}
	
	
	public String findAfficheListByPages(){
		Page page=commonBiz.findByPage(Affiche.class, start, limit, sort, dir);
		String msg = "{totalCount:" + page.getTotalCount() + ",result:";
		msg += MyJson.toJsonStr(page.getResult(), "oaRole");
		msg += "}";
		ActionContext.getContext().put("msg", msg);
		return Action.SUCCESS;
	}
}
最近下载更多
lvdong2023  LV10 2023年5月18日
微信网友_5963854197018624  LV7 2023年4月6日
泓鼎168  LV20 2023年3月30日
cx123123  LV7 2022年5月17日
habiya  LV3 2022年3月15日
ewan007  LV30 2022年3月10日
微信网友_5845420553359360  LV4 2022年2月27日
wanglinddad  LV55 2021年11月6日
freeblow  LV2 2021年5月20日
and123456  LV11 2021年5月11日
最近浏览更多
1111112222  LV6 1月8日
lvyga1  LV2 2024年12月20日
WBelong  LV8 2024年12月5日
angaochong  LV5 2024年10月29日
lqzixi  LV4 2024年10月9日
cyd yyds  LV2 2024年8月5日
校园网  LV9 2024年8月4日
qwe6002  LV10 2024年5月24日
dzx199212  LV1 2024年5月22日
sunlea  LV20 2024年5月9日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友