springboot+sharding-jdbc(自定义精准分片)+SPI自定义雪花算法

目录

步骤一:准备一个springBoot框架的maven项目

步骤二:配置application.properties,并自定义雪花算法

步骤三:自定义分片类实现(这里举例精准分片)

步骤四:其他mybatis的实体类的配置以及mapper的实现

步骤五:测试

1.运行创建表测试

2.插入两条数据

3. 根据订单号查找表名测试



步骤一:准备一个springBoot框架的maven项目

主要框架版本如下(其他版本集成需要尝试才知道是否会有问题):

主要框架版本
springBoot2.2.1.RELEASE
sharding-jdbc-spring-boot-starter4.0.0-RC1
mybatis-plus-boot-starter3.3.2
druid-spring-boot-starte1.1.24

项目pom.xml配置如下。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>shardingjdbc-study</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>shardingjdbc-study</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <!--spring boot核心包-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <!--spring boot 单元测试包-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--spring boot web容器包-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--引入sharding-jdbc整合包-->
        <dependency>
            <groupId>org.apache.shardingsphere</groupId>
            <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
            <version>4.0.0-RC1</version>
        </dependency>
        <!--引入mysql-container驱动包-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <!--引入数据库连接池包-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.24</version>
        </dependency>
        <!--引入ORM框架mybatis包-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.3.2</version>
        </dependency>
        <!--引入lombok包-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.5.2</version>
            </plugin>
        </plugins>
    </build>

</project>

步骤二:配置application.properties,并自定义雪花算法

application.properties的配置内容如下(注意这里groovy表达式解决月日时的单数问题):


server.servlet.context-path=/shardingjdbc-study
server.port=8080

#设置bean加载定义时可以覆盖
spring.main.allow-bean-definition-overriding=true

# 配置真实数据源
spring.shardingsphere.datasource.names=ds0

# 配置第 1 个数据源(注意这里driver是mysql8版本的驱动)
spring.shardingsphere.datasource.ds0.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.ds0.url=jdbc:mysql://localhost:3306/order?serverTimezone=GMT%2B8
spring.shardingsphere.datasource.ds0.username=root
spring.shardingsphere.datasource.ds0.password=Jiang890910bO


## 配置 order 表名规则(order_4位年1~2位月_取模31, 这里类似表达式“(1..12).collect{t->t.toString().padLeft(2, '0')}”,是groovy表达式,表示"保存两位字符串,不够在左侧填充0”)
spring.shardingsphere.sharding.tables.order.actual-data-nodes=ds0.order_$->{2021..2025}_$->{(1..12).collect{t->t.toString().padLeft(2, '0')}}_$->{(1..31).collect{t->t.toString().padLeft(2, '0')}}

#分片字段名称
spring.shardingsphere.sharding.tables.order.table-strategy.standard.sharding-column=order_no
#为分片字段设置自定义的雪花算法
spring.shardingsphere.sharding.tables.order.key-generator.column=order_no
spring.shardingsphere.sharding.tables.order.key-generator.type=MyShardingKey
#spring.shardingsphere.sharding.tables.order.key-generator.props.worker.id=1

#分片策略自定义对应的类名
spring.shardingsphere.sharding.tables.order.table-strategy.standard.precise-algorithm-class-name=com.example.shardingjdbcstudy.config.OrderPreciseAlgorithmConfig

#显示分表操作sql语句
spring.shardingsphere.props.sql.show=true

自定义雪花算法(附根据订单号解析出表名的方法),如下:

package com.example.shardingjdbcstudy.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * 雪花算法
 */
public class IdWorker {
    //开始时间截 (2021-07-18 21:55)
    public static final long twepoch = 1626616467755L;
    //机器ID所占位置
    private static final long workerIdBits = 5L;
    //数据标识所占位数
    private static final long dataCenterIdBits = 5L;
    //支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数)
    private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
    //支持的最大数据标识id,结果是31
    private final long maxdataCenterId = -1L ^ (-1L << dataCenterIdBits);
    //序列在id中占的位数
    private static final long sequenceBits = 12L;
    //机器ID向左移12位
    private final long workerIdShift = sequenceBits;
    //数据标识id向左移17位(12+5)
    private final long dataCenterIdShift = sequenceBits + workerIdBits;
    //时间截向左移22位(5+5+12)
    private static final long timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits;
    //生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095)
    private final long sequenceMask = -1L ^ (-1L << sequenceBits);

    //工作机器ID(0~31)
    private long workerId;

    //数据中心ID(0~31)
    private long dataCenterId;

    //毫秒内序列(0~4095)
    private long sequence = 0L;

    //上次生成ID的时间截
    private long lastTimestamp = -1L;

    /**
     *
     * @param workerId 工作机器ID(0~31)
     * @param dataCenterId 数据中心ID(0~31)
     */
    public IdWorker(long workerId, long dataCenterId) {
        if (workerId > maxWorkerId || workerId < 0) {
            throw new IllegalArgumentException(String.format(
                    "worker Id can't be greater than %d or less than 0",
                    maxWorkerId));
        }
        if (dataCenterId > maxdataCenterId || dataCenterId < 0) {
            throw new IllegalArgumentException(String.format(
                    "datacenter Id can't be greater than %d or less than 0",
                    maxdataCenterId));
        }
        this.workerId = workerId;
        this.dataCenterId = dataCenterId;
    }

    /**
     * 获得下一个ID (该方法是线程安全的)
     * @return
     */
    public synchronized long nextId() {
        long timestamp = timeGen();

        //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
        if (timestamp < lastTimestamp) {
            throw new RuntimeException(String.format(
                    "Clock moved backwards.  Refusing to generate id for %d milliseconds",
                    lastTimestamp - timestamp));
        }

        //如果是同一时间生成的,则进行毫秒内序列
        if (lastTimestamp == timestamp) {
            sequence = (sequence + 1) & sequenceMask;
            //毫秒内序列溢出
            if (sequence == 0) {
                //阻塞到下一个毫秒,获得新的时间戳
                timestamp = tilNextMillis(lastTimestamp);
            }
        } else {//时间戳改变,毫秒内序列重置
            sequence = 0L;
        }

        //上次生成ID的时间截
        lastTimestamp = timestamp;

        //移位并通过或运算拼到一起组成64位的ID
        return ((timestamp - twepoch) << timestampLeftShift)
                | (dataCenterId << dataCenterIdShift)
                | (workerId << workerIdShift)
                | sequence;
    }

    /**
     * 阻塞到下一个毫秒,直到获得新的时间戳
     * @param lastTimestamp
     * @return
     */
    protected long tilNextMillis(long lastTimestamp) {
        long timestamp = timeGen();
        while (timestamp <= lastTimestamp) {
            timestamp = timeGen();
        }
        return timestamp;
    }

    /**
     * 根据订单号解析出表名方法
     * @param orderNo
     * @return
     */
    public static String parseTableNameByOrderNo(Long orderNo){
        long timestamp =  (orderNo >> timestampLeftShift) + twepoch;
        Date date = new Date(timestamp);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM");
        int suffixNum = Math.abs(orderNo.hashCode() % 31) + 1;
        String suffixStr = suffixNum < 10 ? "0" + suffixNum: String.valueOf(suffixNum);
        return "order_" + sdf.format(date) + "_" + suffixStr;
    }


    /**
     * 返回以毫秒为单位的当前时间
     * @return
     */
    protected long timeGen() {
        return System.currentTimeMillis();
    }

}

SPI自定分片主键配置(实现ShardingKeyGenerator接口的连个方法,其中spring.shardingsphere.sharding.tables.order.key-generator.type=MyShardingKey)如下:

package com.example.shardingjdbcstudy.utils;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.spi.keygen.ShardingKeyGenerator;

import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Properties;

@Setter
@Getter
public class MyShardingKeyGenerator implements ShardingKeyGenerator {

    private Properties properties;

    @Override
    public Comparable<?> generateKey() {
        try {
            InetAddress inet = InetAddress.getLocalHost();
            String hostAddress = inet.getHostAddress();
            long workId =  Long.parseLong(hostAddress.replace(".", ""));
            IdWorker idWorker = new IdWorker(workId,1);
            return idWorker.nextId();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }

        return null;
    }

    @Override
    public String getType() {
        return "MyShardingKey";
    }

}

步骤三:自定义分片类实现(这里举例精准分片)

实现接口org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm.doSharding(...)方法。

package com.example.shardingjdbcstudy.config;

import com.example.shardingjdbcstudy.utils.SnowFlakeWorker;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;

import java.util.Calendar;
import java.util.Collection;
import java.util.Objects;

/**
 * 订单精准分表算法
 */
public class OrderPreciseAlgorithmConfig implements PreciseShardingAlgorithm<Long> {

    /**
     * 必选的,用于处理=和IN的分片
     * @param collection
     * @param preciseShardingValue
     * @return
     */
    @Override
    public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
        if(Objects.nonNull(preciseShardingValue)){
            Long value = preciseShardingValue.getValue();
            //注意这里有可能hash值取模后会出现负数,所以需要取绝对值
            int suffixNum = Math.abs(value.hashCode() % 31) + 1;
            String suffixStr = suffixNum < 10 ? "0" + suffixNum: String.valueOf(suffixNum);
            return preciseShardingValue.getLogicTableName() + "_" + getTableSuffix() + "_" + suffixStr;
        }
        return null;
    }

    /**
     * 表名后缀
     * @return
     */
    public static String getTableSuffix() {
        Calendar calendar = Calendar.getInstance();
        String year = String.valueOf(calendar.get(Calendar.YEAR));
        int monthNum = calendar.get(Calendar.MONTH) +1;
        String month = String.valueOf(monthNum);
        if(monthNum< 10){
            month = "0" + monthNum;
        }
        return year +"_"+ month;
    }

}

步骤四:其他mybatis的实体类的配置以及mapper的实现

Order实体类代码如下:

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;

@Data
@TableName(value = "order")
public class Order {

    private Long id;

    private Long orderNo;

    private String goodsNo;

    private String goodsName;

    private Integer goodsNum;

    private Double goodsUnitPrice;

    private Long userNo;

    private Date createdAt;

    private Date updatedAt;
}

OrderMapper代码如下:

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.shardingjdbcstudy.entitys.Goods;
import org.springframework.stereotype.Repository;

@Repository
public interface GoodsMapper extends BaseMapper<Goods> {
}

启动类代码如下:

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//使用mybatis的MapperSacn注解扫描mapper包名路径
@MapperScan(basePackages = "com.example.shardingjdbcstudy.mappers")
@SpringBootApplication
public class ShardingJdbcStudyApplication {

    public static void main(String[] args) {
        SpringApplication.run(ShardingJdbcStudyApplication.class, args);
    }
}

项目结构如下:

步骤五:测试

1.运行创建表测试

首先需要使用springframework的JdbcTemplate准备创建表的的语句方法。

    @Resource
    private JdbcTemplate jdbcTemplate;

    @Test()
    public void createTableTest(){
        for (int i = 1; i < 32; i++) {
            //jdbcTemplate.update("drop table `order_" + OrderAlgorithmConfig.getTableSuffix() + "_" + i + "`");
            String iStr = i < 10 ? "0" + i :  "" +i ;
            jdbcTemplate.update(
                    "CREATE TABLE IF NOT EXISTS `order_" + OrderPreciseAlgorithmConfig.getTableSuffix() + "_" + iStr +"`  (" +
                    "  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键'," +
                    "  `order_no` bigint(20)  NOT NULL COMMENT '唯一键'," +
                    "  `goods_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品编号'," +
                    "  `goods_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品名称'," +
                    "  `goods_num` int(11) NOT NULL COMMENT '商品数量'," +
                    "  `goods_unit_price` double(10, 2) NOT NULL COMMENT '商品单价金额'," +
                    "  `user_no` bigint(20)  NOT NULL COMMENT '用户编号'," +
                    "  `created_at` datetime NULL COMMENT '创建时间'," +
                    "  `updated_at` datetime NULL COMMENT '更新时间'," +
                    "  PRIMARY KEY (`id`) USING BTREE," +
                    "  UNIQUE INDEX `uq_idx`(`order_no`) USING BTREE"+
                    ") ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;");
        }

    }

现在是7月,生成了31张表,表名规则按 表明+ “_”+“4位年数字”+ “_” + "1~2位月数字”+“_”+"1~31数字"拼接。阿里建议单张表存储500~800万数据,取最低值计算下是31*500=15500万,1.5亿订单/月;取最高值计算下是31*800=24800万,2.4亿订单/月;足够支撑目前国内各大公司的业务。

2.插入两条数据

    @Resource
    private OrderMapper orderMapper;

    /**
     * 分表插入数据测试
     */
    @Test
    void addOrderTest() {
        for (int i = 0; i < 2; i++) {
            Order order = new Order();
            order.setGoodsNo("B345654" + i);
            order.setGoodsName("java test1");
            order.setGoodsNum(i);
            order.setGoodsUnitPrice(10d);
            order.setUserNo(8790989L + i);
            order.setCreatedAt(new Date());
            order.setUpdatedAt(new Date());
            orderMapper.insert(order);
        }

    }

关键日志(关注关键字“Actual SQL”),插入了order_2021_07_04和order_2021_07_05:

"C:\Program Files\Java\jdk1.8.0_241\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=59071:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-launcher\1.5.2\junit-platform-launcher-1.5.2.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\plugins\junit\lib\junit5-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\plugins\junit\lib\junit-rt.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\charsets.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\deploy.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\access-bridge-64.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\cldrdata.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\dnsns.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\jaccess.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\localedata.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\nashorn.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\sunec.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\sunjce_provider.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\sunmscapi.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\sunpkcs11.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\ext\zipfs.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\javaws.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\jce.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\jfr.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\jfxswt.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\jsse.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\management-agent.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\plugin.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\resources.jar;C:\Program Files\java\jdk1.8.0_241\jre\lib\rt.jar;E:\projects\pesonal\shardingjdbc-study\target\test-classes;E:\projects\pesonal\shardingjdbc-study\target\classes;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter\2.2.1.RELEASE\spring-boot-starter-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot\2.2.1.RELEASE\spring-boot-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-context\5.2.1.RELEASE\spring-context-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.2.1.RELEASE\spring-boot-autoconfigure-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.2.1.RELEASE\spring-boot-starter-logging-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\Administrator\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\Administrator\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.12.1\log4j-to-slf4j-2.12.1.jar;C:\Users\Administrator\.m2\repository\org\apache\logging\log4j\log4j-api\2.12.1\log4j-api-2.12.1.jar;C:\Users\Administrator\.m2\repository\org\slf4j\jul-to-slf4j\1.7.29\jul-to-slf4j-1.7.29.jar;C:\Users\Administrator\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-core\5.2.1.RELEASE\spring-core-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-jcl\5.2.1.RELEASE\spring-jcl-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\yaml\snakeyaml\1.25\snakeyaml-1.25.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter-test\2.2.1.RELEASE\spring-boot-starter-test-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-test\2.2.1.RELEASE\spring-boot-test-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-test-autoconfigure\2.2.1.RELEASE\spring-boot-test-autoconfigure-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;C:\Users\Administrator\.m2\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;C:\Users\Administrator\.m2\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;C:\Users\Administrator\.m2\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;C:\Users\Administrator\.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.2\jakarta.xml.bind-api-2.3.2.jar;C:\Users\Administrator\.m2\repository\jakarta\activation\jakarta.activation-api\1.2.1\jakarta.activation-api-1.2.1.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter\5.5.2\junit-jupiter-5.5.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.5.2\junit-jupiter-api-5.5.2.jar;C:\Users\Administrator\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-commons\1.5.2\junit-platform-commons-1.5.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-params\5.5.2\junit-jupiter-params-5.5.2.jar;C:\Users\Administrator\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.5.2\junit-jupiter-engine-5.5.2.jar;C:\Users\Administrator\.m2\repository\org\junit\vintage\junit-vintage-engine\5.5.2\junit-vintage-engine-5.5.2.jar;C:\Users\Administrator\.m2\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;C:\Users\Administrator\.m2\repository\org\junit\platform\junit-platform-engine\1.5.2\junit-platform-engine-1.5.2.jar;C:\Users\Administrator\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\Administrator\.m2\repository\org\mockito\mockito-junit-jupiter\3.1.0\mockito-junit-jupiter-3.1.0.jar;C:\Users\Administrator\.m2\repository\org\assertj\assertj-core\3.13.2\assertj-core-3.13.2.jar;C:\Users\Administrator\.m2\repository\org\hamcrest\hamcrest\2.1\hamcrest-2.1.jar;C:\Users\Administrator\.m2\repository\org\mockito\mockito-core\3.1.0\mockito-core-3.1.0.jar;C:\Users\Administrator\.m2\repository\net\bytebuddy\byte-buddy\1.10.2\byte-buddy-1.10.2.jar;C:\Users\Administrator\.m2\repository\net\bytebuddy\byte-buddy-agent\1.10.2\byte-buddy-agent-1.10.2.jar;C:\Users\Administrator\.m2\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;C:\Users\Administrator\.m2\repository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;C:\Users\Administrator\.m2\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-test\5.2.1.RELEASE\spring-test-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\xmlunit\xmlunit-core\2.6.3\xmlunit-core-2.6.3.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.2.1.RELEASE\spring-boot-starter-web-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.2.1.RELEASE\spring-boot-starter-json-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.10.0\jackson-databind-2.10.0.jar;C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.10.0\jackson-annotations-2.10.0.jar;C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.10.0\jackson-core-2.10.0.jar;C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.10.0\jackson-datatype-jdk8-2.10.0.jar;C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.10.0\jackson-datatype-jsr310-2.10.0.jar;C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.10.0\jackson-module-parameter-names-2.10.0.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.2.1.RELEASE\spring-boot-starter-tomcat-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.27\tomcat-embed-core-9.0.27.jar;C:\Users\Administrator\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.27\tomcat-embed-el-9.0.27.jar;C:\Users\Administrator\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.27\tomcat-embed-websocket-9.0.27.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter-validation\2.2.1.RELEASE\spring-boot-starter-validation-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\jakarta\validation\jakarta.validation-api\2.0.1\jakarta.validation-api-2.0.1.jar;C:\Users\Administrator\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.18.Final\hibernate-validator-6.0.18.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;C:\Users\Administrator\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-web\5.2.1.RELEASE\spring-web-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-beans\5.2.1.RELEASE\spring-beans-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-webmvc\5.2.1.RELEASE\spring-webmvc-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-aop\5.2.1.RELEASE\spring-aop-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-expression\5.2.1.RELEASE\spring-expression-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-jdbc-spring-boot-starter\4.0.0-RC1\sharding-jdbc-spring-boot-starter-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-jdbc-core\4.0.0-RC1\sharding-jdbc-core-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-entry\4.0.0-RC1\sharding-core-entry-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-api\4.0.0-RC1\sharding-core-api-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-common\4.0.0-RC1\sharding-core-common-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\codehaus\groovy\groovy\2.4.5\groovy-2.4.5-indy.jar;C:\Users\Administrator\.m2\repository\commons-codec\commons-codec\1.13\commons-codec-1.13.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-parse-common\4.0.0-RC1\sharding-core-parse-common-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-parse-spi\4.0.0-RC1\sharding-core-parse-spi-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\commons\commons-collections4\4.2\commons-collections4-4.2.jar;C:\Users\Administrator\.m2\repository\org\antlr\antlr4-runtime\4.7.1\antlr4-runtime-4.7.1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-parse-mysql\4.0.0-RC1\sharding-core-parse-mysql-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-parse-postgresql\4.0.0-RC1\sharding-core-parse-postgresql-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-parse-oracle\4.0.0-RC1\sharding-core-parse-oracle-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-parse-sqlserver\4.0.0-RC1\sharding-core-parse-sqlserver-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-optimize\4.0.0-RC1\sharding-core-optimize-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-route\4.0.0-RC1\sharding-core-route-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-rewrite\4.0.0-RC1\sharding-core-rewrite-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-execute\4.0.0-RC1\sharding-core-execute-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-core-merge\4.0.0-RC1\sharding-core-merge-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\org\apache\shardingsphere\sharding-transaction-core\4.0.0-RC1\sharding-transaction-core-4.0.0-RC1.jar;C:\Users\Administrator\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar;C:\Users\Administrator\.m2\repository\org\slf4j\slf4j-api\1.7.29\slf4j-api-1.7.29.jar;C:\Users\Administrator\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.29\jcl-over-slf4j-1.7.29.jar;C:\Users\Administrator\.m2\repository\mysql\mysql-connector-java\8.0.18\mysql-connector-java-8.0.18.jar;C:\Users\Administrator\.m2\repository\com\alibaba\druid-spring-boot-starter\1.1.24\druid-spring-boot-starter-1.1.24.jar;C:\Users\Administrator\.m2\repository\com\alibaba\druid\1.1.24\druid-1.1.24.jar;C:\Users\Administrator\.m2\repository\com\baomidou\mybatis-plus-boot-starter\3.3.2\mybatis-plus-boot-starter-3.3.2.jar;C:\Users\Administrator\.m2\repository\com\baomidou\mybatis-plus\3.3.2\mybatis-plus-3.3.2.jar;C:\Users\Administrator\.m2\repository\com\baomidou\mybatis-plus-extension\3.3.2\mybatis-plus-extension-3.3.2.jar;C:\Users\Administrator\.m2\repository\com\baomidou\mybatis-plus-core\3.3.2\mybatis-plus-core-3.3.2.jar;C:\Users\Administrator\.m2\repository\com\baomidou\mybatis-plus-annotation\3.3.2\mybatis-plus-annotation-3.3.2.jar;C:\Users\Administrator\.m2\repository\com\github\jsqlparser\jsqlparser\3.1\jsqlparser-3.1.jar;C:\Users\Administrator\.m2\repository\org\mybatis\mybatis\3.5.4\mybatis-3.5.4.jar;C:\Users\Administrator\.m2\repository\org\mybatis\mybatis-spring\2.0.4\mybatis-spring-2.0.4.jar;C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.2.1.RELEASE\spring-boot-starter-jdbc-2.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\com\zaxxer\HikariCP\3.4.1\HikariCP-3.4.1.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-jdbc\5.2.1.RELEASE\spring-jdbc-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\springframework\spring-tx\5.2.1.RELEASE\spring-tx-5.2.1.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\projectlombok\lombok\1.18.10\lombok-1.18.10.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests,addOrderTest
23:09:32.282 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
23:09:32.334 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
23:09:32.436 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
23:09:32.475 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests], using SpringBootContextLoader
23:09:32.483 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests]: class path resource [com/example/shardingjdbcstudy/ShardingJdbcStudyApplicationTests-context.xml] does not exist
23:09:32.484 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests]: class path resource [com/example/shardingjdbcstudy/ShardingJdbcStudyApplicationTestsContext.groovy] does not exist
23:09:32.485 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
23:09:32.582 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests]
23:09:32.901 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.example.shardingjdbcstudy.ShardingJdbcStudyApplicationTests]: using defaults.
23:09:32.904 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
23:09:32.932 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@31fa1761, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@957e06, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@32502377, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@2c1b194a, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4dbb42b7, org.springframework.test.context.transaction.TransactionalTestExecutionListener@66f57048, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@550dbc7a, org.springframework.test.context.event.EventPublishingTestExecutionListener@21282ed8, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@36916eb0, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@7bab3f1a, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@437da279, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@23c30a20, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@1e1a0406]
23:09:32.939 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@47d9a273 testClass = ShardingJdbcStudyApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@4b8ee4de testClass = ShardingJdbcStudyApplicationTests, locations = '{}', classes = '{class com.example.shardingjdbcstudy.ShardingJdbcStudyApplication, class com.example.shardingjdbcstudy.ShardingJdbcStudyApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@479d31f3, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6e171cd7, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@47af7f3d, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@5b239d7d], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
23:09:33.008 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.1.RELEASE)

2021-07-24 23:09:34.020  INFO 23560 --- [           main] c.e.s.ShardingJdbcStudyApplicationTests  : Starting ShardingJdbcStudyApplicationTests on PC with PID 23560 (started by Administrator in E:\projects\pesonal\shardingjdbc-study)
2021-07-24 23:09:34.023  INFO 23560 --- [           main] c.e.s.ShardingJdbcStudyApplicationTests  : No active profile set, falling back to default profiles: default
2021-07-24 23:09:37.382  INFO 23560 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-07-24 23:09:38.942  INFO 23560 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.3.2 
2021-07-24 23:09:40.781  INFO 23560 --- [           main] c.e.s.ShardingJdbcStudyApplicationTests  : Started ShardingJdbcStudyApplicationTests in 7.723 seconds (JVM running for 10.014)
2021-07-24 23:09:42.078  INFO 23560 --- [           main] ShardingSphere-SQL                       : Rule Type: sharding
2021-07-24 23:09:42.082  INFO 23560 --- [           main] ShardingSphere-SQL                       : Logic SQL: INSERT INTO order  ( id,

goods_no,
goods_name,
goods_num,
goods_unit_price,
user_no,
created_at,
updated_at )  VALUES  ( ?,

?,
?,
?,
?,
?,
?,
? )
2021-07-24 23:09:42.082  INFO 23560 --- [           main] ShardingSphere-SQL                       : SQLStatement: InsertStatement(super=DMLStatement(super=AbstractSQLStatement(type=DML, tables=Tables(tables=[Table(name=order, alias=Optional.absent())]), routeConditions=Conditions(orCondition=OrCondition(andConditions=[AndCondition(conditions=[])])), encryptConditions=Conditions(orCondition=OrCondition(andConditions=[])), sqlTokens=[TableToken(tableName=order, quoteCharacter=NONE, schemaNameLength=0), SQLToken(startIndex=19)], parametersIndex=8, logicSQL=INSERT INTO order  ( id,

goods_no,
goods_name,
goods_num,
goods_unit_price,
user_no,
created_at,
updated_at )  VALUES  ( ?,

?,
?,
?,
?,
?,
?,
? )), deleteStatement=false, updateTableAlias={}, updateColumnValues={}, whereStartIndex=0, whereStopIndex=0, whereParameterStartIndex=0, whereParameterEndIndex=0), columnNames=[id, goods_no, goods_name, goods_num, goods_unit_price, user_no, created_at, updated_at], values=[InsertValue(columnValues=[org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@5db0003d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@7f12094d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@589fb74d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@200d1a3d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@7de147e9, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@12567179, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@37d699a1, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@7f42b194])])
2021-07-24 23:09:42.083  INFO 23560 --- [           main] ShardingSphere-SQL                       : Actual SQL: ds0 ::: INSERT INTO order_2021_07_04   (id, goods_no, goods_name, goods_num, goods_unit_price, user_no, created_at, updated_at, order_no) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ::: [1418951525434253313, B123456_0, java test1, 0, 10.0, 8790989, 2021-07-24 23:09:41.081, 2021-07-24 23:09:41.081, 2193261498339328]
2021-07-24 23:09:42.146  INFO 23560 --- [           main] ShardingSphere-SQL                       : Rule Type: sharding
2021-07-24 23:09:42.147  INFO 23560 --- [           main] ShardingSphere-SQL                       : Logic SQL: INSERT INTO order  ( id,

goods_no,
goods_name,
goods_num,
goods_unit_price,
user_no,
created_at,
updated_at )  VALUES  ( ?,

?,
?,
?,
?,
?,
?,
? )
2021-07-24 23:09:42.147  INFO 23560 --- [           main] ShardingSphere-SQL                       : SQLStatement: InsertStatement(super=DMLStatement(super=AbstractSQLStatement(type=DML, tables=Tables(tables=[Table(name=order, alias=Optional.absent())]), routeConditions=Conditions(orCondition=OrCondition(andConditions=[AndCondition(conditions=[])])), encryptConditions=Conditions(orCondition=OrCondition(andConditions=[])), sqlTokens=[TableToken(tableName=order, quoteCharacter=NONE, schemaNameLength=0), SQLToken(startIndex=19)], parametersIndex=8, logicSQL=INSERT INTO order  ( id,

goods_no,
goods_name,
goods_num,
goods_unit_price,
user_no,
created_at,
updated_at )  VALUES  ( ?,

?,
?,
?,
?,
?,
?,
? )), deleteStatement=false, updateTableAlias={}, updateColumnValues={}, whereStartIndex=0, whereStopIndex=0, whereParameterStartIndex=0, whereParameterEndIndex=0), columnNames=[id, goods_no, goods_name, goods_num, goods_unit_price, user_no, created_at, updated_at], values=[InsertValue(columnValues=[org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@5db0003d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@7f12094d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@589fb74d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@200d1a3d, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@7de147e9, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@12567179, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@37d699a1, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@7f42b194])])
2021-07-24 23:09:42.147  INFO 23560 --- [           main] ShardingSphere-SQL                       : Actual SQL: ds0 ::: INSERT INTO order_2021_07_05   (id, goods_no, goods_name, goods_num, goods_unit_price, user_no, created_at, updated_at, order_no) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ::: [1418951529540476930, B123456_1, java test1, 1, 10.0, 8790990, 2021-07-24 23:09:42.144, 2021-07-24 23:09:42.144, 2193261917769728]
2021-07-24 23:09:42.182  INFO 23560 --- [extShutdownHook] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2021-07-24 23:09:42.197  INFO 23560 --- [extShutdownHook] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
2021-07-24 23:09:42.200  INFO 23560 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

Process finished with exit code 0

表数据展示如:

 

 

3. 根据订单号查找表名测试

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值