📄 userinfodao.java
字号:
package edu.yinhe.mis.model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.mysql.jdbc.ResultSet;
import edu.yinhe.mis.dto.CardDTO;
import edu.yinhe.mis.dto.UserinfoDTO;
import edu.yinhe.system.model.BaseDAO;
public class UserinfoDAO extends BaseDAO {
public Object delete(Object arg0) throws SQLException {
boolean falg = false;
String SQL = null;
PreparedStatement ps = null;
SQL = "DELETE FROM userinfo WHERE STU_NO=?";
ps = conn.prepareStatement(SQL);
ps.executeUpdate();
falg = true;
if (ps != null) {
ps.close();
}
return falg;
}
public Object find() throws SQLException {
// TODO Auto-generated method stub
return null;
}
public Object find(Object arg0) throws SQLException {
// TODO Auto-generated method stub
return null;
}
public Object findAll() throws SQLException {
// TODO Auto-generated method stub
return null;
}
public Object findAll(Object arg0) throws SQLException {
// TODO Auto-generated method stub
return null;
}
public Object findById(Object arg0) throws SQLException {
// TODO Auto-generated method stub
return null;
}
public Object findByObject(Object arg0) throws SQLException {
// TODO Auto-generated method stub
return null;
}
public int getCount(Object arg0) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
public Object getMaxId(Object arg0) throws SQLException {
// TODO Auto-generated method stub
return null;
}
public Object insert(Object arg0) throws SQLException {
boolean flag = false;
int ok = 0;
PreparedStatement ps = null;
UserinfoDTO udto = (UserinfoDTO)arg0;
String SQL = null;
int nIndex=1;
SQL = "INSERT INTO bbsuserinfo(STU_NO,STU_NAME,BBS_POINT,PIC,IDIOGRAPH,SEND_COUNTS,REVERT_COUNTS) VALUES(?,?,?,?,?,?,?)";
ps = conn.prepareStatement(SQL);
ps.setInt(nIndex++, udto.getSTU_NO());
ps.setString(nIndex++, udto.getSTU_NAME());
ps.setString(nIndex++, udto.getBBS_POINT());
ps.setString(nIndex++, udto.getPIC());
ps.setString(nIndex++, udto.getIDIOGRAPH());
ps.setInt(nIndex++, udto.getSEND_COUNTS());
ps.setInt(nIndex++, udto.getREVERT_COUNTS());
ok = ps.executeUpdate();
if(ok!=-1)
flag = true;
return flag;
}
public Object update(Object arg0) throws SQLException {
boolean falg = false;
PreparedStatement ps = null;
UserinfoDTO udto = new UserinfoDTO();
String SQL = null;
int nIndex=1;
SQL = "UPDATE bbsuserinfo SET STU_NAME=?,BBS_POINT=?,PIC=?,IDIOGRAPH=?,SEND_COUNTS=?,REVERT_COUNTS=? WHERE ID=STU_NO?";
ps = conn.prepareStatement(SQL);
ps.setString(nIndex++, udto.getSTU_NAME());
ps.setString(nIndex++, udto.getBBS_POINT());
ps.setString(nIndex++, udto.getPIC());
ps.setString(nIndex++, udto.getIDIOGRAPH());
ps.setInt(nIndex++, udto.getSEND_COUNTS());
ps.setInt(nIndex++, udto.getREVERT_COUNTS());
ps.setInt(nIndex++, udto.getSTU_NO());
ps.executeUpdate();
falg = true;
if (ps != null) {
ps.close();
}
SQL = null;
return falg;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -