This commit is contained in:
2026-08-28 23:01:52 +08:00
parent 969ff05815
commit da32a67d7f
107 changed files with 465 additions and 271 deletions
@@ -1,5 +1,6 @@
package com.baiyue.firstleg;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -9,18 +10,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 头程履约微服务启动入口,负责装配履约任务组件并扫描 MyBatis-Plus Mapper。
*/
@MapperScan(basePackages = {
"com.baiyue.firstleg.mapper",
"com.baiyue.firstleg.split.mapper",
"com.baiyue.firstleg.loading.mapper",
"com.baiyue.firstleg.loading.bridge.mapper",
"com.baiyue.firstleg.oceanbooking.mapper",
"com.baiyue.firstleg.outbound.dispatch.mapper",
"com.baiyue.firstleg.portschedule.mapper",
"com.baiyue.firstleg.customs.container.mapper",
"com.baiyue.firstleg.customerstatistics.adapter.out.persistence",
"com.baiyue.firstleg.pricebookquery.adapter.out.persistence"
})
@MapperScan(basePackages = "com.baiyue.firstleg", annotationClass = Mapper.class)
@EnableFeignClients(basePackages = "com.baiyue.firstleg")
@EnableScheduling
@SpringBootApplication(scanBasePackages = "com.baiyue")
@@ -1,4 +1,10 @@
package com.baiyue.firstleg.mapper; import com.baiyue.firstleg.entity.AssignmentHistoryEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /**
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baiyue.firstleg.entity.AssignmentHistoryEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 头程任务指派历史 Mapper,提供 {@code fl_assignment_history} 的 MyBatis-Plus 基础数据访问能力。
*/
@Mapper
public interface AssignmentHistoryMapper extends BaseMapper<AssignmentHistoryEntity>{}
@@ -1,9 +1,12 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.CarrierFbaRateEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface CarrierFbaRateMapper extends BaseMapper<CarrierFbaRateEntity> {
@Delete("DELETE FROM fl_carrier_fba_rate WHERE price_book_version_id = #{versionId} AND status = 'PENDING_CONFIRMATION'")
int physicallyDeletePendingByPriceBookVersionId(@Param("versionId") long versionId);
@@ -1,4 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.CustomerChargeRuleEntity;
@Mapper
public interface CustomerChargeRuleMapper extends BaseMapper<CustomerChargeRuleEntity> {}
@@ -1,5 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.CustomerDimensionConfigEntity;
import org.apache.ibatis.annotations.Delete;
@@ -9,6 +11,7 @@ import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface CustomerDimensionConfigMapper extends BaseMapper<CustomerDimensionConfigEntity> {
@Insert("""
<script>
@@ -1,4 +1,10 @@
package com.baiyue.firstleg.mapper; import com.baiyue.firstleg.entity.FulfillmentTaskEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /**
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baiyue.firstleg.entity.FulfillmentTaskEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 头程履约任务 Mapper,提供 {@code fl_fulfillment_task} 的 MyBatis-Plus 基础数据访问能力。
*/
@Mapper
public interface FulfillmentTaskMapper extends BaseMapper<FulfillmentTaskEntity>{}
@@ -1,4 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.InboundFeeItemEntity;
@Mapper
public interface InboundFeeItemMapper extends BaseMapper<InboundFeeItemEntity> {}
@@ -1,8 +1,11 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.InboundOrderLookupEntity;
/** 入库单只读 Mapper,开放接口不得在此增加 update 方法。 */
@Mapper
public interface InboundOrderLookupMapper extends BaseMapper<InboundOrderLookupEntity> {
}
@@ -1,7 +1,10 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baiyue.firstleg.entity.InboundPickupSnapshotEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@Mapper
public interface InboundPickupSnapshotMapper extends BaseMapper<InboundPickupSnapshotEntity> {
}
@@ -1,4 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.InboundPricingIdempotencyEntity;
@Mapper
public interface InboundPricingIdempotencyMapper extends BaseMapper<InboundPricingIdempotencyEntity> {}
@@ -1,4 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.InboundPricingEntity;
@Mapper
public interface InboundPricingMapper extends BaseMapper<InboundPricingEntity> {}
@@ -1,9 +1,12 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.PriceBookChannelEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface PriceBookChannelMapper extends BaseMapper<PriceBookChannelEntity> {
@Delete("DELETE FROM fl_price_book_channel WHERE price_book_version_id = #{versionId}")
int physicallyDeleteByPriceBookVersionId(@Param("versionId") long versionId);
@@ -1,4 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.PriceBookVersionEntity;
@Mapper
public interface PriceBookVersionMapper extends BaseMapper<PriceBookVersionEntity> {}
@@ -1,4 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.PriceChannelCatalogEntity;
@Mapper
public interface PriceChannelCatalogMapper extends BaseMapper<PriceChannelCatalogEntity> {}
@@ -1,4 +1,7 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.PriceOriginAliasEntity;
@Mapper
public interface PriceOriginAliasMapper extends BaseMapper<PriceOriginAliasEntity> {}
@@ -1,6 +1,9 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.PriceWarehouseMappingEntity;
@Mapper
public interface PriceWarehouseMappingMapper extends BaseMapper<PriceWarehouseMappingEntity> {}
@@ -1,7 +1,10 @@
package com.baiyue.firstleg.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baiyue.firstleg.entity.ThirdPartyCallLogEntity;
@Mapper
public interface ThirdPartyCallLogMapper extends BaseMapper<ThirdPartyCallLogEntity> {
}
@@ -1,5 +1,6 @@
package com.baiyue.firstleg;
import org.apache.ibatis.annotations.Mapper;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.cloud.openfeign.EnableFeignClients;
@@ -8,22 +9,11 @@ import static org.assertj.core.api.Assertions.assertThat;
class BaiyueFirstlegApplicationContractTest {
@Test
void scansAllFirstlegMapperPackagesIncludingCustoms() {
void scansAnnotatedMappersFromTheStableServiceRoot() {
MapperScan scan = BaiyueFirstlegApplication.class.getAnnotation(MapperScan.class);
assertThat(scan.basePackages())
.contains("com.baiyue.firstleg.mapper")
.contains("com.baiyue.firstleg.split.mapper")
.contains("com.baiyue.firstleg.loading.mapper")
.contains("com.baiyue.firstleg.loading.bridge.mapper")
.contains("com.baiyue.firstleg.oceanbooking.mapper")
.contains("com.baiyue.firstleg.outbound.dispatch.mapper")
.contains("com.baiyue.firstleg.portschedule.mapper")
.contains("com.baiyue.firstleg.customs.container.mapper")
.contains("com.baiyue.firstleg.customerstatistics.adapter.out.persistence")
.contains("com.baiyue.firstleg.pricebookquery.adapter.out.persistence")
.doesNotContain("com.baiyue.firstleg.customerstatistics.mapper")
.doesNotContain("com.baiyue.firstleg.customs.mapper");
assertThat(scan.basePackages()).containsExactly("com.baiyue.firstleg");
assertThat(scan.annotationClass()).isEqualTo(Mapper.class);
}
@Test
@@ -0,0 +1,21 @@
package com.baiyue.firstleg;
import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import org.apache.ibatis.annotations.Mapper;
import org.junit.jupiter.api.Test;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
class MapperRegistrationArchitectureTest {
private static final JavaClasses PRODUCTION_CLASSES = new ClassFileImporter()
.importPackages("com.baiyue.firstleg");
@Test
void everyMapperInterfaceDeclaresItsRegistrationMarker() {
classes().that().areInterfaces().and().haveSimpleNameEndingWith("Mapper")
.should().beAnnotatedWith(Mapper.class)
.because("Mapper registration must fail during tests instead of service startup")
.check(PRODUCTION_CLASSES);
}
}