首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

ibatis的批量安插DAO实例

2012-08-11 
ibatis的批量插入DAO实例public void insertVarMailTabData(final List varList) throws PafaDAOException

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"  parameterresultcompareValue="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"));
}

热点排行