dongoewang commented on issue #30429:
URL: 
https://github.com/apache/shardingsphere/issues/30429#issuecomment-1985060219

   > Hi, could you please provide your insert sql?
   thanks for replying。
   
   i have been using saveBatch ofmybatis plus to insert data,such as 
【clockRecordService.saveBatch(records)】。printed sql is following:
   Logic SQL : INSERT INTO kq_employee_clock_record (
        id,
        employee_id,
        clock_time,
        clock_day,
        clock_day_time,
        longitude,
        latitude,
        address,
        source,
        os,
        browser,
        create_dt,
        create_user,
        update_dt,
        update_user 
   )
   VALUES
        ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
        2024-03-08 13 : 23 : 28 [ INFO ] [ XNIO - 1 task - 1 ] ShardingSphere - 
SQL : < 0.1 >< ziti918130105703170048 > Actual SQL : datasource ::: INSERT INTO 
kq_employee_clock_record_202402 (
                id,
                employee_id,
                clock_time,
                clock_day,
                clock_day_time,
                longitude,
                latitude,
                address,
                source,
                os,
                browser,
                create_dt,
                create_user,
                update_dt,
                update_user 
        )
   VALUES
        (?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
        ?) ::: [ NULL,
        65256,
        2024-02-01 00 : 00 : 00.0,
        2024-02-01,
        00 : 00 : 00,
        118.787651,
        32.035561,
        中国建设银行江苏省分行秦淮洪武路 188号,
        2,
        win11,
        Chrome Mobile,
        2024-03-08 13 : 22 : 46.416,
        NULL,
        NULL,
        NULL ]
   
   testting sample is following
    public void testGenerator() throws Exception {
           List<EmployeeClockRecord> records = new ArrayList<>(3);
           EmployeeClockRecord clockRecord1 = new EmployeeClockRecord();
           clockRecord1.setEmployeeId(65256L);
           clockRecord1.setLongitude(new Double("118.787651"));
           clockRecord1.setLatitude(new Double("32.035561"));
           Date date = DateUtils.formatStringByStyleToDate("2024-01-31 
15:08:40", "yyyy-MM-dd");
           clockRecord1.setClockTime(date);
           
clockRecord1.setClockDay(DateUtils.formatDateByStyle(clockRecord1.getClockTime(),
 YYYY_MM_DD));
           
clockRecord1.setClockDayTime(DateUtils.formatDateByStyle(clockRecord1.getClockTime(),
 HH_MM_SS));
           clockRecord1.setSource(2);
           clockRecord1.setOs("win11");
           clockRecord1.setBrowser("Chrome Mobile");
           clockRecord1.setAddress("中国建设银行江苏省分行秦淮洪武路188号");
   
           EmployeeClockRecord clockRecord2 = new EmployeeClockRecord();
           clockRecord2.setEmployeeId(65256L);
           clockRecord2.setLongitude(new Double("118.787651"));
           clockRecord2.setLatitude(new Double("32.035561"));
           Date date2 = DateUtils.formatStringByStyleToDate("2024-02-01 
15:08:40", "yyyy-MM-dd");
   //        Date date2 = 
Date.from(localDate2.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
           clockRecord2.setClockTime(date2);
           
clockRecord2.setClockDay(DateUtils.formatDateByStyle(clockRecord2.getClockTime(),
 YYYY_MM_DD));
           
clockRecord2.setClockDayTime(DateUtils.formatDateByStyle(clockRecord1.getClockTime(),
 HH_MM_SS));
           clockRecord2.setSource(2);
           clockRecord2.setOs("win11");
           clockRecord2.setBrowser("Chrome Mobile");
           clockRecord2.setAddress("中国建设银行江苏省分行秦淮洪武路188号");
   
   
           records.add(clockRecord1);
           records.add(clockRecord2);
           String shardingDataSource ="shardingDataSource";
           DynamicDataSourceContextHolder.setDataSourceType(shardingDataSource);
           clockRecordService.saveBatch(records);
       }
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to