📄 loginbean.java~2~
字号:
package com.talent.system.login;import java.rmi.*;import java.util.*;import java.sql.*;import javax.ejb.*;import javax.naming.*;import javax.sql.RowSet;import javax.transaction.UserTransaction;import weblogic.jndi.*;import sun.jdbc.rowset.*;import com.talent.publics.*;public class LoginBean implements SessionBean { private SessionContext sessionContext; public void ejbCreate() { } public void ejbRemove() { } public void ejbActivate() { } public void ejbPassivate() { } public void setSessionContext(SessionContext sessionContext) { this.sessionContext = sessionContext; }//核对该登陆操作员是否存在,返回“真”存在,返回“假”不存在 public boolean checkLoginUser(String id) throws Exception, SQLException{ try{ DbBean dbBean = new DbBean(); ResultSet resultSet; String sql = "select count(*) from news where id = '" + id+"'";System.out.println("CheckLoginUserSql========"+sql); resultSet = dbBean.execQuery(sql); while(resultSet.next()){ if (resultSet.getString(1).equals("0")){ dbBean.close(); return false; }else{ dbBean.close(); return true; } } dbBean.close(); }catch(Exception e){ return false; } return true; }//核对该操作员的密码是否正确,返回"假"密码不正确,返回“真”正确 public boolean checkLoginPassword(String id,String password) throws Exception, SQLException{ try{ DbBean dbBean = new DbBean(); ResultSet resultSet; String sql = "select password from news where id = '" + id+"'";System.out.println("CheckLoginPasswordSql========"+sql); resultSet = dbBean.execQuery(sql); while(resultSet.next()){ if (resultSet.getString(1).equals(password)){ dbBean.close(); return true; }else{ dbBean.close(); return false; } } dbBean.close(); }catch(Exception e){ return false; } return true; }//提取登陆操作员信息 public RowSet selectLoginUser(String id) throws Exception{ try{ DbBean dbBean = new DbBean(); ResultSet resultSet; CachedRowSet cachedRowSet = new CachedRowSet(); String sql = "select TBADMINISTRATOR.NAME USERNAME,TBADMINISTRATOR.WORKGROUPID GROUPID,TBADMINISTRATOR.WORKROLEID ROLEID,TBADMINISTRATOR.ID USERID,substr(TBADMINISTRATOR.ID,1,8) CORID,TBGROUP.NAME GROUPNAME,TBCORPORATION.CORNAME CORNAME from TBADMINISTRATOR,TBGROUP,TBCORPORATION where TBADMINISTRATOR.WORKGROUPID = TBGROUP.ID and substr(TBADMINISTRATOR.ID,1,8) = TBCORPORATION.CORID and TBADMINISTRATOR.WORKROLEID = TBSYSTEMPARAMETER.VALUE and TBADMINISTRATOR.ID = '"+id+"'";System.out.println("SelectLoginSql========"+sql); resultSet = dbBean.execQuery(sql); cachedRowSet.populate(resultSet); dbBean.close(); return cachedRowSet; }catch(Exception e){ return null; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -