日期:2014-05-17 浏览次数:20883 次
public static final BigDecimal BATCH_STATUS1 = BigDecimal.valueOf(1); // 等待上传
public static EmSalaryBatchPK create(EmSalaryBatchVO pEmSalaryBatchVO) throws Exception {
PreparedStatement pst = null;
ResultSet rs = null;
String sql = null;
Connection conn = null;
EmSalaryBatchPK pk = null;
try {
conn = DBUtil.getConnection();
sql = "insert into em_salary_batch (BATCH_ID,HALL_CODE,SALARY_MONTH,INSERT_USER,INSERT_TIME,STATUS) values (?,?,?,?,sysdate,?)";
pst = conn.prepareStatement(sql);
int pos = 1;
pst.setLong( pos++ , pEmSalaryBatchVO.getBatchId());
pst.setString( pos++ , pEmSalaryBatchVO.getHallCode());
pst.setString( pos++ , pEmSalaryBatchVO.getSalaryMonth());
pst.setBigDecimal( pos++ , pEmSalaryBatchVO.getInsertUsr());
pst.setBigDecimal( pos++ ,BATCH_STATUS1 );
log.info("EmSalaryBatchDAO.算薪状态:" + BATCH_STATUS1);
int nRow = pst.executeUpdate();
if (nRow != 1) {
String error = "DAOCreate: EmSalaryBatchDAO("
+ pEmSalaryBatchVO.toString() + ") not found";
throw new Exception(error);
}
} catch (Exception e) {
log.error("DAO Create Error", e);
throw e;
} finally {
DBUtil.close(rs, pst, conn);
}
pk = new EmSalaryBatchPK(pEmSalaryBatchVO.getBatchId());
return pk;
}