修复银行流水批量入库MySQL1869异常
This commit is contained in:
@@ -403,7 +403,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
bank_statement_id = bank_statement_id
|
||||
batch_id = batch_id
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByProjectIdAndBatchId">
|
||||
|
||||
@@ -132,6 +132,17 @@ class CcdiBankStatementMapperXmlTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void insertBatch_shouldAvoidUpdatingAutoIncrementPrimaryKeyInDuplicateBranch() throws Exception {
|
||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE)) {
|
||||
String xml = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
|
||||
|
||||
assertTrue(xml.contains("on duplicate key update"), xml);
|
||||
assertTrue(xml.contains("batch_id = batch_id"), xml);
|
||||
assertFalse(xml.contains("bank_statement_id = bank_statement_id"), xml);
|
||||
}
|
||||
}
|
||||
|
||||
private MappedStatement loadMappedStatement(String statementId) throws Exception {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.setEnvironment(new Environment("test", new JdbcTransactionFactory(), new NoOpDataSource()));
|
||||
|
||||
Reference in New Issue
Block a user