|
@@ -3,12 +3,18 @@ package com.slibra;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
+import com.slibra.business.domain.TXinyiRobot;
|
|
|
+import com.slibra.business.mapper.TXinyiRobotMapper;
|
|
|
import com.slibra.common.config.ApplicationProperties;
|
|
|
import com.slibra.common.core.domain.entity.SysDept;
|
|
|
+import com.slibra.common.core.domain.entity.SysUser;
|
|
|
+import com.slibra.common.enums.DataSourceType;
|
|
|
import com.slibra.common.utils.third.AliSMSUtil;
|
|
|
import com.slibra.common.utils.third.NumUtil;
|
|
|
import com.slibra.common.utils.third.StringUtil;
|
|
|
+import com.slibra.framework.datasource.DynamicDataSourceContextHolder;
|
|
|
import com.slibra.system.mapper.SysDeptMapper;
|
|
|
+import com.slibra.system.mapper.SysUserMapper;
|
|
|
import com.wechat.pay.java.service.payments.nativepay.NativePayService;
|
|
|
import com.wechat.pay.java.service.payments.nativepay.model.Amount;
|
|
|
import com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest;
|
|
@@ -40,6 +46,12 @@ public class MyTest {
|
|
|
@Resource
|
|
|
private NativePayService nativePayService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysUserMapper userMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TXinyiRobotMapper xinyiRobotMapper;
|
|
|
+
|
|
|
@Test
|
|
|
void contextLoads() {
|
|
|
}
|
|
@@ -105,4 +117,21 @@ public class MyTest {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testMultilyDataTwo(){
|
|
|
+ //从
|
|
|
+ DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
|
|
|
+ List<TXinyiRobot> tXinyiRobots = xinyiRobotMapper.selectTXinyiRobotList(null);
|
|
|
+ DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
+ System.out.println(JSON.toJSONString(tXinyiRobots.get(0)));
|
|
|
+ System.out.println("-------------");
|
|
|
+ //主
|
|
|
+ SysUser sysUser = new SysUser();
|
|
|
+ sysUser.setUserId(31L);
|
|
|
+ List<SysUser> userList = userMapper.selectUserList(sysUser);
|
|
|
+ DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
+ System.out.println(JSON.toJSONString(userList));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|