knu project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

93 lines
3.0 KiB

/*************************************************************************************************
* 프로그램명 : MemoQuery.java 프로그램설명 : assign 테이블 관련 쿼리 작성자 : 작성일 : 변경일 :
**************************************************************************************************/
package kr.co.kihyun.beans.totsys.memo;
import java.sql.ResultSet;
import java.sql.SQLException;
import kr.co.kihyun.beans.entity.MoumiEntity;
import kr.co.kihyun.beans.entity.TotReport;
import kr.co.kihyun.db.DBManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MemoQuery extends DBManager {
private static final Logger LOG = LoggerFactory.getLogger(MemoQuery.class);
private ResultSet rs = null;
public int reProcess(Long docID, int prss) {// 재진행
StringBuilder sql = new StringBuilder(90);
int count = 0;
try {
sql.append("select count(user_id) from ").append(MoumiEntity.getTableName(TotReport.class))
.append(" where doc_id=? and prss=?");
rs = execQuery(sql.toString(), docID, prss);
if (rs.next()) {
count = rs.getInt(1);
}
return count;
} catch (SQLException sqlEx) {
LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
throw new RuntimeException(sqlEx);
} catch (Exception ex) {
throw new RuntimeException(ex);
} finally {
close(rs);
execClose();
}
}
public int reProcess(Long docID, int prss, String userID, Long deptID) {// 재진행
StringBuilder sql = new StringBuilder(120);
int count = 0;
try {
sql.append("select count(user_id) from ").append(MoumiEntity.getTableName(TotReport.class))
.append(" where doc_id=? and prss=? and user_id=? and dept_id=?");
rs = execQuery(sql.toString(), docID, prss, userID, deptID);
if (rs.next()) {
count = rs.getInt(1);
}
return count;
} catch (SQLException sqlEx) {
LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
throw new RuntimeException(sqlEx);
} catch (Exception ex) {
throw new RuntimeException(ex);
} finally {
close(rs);
execClose();
}
}
public int reRecog(Long docID, String userID, Long deptID) {// 반려
StringBuilder sql = new StringBuilder(90);
int recog = 0;
try {
sql.append("select recog from ").append(MoumiEntity.getTableName(TotReport.class))
.append(" where doc_id=? and user_id=? and dept_id=?");
rs = execQuery(sql.toString(), docID, userID, deptID);
if (rs.next()) {
recog = rs.getInt(1);
}
return recog;
} catch (SQLException sqlEx) {
LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
throw new RuntimeException(sqlEx);
} catch (Exception ex) {
throw new RuntimeException(ex);
} finally {
close(rs);
execClose();
}
}
}