贴标申请,仓储转运
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
package com.baiyue.lastleg.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderMapper;
|
||||
import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
|
||||
import org.apache.ibatis.mapping.Environment;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.List;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class LastlegOrderReturnVolumeTest {
|
||||
@Test void historicalParcelsAreIncludedWithLatestCarrierMeasurementsAndCustomerIsolation() throws Exception {
|
||||
var config = new MybatisConfiguration();
|
||||
config.setEnvironment(new Environment("test", new JdbcTransactionFactory(),
|
||||
new UnpooledDataSource("org.h2.Driver", "jdbc:h2:mem:return-volume;MODE=MySQL", "sa", "")));
|
||||
config.addMapper(LastlegOrderMapper.class);
|
||||
try (var session = new SqlSessionFactoryBuilder().build(config).openSession()) {
|
||||
var sql = session.getConnection().createStatement();
|
||||
sql.execute("CREATE TABLE ll_return_order (id BIGINT, customer_id VARCHAR, lastleg_order_id BIGINT)");
|
||||
sql.execute("CREATE TABLE ll_return_receipt (id BIGINT, return_order_id BIGINT, customer_id VARCHAR, unit_type VARCHAR, unit_code VARCHAR, receipt_no VARCHAR, signed_at TIMESTAMP, length DECIMAL(12,3), width DECIMAL(12,3), height DECIMAL(12,3))");
|
||||
sql.execute("INSERT INTO ll_return_order VALUES (1,'A',9),(2,'B',10)");
|
||||
sql.execute("INSERT INTO ll_return_receipt VALUES " +
|
||||
"(1,1,'A','PARCEL','PK-A','RR-1','2026-10-13 10:00:00',40,40,40)," +
|
||||
"(2,1,'A','PARCEL','PK-A','RR-2','2026-10-13 11:00:00',50,40,40)," +
|
||||
"(3,1,'A','PARCEL','PK-B','RR-3','2026-10-13 11:00:00',60,50,50)," +
|
||||
"(4,1,'B','PARCEL','PK-C','RR-4','2026-10-13 11:00:00',100,100,100)," +
|
||||
"(5,2,'B','PARCEL','PK-D','RR-5','2026-10-13 11:00:00',100,100,100)," +
|
||||
"(6,1,'A','PARCEL','PK-E','RR-6','2026-10-13 11:00:00',NULL,50,50)");
|
||||
var rows = session.getMapper(LastlegOrderMapper.class).findReturnVolumes(List.of(9L));
|
||||
assertThat(rows).hasSize(1);
|
||||
assertThat(rows.get(0).orderId()).isEqualTo(9L);
|
||||
assertThat(rows.get(0).volumeCbm()).isEqualByComparingTo("0.23");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user