From 23a46b4be35277e06ec89f48730eeb694e686be8 Mon Sep 17 00:00:00 2001
From: Kenmegne <stephanie.kenmegne@gmail.com>
Date: Thu, 18 Jun 2026 15:40:06 +0000
Subject: [PATCH] add fdx-commons and fdx-consultation
---
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/CurrentDataProductionQuery.java | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/CurrentDataProductionQuery.java b/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/CurrentDataProductionQuery.java
new file mode 100644
index 0000000..44bb563
--- /dev/null
+++ b/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/CurrentDataProductionQuery.java
@@ -0,0 +1,42 @@
+package com.megatim.fdxcommons.tools.database.queries;
+
+import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+/**
+ *
+ * @author Gabuntu
+ */
+public class CurrentDataProductionQuery implements QueryMetaData<Long> {
+
+ private final String codeTypeFichier;
+ private final String referentielVersion;
+ private final Connection connection;
+
+ public CurrentDataProductionQuery(String codeTypeFichier, String referentielVersion, Connection connection) {
+ this.codeTypeFichier = codeTypeFichier;
+ this.referentielVersion = referentielVersion;
+ this.connection = connection;
+ }
+
+ @Override
+ public Long execute() throws Exception {
+ String query = "SELECT MAX(id) FROM dataproduction WHERE codetypefichier = ? AND referentielversion = ?";
+ Long id = null;
+
+ try (PreparedStatement statement = connection.prepareStatement(query);) {
+
+ statement.setString(1, codeTypeFichier);
+ statement.setString(2, referentielVersion);
+ ResultSet resultSet = statement.executeQuery();
+
+ if (resultSet.next()) {
+ id = resultSet.getLong(1);
+ }
+ }
+ return id;
+ }
+
+}
--
Gitblit v1.10.0