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

📄 blogfriendlinkaction.java

📁 JAVA开发的个人博客
💻 JAVA
字号:
package com.easyjf.blog.web.action;

import com.easyjf.blog.domain.FriendLink;
import com.easyjf.blog.logic.FriendLinkService;
import com.easyjf.blog.logic.impl.FriendLinkServiceImpl;
import com.easyjf.util.CommUtil;
import com.easyjf.web.Module;
import com.easyjf.web.Page;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.IActiveUser;
import com.easyjf.web.tools.IPageList;

public class BlogFriendLinkAction extends BaseCrudAction {

	private FriendLinkService friendLinkService=FriendLinkServiceImpl.getInstance();
	
	public IPageList doQuery(WebForm form, int currentPage, int pageSize) {
		return friendLinkService.queryFriendLink(this.getCurrentUser(form).getUserName(), currentPage, pageSize);
	}
	
	public Page doAdd(WebForm form, Module module, IActiveUser user) {
		boolean ret=friendLinkService.addFriendLink((FriendLink)form2Obj(form));
		if(ret)
		{
		form.addResult("msg","添加成功!");
		return super.doQuery(form,module,user);	
		}
		else
		{
			form.addResult("msg","添加失败!");
			return module.findPage("edit");
		}
	}

	public Page doDel(WebForm form, Module module, IActiveUser user) {		
		boolean ret=friendLinkService.delFriendLink((String)form.get("cid"));
		form.addResult("msg",ret?"删除成功!":"删除失败!");		
		return super.doQuery(form,module,user);	
	}

	public Page doUpdate(WebForm form, Module module, IActiveUser user) {
		boolean ret=friendLinkService.updateFriendLink((FriendLink)form2Obj(form));
		form.addResult("msg",ret?"修改成功!":"修改失败!");	
		return super.doQuery(form,module,user);	
	}

	public Object form2Obj(WebForm form) {
		String cid =CommUtil.null2String(form.get("cid"));
		FriendLink obj=friendLinkService.getFriendLink(cid);
		if(obj==null)obj=new FriendLink();
		form.toPo(obj);
		return obj;
	}

}

⌨️ 快捷键说明

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