dongguo4812 commented on issue #26164:
URL:
https://github.com/apache/shardingsphere/issues/26164#issuecomment-1682189922
你可以让shardingsphere帮你创建表
for example
` @Autowired
JdbcTemplate jdbcTemplate;
@Test
public void testCreateAutoOrderMod() {
jdbcTemplate.execute("CREATE TABLE t_order (\n" +
" order_id BIGINT,\n" +
" order_no VARCHAR(30),\n" +
" user_id BIGINT,\n" +
" amount DECIMAL(10,2),\n" +
" PRIMARY KEY(order_id) USING BTREE\n" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;");
for (long i = 1; i <= 10; i++) {
Order order = new Order();
order.setOrderNo("SP20230814000" + i);
order.setUserId(i);
order.setAmount(new BigDecimal(100));
orderMapper.insert(order);
}
}`
shardingsphere按照分片规则创建表,这样查询就没有问题了
--
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]