日期:2014-05-16  浏览次数:20420 次

ibatis的批量插入DAO实例
public void insertVarMailTabData(final List varList) throws PafaDAOException {
this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
            public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
                executor.startBatch();
                for (int i = 0; i < varList.size(); i++) {
                EmailtempVariableDTO evDto = (EmailtempVariableDTO) varList.get(i);
                    executor.insert("insertVarMailTabData", evDto);
                }
                executor.executeBatch();
                return null;
            }
        });

}
其他文件无需任何改动





<select id="searchCheckupUseInfoRecord"  parameterClass="com.palic.ehis.checkup.dto.biz.CheckupUseInfoDTO" resultClass="com.palic.ehis.checkup.dto.biz.CheckupUseInfoDTO">
     <isEqual  property="businessCode" compareValue="03">    
     select hcci.health_check_card_no healthCheckCardNo,
       '健康通卡' businessType,
       '' customerNo,
       '' polNo,
       '' certNo,
       hcc.customer_no insCustomerNo,
       hcc.customer_name insCustomerName,
       st.full_name insGender,
       mst.full_name insMaritalStatus,
       it.full_name insCertificateType,
       hcc.certificate_no insCertificateNo,
       '' healthCheckPackageId,
       '' healthCheckPackage,
       hhi.hospital_id hospitalId,
       hhi.hospital_name hospitalName,
       0 settlementAmount,
       hcci.health_check_date healthCheckDate,
       hcci.health_check_date markDate,
       hcst.full_name cardStatu,
       pt.full_name || ct.full_name hospitalAddress,
       hcmst.full_name markSourceCode,
       '' officePosition,
       '' vipCustomerNo,
       '' vipCustomerName,
       '' vipCertificateTypeCode,
       '' vipCertificateNo,
       '' customerCompany,
       0 crossCompanyNum,
       '总部' regionName,
       '' customerGradeLevel,
       null applyDate
  from health_check_card_info hcci