📄 emailinfordelete.java
字号:
package com.comingnet.bean;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import com.db.DBUtils;
public class EmailInforDelete {
private Connection conn ;
private PreparedStatement pstmt;
private ResultSet rs ;
private Statement stmt ;
//判断是否有关联的
public int getCountOfyjsj(int yjid){
int count = 0;
String sqlStr = "select count(*) from yjsj where yjid = ? " ;
try {
conn = DBUtils.getConnection();
pstmt = conn.prepareStatement(sqlStr);
pstmt.setInt(1, yjid) ;
rs = pstmt.executeQuery() ;
while(rs.next()){
count = rs.getInt(1) ;
}
DBUtils.closeResultSet(rs) ;
DBUtils.closeStatement(pstmt);
} catch (Exception e) {
System.out.println("EmailInforDelete.getCountOfyjsj----->" + e);
} finally {
DBUtils.closeResultSet(rs) ;
DBUtils.closeStatement(pstmt);
DBUtils.closeConnection(conn);
}
return count ;
}
public boolean moveFolder(int rywjj,int sjid) {
boolean flag = false;
String sqlStr = "update yjsj set rywjj=? where sjid=? ";
try {
conn = DBUtils.getConnection();
pstmt = conn.prepareStatement(sqlStr);
pstmt.setInt(1, rywjj) ;
pstmt.setInt(2, sjid) ;
pstmt.executeUpdate() ;
flag = true ;
DBUtils.closeStatement(pstmt);
} catch (Exception e) {
System.out.println("EmailInforDelete.LogicDelete----->" + e);
return flag ;
} finally {
DBUtils.closeStatement(pstmt);
DBUtils.closeConnection(conn);
}
return flag;
}
public boolean yjsjPhysicalDelete(int sjid) {
boolean flag = false;
String sqlStr = "delete yjsj where sjid=? ";
try {
conn = DBUtils.getConnection();
pstmt = conn.prepareStatement(sqlStr);
pstmt.setInt(1, sjid) ;
pstmt.executeUpdate() ;
flag = true ;
DBUtils.closeStatement(pstmt);
} catch (Exception e) {
System.out.println("EmailInforDelete.yjsjPhysicalDelete----->" + e);
return flag ;
} finally {
DBUtils.closeStatement(pstmt);
DBUtils.closeConnection(conn);
}
return flag;
}
public boolean PhisicalDelete(int yjid,int sjid){
boolean flag = false;
String sqlStr1 = "delete yjxx where yjid = '"+yjid+"'";
String sqlStr2 = "delete yjsj where sjid= '"+sjid+"'";
Connection conn1 = null ;
try {
conn1 = DBUtils.getConnection();
conn1.setAutoCommit(false) ;
stmt = conn1.createStatement() ;
stmt.executeUpdate(sqlStr1) ;
stmt.executeUpdate(sqlStr2) ;
conn1.commit() ;
flag = true ;
DBUtils.closeStatement(pstmt);
} catch (Exception e) {
System.out.println("EmailInforDelete.yjxxPhisicalDelete----->" + e);
return flag ;
} finally {
DBUtils.closeStatement(pstmt);
DBUtils.closeConnection(conn1);
}
return flag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -