You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.6 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# springboot-mybatis2datasource-demo
[![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu)
Spring Boot整合MyBatis双数据源Demo
该程序使用方法
1.copy一个联众的原基础表取名 t_card_info_upload加了个状态字段state。
0代表要同步的基础数据程序每次取1000个修改状态为1代表正在同步的同步成功的状态改为2失败的改为3没有图片数据的图片表没有数据的 状态改为5。
SELECT * into t_card_info_upload from T_card_info ;
ALTER TABLE [dbo].[t_card_info_upload] ADD [state] tinyint NULL;
CREATE NONCLUSTERED INDEX [index_state]
ON [dbo].[t_card_info_upload] (
[state]
)
CREATE NONCLUSTERED INDEX [index_outdate]
ON [dbo].[t_card_info_upload] (
[outdate]
)
2.设置一个目录用来存放图片,比如 每个患者那个id 当次级目录,最后把基础信息和文件信息传这个接口。
3.将Debug程序放在本目录下
4.不需要在代码中插入基本信息将t_card_info_upload表直接导入到我们的基础信息中省去add的步骤
5.使用UPDATE t_card_info_upload
SET t_card_info_upload.state = 5
FROM t_card_info_upload
LEFT JOIN T_picture ON t_card_info_upload.id = T_picture.FileId
WHERE T_picture.FileId IS NULL;
先将没有数据的基本信息状态改为2减少检索内存
6.将联众分段表数据导入我们的分段表中
7.导入基础数据查询sql
SELECT
id,
patno,
patname,
outdate,
outdeptname,
patsex,
indate,
indeptname,
fource,
'Z:\pic\' + CAST(id AS VARCHAR(50)) AS path
FROM
t_card_info_upload
WHERE
state !=5