📄 auryselectdao.java
字号:
package com.comingnet.bean;
import com.db.*;
import java.sql.*;
import java.util.*;
public class AurySelectDAO {
Connection conn=null;
PreparedStatement stmt=null;
ResultSet rs=null;
public AurySelectDAO()
{
}
public ArrayList<AurySelect> getAuryList(String userclass,int xxbh)
{
ArrayList<AurySelect> ary=new ArrayList<AurySelect>();
AurySelect auryselect=null;
String sqlStr="";
if(userclass.equals("1"))
{
sqlStr="select jsxm,jsid,1 as userclass from m_teacher where xxbh=?";
}else if(userclass.equals("2"))
{
sqlStr="select xsxm,xsid,2 as userclass from m_student where xxbh=?";
}
try
{
conn=DBUtils.getConnection();
stmt=conn.prepareStatement(sqlStr);
stmt.setInt(1,xxbh);
rs=stmt.executeQuery();
while(rs.next())
{
auryselect=new AurySelect();
auryselect.setUserxm(rs.getString(1));
auryselect.setUserid(rs.getInt(2));
auryselect.setUserclass(rs.getString(3));
ary.add(auryselect);
}
}catch(Exception e)
{
System.out.println("AurySelectDAO:"+e);
}finally
{
DBUtils.closeResultSet(rs);
DBUtils.closeStatement(stmt);
DBUtils.closeConnection(conn);
}
return ary;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -