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

📄 userinfoaroundadvice.java

📁 hibernate项目实践
💻 JAVA
字号:
package com.px1987.webbbs.aop;
import com.px1987.webbbs.dao.*;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import com.px1987.webbbs.model.UserInfoVO;
import com.px1987.webbbs.exception.*;
public class UserInfoAroundAdvice implements MethodInterceptor 
{
	UserManageDAOInterface userInfoManageDAOImpleBean=null;
	public UserInfoAroundAdvice() 
	{
		// TODO 自动生成构造函数存根
	}
	public Object invoke(MethodInvocation methodInvocation) throws Throwable 
	{
		Object methodArguments[]=methodInvocation.getArguments();
		UserInfoVO oneUserInfoVO=(UserInfoVO)methodArguments[0];
		String userName=oneUserInfoVO.getUserName();
		UserInfoPO oneUserInfoPO=userInfoManageDAOImpleBean.selectOneUserInfoByName(userName);
		if(oneUserInfoPO!=null)
		{
			throw new WebBBSException("您的用户已经在数据库表中存在了!请换另一个用户名称再次注册本系统");
		}
		Object result = methodInvocation.proceed();
		return result;
	}
	public void setUserInfoManageDAOImpleBean(
			UserManageDAOInterface userInfoManageDAOImpleBean) {
		this.userInfoManageDAOImpleBean = userInfoManageDAOImpleBean;
	}

}

⌨️ 快捷键说明

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