/** * 引入明细信息 * 访问资源:ECC_EPM.EPM_TBL_CONTRACT_DETAIL,ECC_EPM.EPM_TBL_SUBCONTRACT_DISPATCH * * @param detailsBO * @return int * @roseuid 4BA1C4E103C5 */ public int inductDetailsInfo(DetailsBO detailsBO) throws EccInfoException { int result = -1; // JDBC兄弟 PreparedStatement pstmt = null; Connection conn = BaseDAO.getConnection(); try { //关闭事务自动提交 conn.setAutoCommit(false); // 因采取直接查询之后插入的SQL有错误,现修改为,JDBC的批量提交方式 StringBuffer sql = new StringBuffer(); sql.append("INSERT INTO ECC_EPM.EPM_TBL_CONTRACT_DETAIL "); sql.append("(OID,CONTRACT_ID,ITEM_NAME,DATA_TYPE,ITEM_TYPE,DISCTRIPTION, "); sql.append("UNIT,NUM,PRICE,REMARK,ENABLE_FLAG,CONTRACT_ITEM_ID,DISPATCH_CONTRACT_ITEM_ID, "); sql.append("CREATED_BY,CREATED_DATE,LAST_UPDATED_BY,LAST_UPDATED_DATE) "); sql.append("VALUES (ECC_EPM.SUB_PERSONNEL_EVALUE_INFO_S.NEXTVAL, "); sql.append(" ?,?,?,?,?,?,?,?,?,'T',?,?,?,SYSDATE,?,SYSDATE)"); pstmt = conn.prepareStatement(sql.toString()); // 得到VO DetailsVO detailsVO = detailsBO.getDetailsVO(); // 根据选择的OID,获取相关的信息 List<DetailsVO> tempList = (List)this.getSqlMapClientTemplate().queryForList("DetailsDAO.queryInductDetails", detailsBO); // 如果结果列表不为空 if(null != tempList && tempList.size() > 0) { DetailsVO tempVO = null; // 遍历列表,取出相关信息 for(int i = 0,j = tempList.size(); i < j; i++) { int k = 1; // 从列表中取值 tempVO = tempList.get(i); // 附值 pstmt.setLong(k++, detailsBO.getObjectOid()); pstmt.setString(k++, tempVO.getDetailName()); pstmt.setString(k++, detailsVO.getDataType()); pstmt.setString(k++, detailsVO.getItemType()); pstmt.setString(k++, tempVO.getDetailDesc()); pstmt.setString(k++, tempVO.getDetailUnit()); pstmt.setString(k++, tempVO.getDetailNum()); pstmt.setString(k++, tempVO.getDetailPrice()); pstmt.setString(k++, tempVO.getDetailRemark()); pstmt.setLong(k++, tempVO.getOid()); pstmt.setLong(k++, tempVO.getContractItemId()); pstmt.setLong(k++, detailsVO.getCreatedBy()); pstmt.setLong(k++, detailsVO.getLastUpdatedBy()); pstmt.addBatch(); } // 批量执行 pstmt.executeBatch(); } //语句执行完毕,提交本事务 conn.commit(); // 引入条目明细 //result = (Integer)this.getSqlMapClientTemplate().insert("DetailsDAO.inductDetails", detailsBO); } catch (Exception ex) { try { conn.rollback(); } catch (SQLException e1) { Debug.error(e1.toString()); } PmInfoException.throwPmInfoException(EccExceptionComm.ERROR_LAYER_DAO, getClass().getName(), ex); } finally { BaseDAO.closeAll(null, pstmt, conn); } return result; }