1. Tool directory structure
2. Application configuration (JsonToSqlUtil)
JsonToSqlUtil:
The data field name must be written in the order returned in JSON.
field: id,name,description,pictureUrl,url,testUrl,ttUrl,aaUrl,kakaka,createDate
# format is the field of time (English, separated)
timeField: createDate,updateDate
# Whether timestamp format is true or false
timeFieldType: false
Mysql > alter table name
tableName: data
# the primary key
primaryKey: id
Example: {"store": {" data": [{"category": "reference", "price": 8.95}, path: store.data
dataPath: data
# url
url: http://localhost:8081/
Post or get
method: post
# request body, enclosed by '', left blank if there is none
body: ' '
Copy the code
3. Matters needing attention
1, local database to build tables, fields need to use UTF8 encoding;
2. All fields in the table must be written, that is, all fields in the DATA field that need to be stored in JSON need to be built; 3. Fill in strictly according to the configuration instructions in application; 3. Scheduled tasks in task can modify the CRON expression and change the execution period.
4. Effect:
Build tables:
10W pieces of data are generated in the interface:
Run the synchronization tool, 10W lines of data, and it takes 2s:
Project address: github.com/ChangeWeDer…