`
vbtboy
  • 浏览: 47905 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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
  left join health_check_card_customer hcc on hcc.customer_id =
                                              hcci.customer_id
  left join customer insc on insc.CUSTOMER_NO = hcc.customer_no
  left join person insp on insp.CUSTOMER_NO = hcc.customer_no
  left join health_hospital_info hhi on hhi.hospital_id = hcc.hospital_id
  left join province_tbl pt on pt.provinceno = hhi.province_code
  left join city_table ct on ct.city_code = hhi.city_code
  left join sex_tbl st on st.sex = hcc.gender_code
  left join mari_sts_tbl mst on mst.mari_sts = hcc.married
  left join id_type_tbl it on it.id_type = hcc.CERTIFICATE_TYPE_CODE
  left join health_check_card_status_tbl hcst on hcst.card_status_code =
                                                 hcci.card_status_code
  left join health_ck_card_mark_source_tbl hcmst on hcmst.mark_source_code =
                                                    hcci.mark_source_code  
  </isEqual>
<isEqual  property="businessCode" compareValue="03">
    <isNotEmpty prepend="AND" property="businessStatus">
        hcci.card_status_code = #businessStatus#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="hospitalId">
        hhi.hospital_id = #hospitalId#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="polNo">
        hhi.hospital_id = #polNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="certNo">
        hhi.hospital_id = #certNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="provinceCode">
        hhi.province_code = #provinceCode#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="cityCode">
        hhi.city_code = #cityCode#
        </isNotEmpty>        
        </isEqual>                        
        <isEqual  property="businessCode" compareValue="02">             
        select coc.health_check_card_no healthCheckCardNo,
       '集团VIP体检' businessType,
       hcco.customer_no customerNo,
       '' polNo,
       '' certNo,
       hcc.customer_no insCustomerNo,
       insc.CUSTOMER_NAME insCustomerName,
       st.full_name insGender,
       mst.full_name insMaritalStatus,
       it.full_name insCertificateType,
       insp.CERTIFICATE_NO insCertificateNo,
       '' healthCheckPackageId,
       hcco.health_check_packge healthCheckPackage,
       hhi.hospital_id hospitalId,
       hhi.hospital_name hospitalName,
       0 settlementAmount,      
       hcco.health_check_date healthCheckDate,
       hcco.updated_date markDate,
       hvst.full_name cardStatu,
       pt.full_name||ct.full_name hospitalAddress,
       hcmst.full_name markSourceCode,
       '' officePosition,
       c.CUSTOMER_NO vipCustomerNo,
       c.CUSTOMER_NAME vipCustomerName,
       p.CERTIFICATE_TYPE_CODE vipCertificateTypeCode,
       p.CERTIFICATE_NO vipCertificateNo,
       '' customerCompany,
       0 crossCompanyNum,
       '总部' regionName,
       hcgt.full_name customerGradeLevel,
       hcco.apply_date applyDate
  from health_check_card_order hcco
  left join customer_order_card_relation coc on coc.service_order_no =  hcco.service_order_no
  left join health_check_card_customer hcc on hcc.customer_id =  hcco.customer_id
  left join customer c on c.CUSTOMER_NO = hcco.customer_no
  left join person p on p.CUSTOMER_NO = hcco.customer_no
  left join customer insc on insc.CUSTOMER_NO = hcc.customer_no
  left join person insp on insp.CUSTOMER_NO = hcc.customer_no
  left join health_virtual_card_info hvc on hvc.card_no = coc.health_check_card_no
  left join health_hospital_info hhi on hhi.hospital_id = hcco.hospital_id
  left join province_tbl pt on pt.provinceno = hhi.province_code
  left join city_table ct on ct.city_code = hhi.city_code
  left join sex_tbl st on st.sex = insp.gender_code
  left join id_type_tbl it on it.id_type = insp.CERTIFICATE_TYPE_CODE
  left join mari_sts_tbl mst on mst.mari_sts = hcc.married
  left join health_virtual_card_status_tbl hvst on hvst.card_status_code = hvc.card_status_code
  left join health_ck_card_mark_source_tbl hcmst on hcmst.mark_source_code = hvc.mark_source_code
  left join health_ck_customer_grade_tbl hcgt on hcgt.customer_grade_level = hcco.customer_grade_level  
  </isEqual>   
<isEqual  property="businessCode" compareValue="02">
    <isNotEmpty prepend="AND" property="businessStatus">
        hvst.card_status_code = #businessStatus#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="hospitalId">
        hcco.hospital_id = #hospitalId#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="polNo">
        hcco.hospital_id = #polNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="certNo">
        hcco.hospital_id = #certNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="provinceCode">
        hhi.province_code = #provinceCode#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="cityCode">
        hhi.city_code = #cityCode#
        </isNotEmpty>        
        </isEqual>                        
        <isEqual  property="businessCode" compareValue="01">          
        select hcud.settle_no healthCheckCardNo,
       '集团员工体检' businessType,
       '' customerNo,
       hcum.polno polno,
       hcum.certno certNo,
       '' insCustomerNo,
       hcud.client_name insCustomerName,
       st.full_name insGender,
       mst.full_name insMaritalStatus,
       it.full_name insCertificateType,
       hcud.certificate_no insCertificateNo,
       '' healthCheckPackageId,
       '' healthCheckPackage,
       hcum.hospital_id hospitalId,
       hhi.hospital_name hospitalName,
       0 settlementAmount,
       null healthCheckDate,
       null markDate,
       ssct.full_name cardStatu,
       pt.full_name || ct.full_name hospitalAddress,
       '' markSourceCode,
       '' officePosition,
       '' vipCustomerNo,
       '' vipCustomerName,
       '' vipCertificateTypeCode,
       '' vipCertificateNo,
       '' customerCompany,
       0 crossCompanyNum,
       '总部' regionName,
      '' customerGradeLevel,
      null applyDate
  from hcs_cklist_upload_detail hcud, hcs_checklist_upload_main hcum,sex_tbl st ,mari_sts_tbl mst,id_type_tbl it, health_hospital_info hhi,
  SETTLE_STATUS_CODE_TBL ssct,province_tbl pt,city_table ct
  where hcud.hcs_checklist_upload_id = hcum.hcs_checklist_upload_id
  and  st.sex(+) = hcud.gender_code
  and  mst.mari_sts(+) = hcud.is_marriage
  and  it.id_type(+) = hcud.certificate_type_code
  and hhi.hospital_id(+) = hcum.hospital_id
  and ssct.settle_status_code(+) =hcud.settle_status_code
  and pt.provinceno(+) = hhi.province_code
  and ct.city_code(+)= hhi.city_code   
  </isEqual>   
  <isEqual  property="businessCode" compareValue="01">
    <isNotEmpty prepend="AND" property="businessStatus">
        hcud.settle_status_code = #businessStatus#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="hospitalId">
        hcum.hospital_id = #hospitalId#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="polNo">
        hcum.polno = #polNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="certNo">
        hcum.certno = #certNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="provinceCode">
        hhi.province_code = #provinceCode#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="cityCode">
        hhi.city_code = #cityCode#
        </isNotEmpty>        
        </isEqual> 
       
       
       
        <isEqual  property="businessCode" compareValue="00">
       
     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
  left join health_check_card_customer hcc on hcc.customer_id =
                                              hcci.customer_id
  left join customer insc on insc.CUSTOMER_NO = hcc.customer_no
  left join person insp on insp.CUSTOMER_NO = hcc.customer_no
  left join health_hospital_info hhi on hhi.hospital_id = hcc.hospital_id
  left join province_tbl pt on pt.provinceno = hhi.province_code
  left join city_table ct on ct.city_code = hhi.city_code
  left join sex_tbl st on st.sex = hcc.gender_code
  left join mari_sts_tbl mst on mst.mari_sts = hcc.married
  left join id_type_tbl it on it.id_type = hcc.CERTIFICATE_TYPE_CODE
  left join health_check_card_status_tbl hcst on hcst.card_status_code =
                                                 hcci.card_status_code
  left join health_ck_card_mark_source_tbl hcmst on hcmst.mark_source_code =
                                                    hcci.mark_source_code  
  </isEqual>
<isEqual  property="businessCode" compareValue="00">
<isEqual  property="businessStatus" compareValue="040306">
hcci.card_status_code = '06'
</isEqual>
<isEqual  property="businessStatus" compareValue="0205">
hcci.card_status_code = '05'
</isEqual>
<isEqual  property="businessStatus" compareValue="04">
hcci.card_status_code = '04'
</isEqual>    
        <isNotEmpty prepend="AND" property="hospitalId">
        hhi.hospital_id = #hospitalId#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="polNo">
        hhi.hospital_id = #polNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="certNo">
        hhi.hospital_id = #certNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="provinceCode">
        hhi.province_code = #provinceCode#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="cityCode">
        hhi.city_code = #cityCode#
        </isNotEmpty>        
        </isEqual>                        
        union all
        select coc.health_check_card_no healthCheckCardNo,
       '集团VIP体检' businessType,
       hcco.customer_no customerNo,
       '' polNo,
       '' certNo,
       hcc.customer_no insCustomerNo,
       insc.CUSTOMER_NAME insCustomerName,
       st.full_name insGender,
       mst.full_name insMaritalStatus,
       it.full_name insCertificateType,
       insp.CERTIFICATE_NO insCertificateNo,
       '' healthCheckPackageId,
       hcco.health_check_packge healthCheckPackage,
       hhi.hospital_id hospitalId,
       hhi.hospital_name hospitalName,
       0 settlementAmount,      
       hcco.health_check_date healthCheckDate,
       hcco.updated_date markDate,
       hvst.full_name cardStatu,
       pt.full_name||ct.full_name hospitalAddress,
       hcmst.full_name markSourceCode,
       '' officePosition,
       c.CUSTOMER_NO vipCustomerNo,
       c.CUSTOMER_NAME vipCustomerName,
       p.CERTIFICATE_TYPE_CODE vipCertificateTypeCode,
       p.CERTIFICATE_NO vipCertificateNo,
       '' customerCompany,
       0 crossCompanyNum,
       '总部' regionName,
       hcgt.full_name customerGradeLevel,
       hcco.apply_date applyDate
  from health_check_card_order hcco
  left join customer_order_card_relation coc on coc.service_order_no =  hcco.service_order_no
  left join health_check_card_customer hcc on hcc.customer_id =  hcco.customer_id
  left join customer c on c.CUSTOMER_NO = hcco.customer_no
  left join person p on p.CUSTOMER_NO = hcco.customer_no
  left join customer insc on insc.CUSTOMER_NO = hcc.customer_no
  left join person insp on insp.CUSTOMER_NO = hcc.customer_no
  left join health_virtual_card_info hvc on hvc.card_no = coc.health_check_card_no
  left join health_hospital_info hhi on hhi.hospital_id = hcco.hospital_id
  left join province_tbl pt on pt.provinceno = hhi.province_code
  left join city_table ct on ct.city_code = hhi.city_code
  left join sex_tbl st on st.sex = insp.gender_code
  left join id_type_tbl it on it.id_type = insp.CERTIFICATE_TYPE_CODE
  left join mari_sts_tbl mst on mst.mari_sts = hcc.married
  left join health_virtual_card_status_tbl hvst on hvst.card_status_code = hvc.card_status_code
  left join health_ck_card_mark_source_tbl hcmst on hcmst.mark_source_code = hvc.mark_source_code
  left join health_ck_customer_grade_tbl hcgt on hcgt.customer_grade_level = hcco.customer_grade_level      
<isEqual  property="businessCode" compareValue="00">
<isEqual  property="businessStatus" compareValue="0201">
and hvst.card_status_code = '01'
</isEqual>
<isEqual  property="businessStatus" compareValue="040306">
and hvst.card_status_code = '03'
</isEqual>
<isEqual  property="businessStatus" compareValue="0205">
and hvst.card_status_code = '05'
</isEqual>    
        <isNotEmpty prepend="AND" property="hospitalId">
        hcco.hospital_id = #hospitalId#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="polNo">
        hcco.hospital_id = #polNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="certNo">
        hcco.hospital_id = #certNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="provinceCode">
        hhi.province_code = #provinceCode#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="cityCode">
        hhi.city_code = #cityCode#
        </isNotEmpty>        
        </isEqual>
        <isEqual  property="businessStatus" compareValue="01">
        union all
        </isEqual>
        <isEqual  property="businessStatus" compareValue="03">
        union all
        </isEqual>                                           
        select hcud.settle_no healthCheckCardNo,
       '集团员工体检' businessType,
       '' customerNo,
       hcum.polno polno,
       hcum.certno certNo,
       '' insCustomerNo,
       hcud.client_name insCustomerName,
       st.full_name insGender,
       mst.full_name insMaritalStatus,
       it.full_name insCertificateType,
       hcud.certificate_no insCertificateNo,
       '' healthCheckPackageId,
       '' healthCheckPackage,
       hcum.hospital_id hospitalId,
       hhi.hospital_name hospitalName,
       0 settlementAmount,
       null healthCheckDate,
       null markDate,
       ssct.full_name cardStatu,
       pt.full_name || ct.full_name hospitalAddress,
       '' markSourceCode,
       '' officePosition,
       '' vipCustomerNo,
       '' vipCustomerName,
       '' vipCertificateTypeCode,
       '' vipCertificateNo,
       '' customerCompany,
       0 crossCompanyNum,
       '总部' regionName,
      '' customerGradeLevel,
      null applyDate
  from hcs_cklist_upload_detail hcud, hcs_checklist_upload_main hcum,sex_tbl st ,mari_sts_tbl mst,id_type_tbl it, health_hospital_info hhi,
  SETTLE_STATUS_CODE_TBL ssct,province_tbl pt,city_table ct
  where hcud.hcs_checklist_upload_id = hcum.hcs_checklist_upload_id
  and  st.sex(+) = hcud.gender_code
  and  mst.mari_sts(+) = hcud.is_marriage
  and  it.id_type(+) = hcud.certificate_type_code
  and hhi.hospital_id(+) = hcum.hospital_id
  and ssct.settle_status_code(+) =hcud.settle_status_code
  and pt.provinceno(+) = hhi.province_code
  and ct.city_code(+)= hhi.city_code        
  <isEqual  property="businessCode" compareValue="00">
  <isEqual  property="businessStatus" compareValue="01">
hcud.settle_status_code = '01'
</isEqual>
<isEqual  property="businessStatus" compareValue="03">
hcud.settle_status_code = '03'
</isEqual>
<isEqual  property="businessStatus" compareValue="0201">
hcud.settle_status_code = '02'
</isEqual>
<isEqual  property="businessStatus" compareValue="040306">
hcud.settle_status_code = '04'
</isEqual>        
        <isNotEmpty prepend="AND" property="hospitalId">
        hcum.hospital_id = #hospitalId#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="polNo">
        hcum.polno = #polNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="certNo">
        hcum.certno = #certNo#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="provinceCode">
        hhi.province_code = #provinceCode#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="cityCode">
        hhi.city_code = #cityCode#
        </isNotEmpty>        
        </isEqual>
                                                                     
     </select>


if(selValue=='00'){
objSelect.options.add(new Option("有效","01"));//集团员工体检
objSelect.options.add(new Option("未使用","0201"));//集团员工体检 -02集团VIP体检-01
objSelect.options.add(new Option("已使用","03"));//集团员工体检
objSelect.options.add(new Option("已结算","040306"));//集团员工体检-04集团VIP体检-03健康通卡-06
objSelect.options.add(new Option("已标注","0205"));//集团VIP体检 -02健康通卡-05
objSelect.options.add(new Option("已收费","04"));//健康通卡
}else if(selValue=='01'){ //集团员工体检
objSelect.options.add(new Option("有效","01"));
objSelect.options.add(new Option("未使用","02"));
objSelect.options.add(new Option("已使用","03"));
objSelect.options.add(new Option("已结算","04"));
}else if(selValue=='02'){ //集团VIP体检
objSelect.options.add(new Option("未使用","01"));
objSelect.options.add(new Option("已标注","02"));
objSelect.options.add(new Option("已结算","03"));
}else if(selValue=='03'){ //健康通卡
objSelect.options.add(new Option("已收费","04"));
objSelect.options.add(new Option("已标注","05"));
objSelect.options.add(new Option("已结算","06"));
}
分享到:
评论

相关推荐

    ibatis2.3.4.726增删改查源码实例

    在本实例中,"ibatis2.3.4.726增删改查源码实例" 提供了一个完整的基于Ibatis 2.3.4.726版本的开发案例,涵盖了数据库的基本操作,即增(INSERT)、删(DELETE)、改(UPDATE)和查(SELECT)。 首先,我们来了解...

    ibatis 完美例子 一对多 批处理 事务 和 spring struts2集成

    在Ibatis中,可以通过设置SqlSession的flushCache和useCache属性,以及使用批处理执行器ExecutorType.BATCH,来实现批量插入、更新或删除。例如,在插入1万条数据时,将这些操作放在同一个SqlSession中,而不是逐一...

    iBATIS实战

    10.4.1 配置iBATIS DAO 186 10.4.2 创建DaoManager实例 187 10.4.3 定义事务管理器 187 10.4.4 加载映射 188 10.4.5 DAO实现编码 191 10.5 小结 193 第11章 DAO使用进阶 194 11.1 不是基于SQLMap的DAO实现 194 ...

    iBatis 轻量级持久层架构

    这样,Spring会自动管理iBatis的生命周期,并在需要时注入DAO实例。 2. **iBatis调用存储过程**: iBatis允许开发者直接调用数据库的存储过程。在XML映射文件中,使用`&lt;procedure&gt;`标签来定义存储过程的调用,指定...

    J2EE核心模式之DAO(简体中文)

    DAO模式常常与其他设计模式结合使用,如工厂模式用于创建DAO实例,策略模式用于动态选择不同的数据访问策略,以及代理模式来实现事务管理或缓存功能。 9. **最佳实践** 实现DAO时,应遵循一些最佳实践,如避免在...

    ibatis2讲义

    批处理是提高性能的一种有效手段,尤其在批量插入、更新大量数据时。IBATIS支持通过一次调用执行多个SQL语句,从而减少网络开销。 #### 11. 动态SQL 动态SQL是IBATIS的一个强大特性,允许在运行时动态生成SQL语句...

    iBATIS-3-User-Guide

    - **iBATIS**:iBATIS 是一个开放源代码的框架,用于简化 Java 应用程序中的数据库访问层(DAO)开发工作。它将 SQL 命令与 Java 代码分离,并通过 XML 配置文件来管理 SQL 映射,从而简化了 JDBC 的复杂性。 #### ...

    mybatis详细介绍,特点,特性,用途,使用方法,学习方法文档

    5. **高级功能支持**:如存储过程支持、分页查询、批量插入等高级功能,让 MyBatis 成为了处理复杂数据库操作的理想选择。 ### 使用方法详解 1. **配置数据源**:首先需要在配置文件中设置数据库连接信息,包括 ...

    Spring中文帮助文档

    12.5.3. 基于原生的iBATIS API的DAO实现 12.6. JPA 12.6.1. 在Spring环境中建立JPA 12.6.2. JpaTemplate 和 JpaDaoSupport 12.6.3. 基于原生的JPA实现DAO 12.6.4. 异常转化 12.7. 事务管理 12.8. JpaDialect ...

    Spring API

    12.5.3. 基于原生的iBATIS API的DAO实现 12.6. JPA 12.6.1. 在Spring环境中建立JPA 12.6.2. JpaTemplate 和 JpaDaoSupport 12.6.3. 基于原生的JPA实现DAO 12.6.4. 异常转化 12.7. 事务管理 12.8. JpaDialect ...

    框架面试笔试问答题.docx

    MyBatis批量插入代码 ```java List, Object&gt;&gt; list = new ArrayList(); // 填充list sqlSession.insert("com.example.mapper.UserMapper.batchInsert", list); ``` #### 24. Spring中定时任务的使用 - **@...

Global site tag (gtag.js) - Google Analytics