fix(firstleg): map customs document versions explicitly
This commit is contained in:
+24
-11
@@ -8,6 +8,18 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ContainerCustomsMapper {
|
||||
String DOCUMENT_COLUMNS = """
|
||||
d.id id,d.customs_container_id customsContainerId,d.tenant_id tenantId,d.file_id fileId,
|
||||
d.file_name fileName,d.file_hash fileHash,d.content_type contentType,d.size_bytes sizeBytes,
|
||||
d.status status,d.uploaded_by uploadedBy,d.uploaded_at uploadedAt,d.frozen_version frozenVersion,
|
||||
d.frozen_at frozenAt,d.version version
|
||||
""";
|
||||
String COMPLETION_COLUMNS = """
|
||||
r.id id,r.source_document_id sourceDocumentId,r.file_id fileId,r.file_name fileName,
|
||||
r.file_hash fileHash,r.content_type contentType,r.size_bytes sizeBytes,r.uploaded_by uploadedBy,
|
||||
r.uploaded_by_name uploadedByName,r.uploaded_at uploadedAt,r.version version
|
||||
""";
|
||||
|
||||
@Select("""
|
||||
SELECT DISTINCT p.id loadingPlanId,p.plan_no planNo,p.container_booking_id containerBookingId,
|
||||
p.plan_status loadingPlanStatus,b.cabinet_no cabinetNo,b.container_no containerNo,
|
||||
@@ -87,21 +99,20 @@ public interface ContainerCustomsMapper {
|
||||
@Param("fileId") long fileId,@Param("fileName") String fileName,@Param("fileHash") String fileHash,
|
||||
@Param("contentType") String contentType,@Param("sizeBytes") long sizeBytes,@Param("operatorId") long operatorId);
|
||||
|
||||
@Select("SELECT * FROM fl_customs_customer_document WHERE id=#{id}")
|
||||
@Select("SELECT " + DOCUMENT_COLUMNS + " FROM fl_customs_customer_document d WHERE d.id=#{id}")
|
||||
DocumentRow document(@Param("id") long id);
|
||||
|
||||
@Select("SELECT * FROM fl_customs_customer_document WHERE id=#{id} FOR UPDATE")
|
||||
@Select("SELECT " + DOCUMENT_COLUMNS + " FROM fl_customs_customer_document d WHERE d.id=#{id} FOR UPDATE")
|
||||
DocumentRow lockDocument(@Param("id") long id);
|
||||
|
||||
@Select("""
|
||||
<script>SELECT * FROM fl_customs_customer_document
|
||||
WHERE customs_container_id=#{containerId} AND status='ACTIVE'
|
||||
<if test='tenantId != null'>AND tenant_id=#{tenantId}</if>
|
||||
ORDER BY created_at,id</script>
|
||||
""")
|
||||
@Select("<script>SELECT " + DOCUMENT_COLUMNS + " FROM fl_customs_customer_document d " +
|
||||
"WHERE d.customs_container_id=#{containerId} AND d.status='ACTIVE' " +
|
||||
"<if test='tenantId != null'>AND d.tenant_id=#{tenantId}</if> " +
|
||||
"ORDER BY d.created_at,d.id</script>")
|
||||
List<DocumentRow> documents(@Param("containerId") long containerId,@Param("tenantId") Long tenantId);
|
||||
|
||||
@Select("SELECT * FROM fl_customs_customer_document WHERE customs_container_id=#{containerId} AND status='ACTIVE' ORDER BY id FOR UPDATE")
|
||||
@Select("SELECT " + DOCUMENT_COLUMNS + " FROM fl_customs_customer_document d " +
|
||||
"WHERE d.customs_container_id=#{containerId} AND d.status='ACTIVE' ORDER BY d.id FOR UPDATE")
|
||||
List<DocumentRow> lockActiveDocuments(@Param("containerId") long containerId);
|
||||
|
||||
@Update("""
|
||||
@@ -186,10 +197,12 @@ public interface ContainerCustomsMapper {
|
||||
""")
|
||||
List<ScopeRow> frozenScopes(@Param("documentId") long documentId);
|
||||
|
||||
@Select("SELECT * FROM fl_customs_completion_document WHERE source_document_id=#{documentId}")
|
||||
@Select("SELECT " + COMPLETION_COLUMNS + " FROM fl_customs_completion_document r " +
|
||||
"WHERE r.source_document_id=#{documentId}")
|
||||
CompletionRow completion(@Param("documentId") long documentId);
|
||||
|
||||
@Select("SELECT * FROM fl_customs_completion_document WHERE source_document_id=#{documentId} FOR UPDATE")
|
||||
@Select("SELECT " + COMPLETION_COLUMNS + " FROM fl_customs_completion_document r " +
|
||||
"WHERE r.source_document_id=#{documentId} FOR UPDATE")
|
||||
CompletionRow lockCompletion(@Param("documentId") long documentId);
|
||||
|
||||
@Insert("""
|
||||
|
||||
Reference in New Issue
Block a user