<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.5.2</version>
</dependency>
spring:
datasource:
dynamic:
primary: ds1 #设置默认的数据源或者数据源组,默认值即为master
strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
ds1: # X2会员档案
url: jdbc:oracle:thin:@152.80.196.29:1523:orcl
username: a_gls_10247622
password: 123456
driver-class-name: oracle.jdbc.driver.OracleDriver
ds2: # Erp数据库
url: jdbc:mysql://181.179.241.251:3309/ellassay_erp
username: gaojiufeng
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
configuration:
map-underscore-to-camel-case: false
package com.ellassay.x2.sync.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
}
// 分页设置
Page<X2UserEntity> x2Page = new Page<>(i, pageSize);
// 查询分页结果
Page<X2UserEntity> x2UserPage = x2UserMapper.selectPage(x2Page, queryWrapper);
List<X2UserEntity> x2UserList = x2UserPage.getRecords();
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ellassay.x2.sync.mapper.ErpForX2UserMapper">
<insert id="replaceInto">
replace into fa_x2_source_vip_user (
vip_id,
card_id,
grade_id,
grade_name,
depot_id,
depot_name,
open_depotid,
open_depot_name,
extend_user_id,
extend_user_name,
online_extend_user_id,
online_extend_user_name,
open_user_id,
open_user_name,
open_date,
vip_score,
vip_purse,
last_upgrade_date,
last_degrade_date,
vip_name,
vip_sex_id,
vip_sex_name,
vip_mobile,
vip_birthday_year,
vip_birthday_month,
vip_birthday_day,
vip_birth_date,
vip_birth_type_id,
vip_birth_type_name,
vip_idcode,
vip_email,
vip_qq,
vip_avatar_url,
vip_unionid,
vip_channel_id,
vip_channel_name,
vip_remark,
company_id,
depot_group_id,
create_name,
create_date,
update_name,
update_date,
wx_union_id,
vip_nick_name,
vip_outside_id,
fans_id,
vip_wechat_id,
vip_lose_id,
vip_lose_Name,
vip_activation_date,
vip_invite_id,
vip_recycle_id,
vip_rovince_id,
vip_rovince_name,
vip_city_id,
vip_city_name,
vip_area_id,
vip_area_name,
vip_address,
vip_wedding_day,
vip_degrade_batch_id,
vip_degrade_batch_date,
vip_degrade_check_date,
vip_bitth_task_runyear,
vip_bitth_sms_runyear,
vip_system_type
) values
<foreach collection="userList" item="user" separator=",">
(
#{user.vipId},
#{user.cardId},
#{user.gradeId},
#{user.gradeName},
#{user.depotId},
#{user.depotName},
#{user.openDepotId},
#{user.openDepotName},
#{user.extendUserId},
#{user.extendUserName},
#{user.onlineExtendUserId},
#{user.onlineExtendUserName},
#{user.openUserId},
#{user.openUserName},
#{user.openDate},
#{user.vipScore},
#{user.vipPurse},
#{user.lastUpgradeDate},
#{user.lastDegradeDate},
#{user.vipName},
#{user.vipSexId},
#{user.vipSexName},
#{user.vipMobile},
#{user.vipBirthdayYear},
#{user.vipBirthdayMonth},
#{user.vipBirthdayDay},
#{user.vipBirthDate},
#{user.vipBirthTypeId},
#{user.vipBirthTypeName},
#{user.vipIdCode},
#{user.vipEmail},
#{user.vipQQ},
#{user.vipAvatarUrl},
#{user.vipUnionId},
#{user.vipChannelId},
#{user.vipChannelName},
#{user.vipRemark},
#{user.companyId},
#{user.depotGroupId},
#{user.createName},
#{user.createDate},
#{user.updateName},
#{user.updateDate},
#{user.wxUnionId},
#{user.vipNickName},
#{user.vipOutsideId},
#{user.fansId},
#{user.vipWechatId},
#{user.vipLoseId},
#{user.vipLoseName},
#{user.vipActivationDate},
#{user.vipInviteId},
#{user.vipRecycleId},
#{user.vipProvinceId},
#{user.vipProvinceName},
#{user.vipCityId},
#{user.vipCityName},
#{user.vipAreaId},
#{user.vipAreaName},
#{user.vipAddress},
#{user.vipWeddingDay},
#{user.vipDegradeBatchId},
#{user.vipDegradeBatchDate},
#{user.vipDegradeCheckDate},
#{user.vipBirthTaskRunYear},
#{user.vipBirthSmsRunYear},
#{user.vipSystemType}
)
</foreach>
</insert>
</mapper>
字节(Byte)是计量单位,表示数据量多少,是计算机信息技术用于计量存储容量的一种计量单位,通常情况下一字节等于八位。字符(Character)计算机中使用的字母、数字、字和符号,比如'A'、'B'、'$'、'&'等。一般在英文...
public class test { public static void main(String[] args) { &...
java一个类可以有多个构造方法,根据传参类型和个数来匹配执行哪个构造方法。public class Member { public Member(){  ...
java限制1个方法同一时间只能被一个线程访问public synchronized void setOrderPay(){ }加上synchronized 修饰符即可...
在java中字符串属于对象,刚开始我就疑惑为什么int char等类型都是小写,结果String是大写,java太反人类,后来才知道String是对象。(1).java创建字符串String text = "net"; String tex...
pattern表示正则表达式,接收正则表达式作为参数例子:String content = "my name is gaojiufeng"; String pattern = "....