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  LV19 2023年3月30日
cx123123  LV7 2022年5月17日
habiya  LV3 2022年3月15日
ewan007  LV29 2022年3月10日
微信网友_5845420553359360  LV4 2022年2月27日
wanglinddad  LV54 2021年11月6日
freeblow  LV2 2021年5月20日
and123456  LV11 2021年5月11日
最近浏览更多
jay1992  LV14 3月16日
952773464 1月15日
暂无贡献等级
氟西汀来救你  LV2 1月9日
zhangjilu  LV18 1月7日
hai666666  LV1 2023年12月25日
季明亮 2023年11月21日
暂无贡献等级
fesfefe  LV13 2023年10月31日
molu123456 2023年10月16日
暂无贡献等级
huhansan  LV10 2023年10月13日
bananmike77 2023年10月7日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友