⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemmodulerightsaction.java

📁 EasyJF官网(www.easyjf.com)全站系统源码使用说明 全站源码是EasyJF开源团队站务组及核心成员共同开发及维护的系统
💻 JAVA
字号:
package com.easyjf.news.action;

import com.easyjf.news.business.ModuleRights;
import com.easyjf.news.business.SystemUtil;
import com.easyjf.util.CommUtil;
import com.easyjf.web.ActionContext;
import com.easyjf.web.Module;
import com.easyjf.web.Page;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.AbstractCmdAction;
import com.easyjf.web.tools.IActiveUser;
import com.easyjf.web.tools.IPageList;
import com.easyjf.web.tools.ListQuery;
import com.easyjf.web.tools.PageList;

public class SystemModuleRightsAction extends AbstractCmdAction {

	public Object doBefore(WebForm form, Module module) {
		if(this.getCurrentUser(form)==null){
			form.addResult("msg","您没有登录,或者登录信息已经超时,请重新登录!");
			return new Page("popedomError","/nologin.htm","page");
			}
		return super.doBefore(form,module);
	}

	public Page doInit(WebForm form, Module module) {
		// TODO Auto-generated method stub
		return doQuery(form,module);
	}
	public Page doNew(WebForm form, Module module) {
		return module.findPage("edit");
	}
	public Page doAdd(WebForm form, Module module) {
		ModuleRights obj=(ModuleRights)form.toPo(ModuleRights.class);
		if(obj.save())
		{
			form.addResult("msg","保存成功!");
			return  doQuery(form,module);
		}
		else
		{
			form.addResult("msg","保存失败!");
			return module.findPage("edit");
		}
		
	}
	public Page doEdit(WebForm form, Module module) {
		String name=CommUtil.null2String(form.get("cid"));
		ModuleRights obj=ModuleRights.read(name);
		if(obj!=null)form.addPo(obj);
		return module.findPage("edit");
	}
	public Page doUpdate(WebForm form, Module module) {
		String name=CommUtil.null2String(form.get("cid"));
		ModuleRights obj=ModuleRights.read(name);
		if(obj==null)obj=(ModuleRights)form.toPo(ModuleRights.class);
		else form.toPo(obj);		
		obj.update();
		return  doQuery(form,module);
	}
	public Page doDel(WebForm form, Module module) {
		String name=CommUtil.null2String(form.get("cid"));
		ModuleRights obj=ModuleRights.read(name);
		boolean ret=false;
		if(obj!=null)ret=obj.del();
		if(ret)
		{
			form.addResult("msg","删除成功!");			
		}
		else
		{
			form.addResult("msg","保存失败!");			
		}
		return  doQuery(form,module);
	}
	public Page doQuery(WebForm form, Module module) {
		// TODO Auto-generated method stub
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		IPageList pList=new PageList(new ListQuery(SystemUtil.getSystemModuleRights()));
		pList.doList(pageSize,currentPage,"","");
		if(pList!=null)CommUtil.saveIPageList2WebForm(pList,form);
		return module.findPage("list");
	}
	public IActiveUser getCurrentUser(WebForm form) {
		// TODO Auto-generated method stub
		return (IActiveUser)ActionContext.getContext().getSession().getAttribute("sysuser");
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -