Adicionado a tabela de partição do GED

This commit is contained in:
Kenio 2025-09-08 15:50:10 -03:00
parent 29bcfabc70
commit 7c6b9ce672
2 changed files with 14 additions and 8 deletions

View file

@ -84,6 +84,9 @@ try {
/** Exclui antigas unidades */ /** Exclui antigas unidades */
$StationDisk->Delete($clientId); $StationDisk->Delete($clientId);
/** Exclui as antigas pastas */
$StationFolder->Delete($clientId);
/** Exclui todas as estações de um determinado cliente */ /** Exclui todas as estações de um determinado cliente */
$Station->Delete($clientId); $Station->Delete($clientId);
@ -158,9 +161,6 @@ try {
} }
} }
/** Exclui as antigas pastas */
$StationFolder->Delete($stationId);
// Percorre a pasta Ged // Percorre a pasta Ged
foreach ($jsonLog->ged as $path => $details) { foreach ($jsonLog->ged as $path => $details) {
@ -173,6 +173,7 @@ try {
/** Grava uma nova pasta ou atualiza o atual */ /** Grava uma nova pasta ou atualiza o atual */
if (!$StationFolder->Save( if (!$StationFolder->Save(
0, 0,
$clientId,
$stationId, $stationId,
$path, $path,
$value, $value,

View file

@ -177,6 +177,7 @@ class StationFolder
/** Insere um novo registro no banco */ /** Insere um novo registro no banco */
public function Save(? int $stationFolderId, public function Save(? int $stationFolderId,
? int $clientId,
? int $stationId, ? int $stationId,
? string $folderPath, ? string $folderPath,
? int $amountOfFiles, ? int $amountOfFiles,
@ -186,6 +187,7 @@ class StationFolder
/** Parametros */ /** Parametros */
$this->stationFolderId = $stationFolderId; $this->stationFolderId = $stationFolderId;
$this->clientId = $clientId;
$this->stationId = $stationId; $this->stationId = $stationId;
$this->folderPath = $folderPath; $this->folderPath = $folderPath;
$this->amountOfFiles = $amountOfFiles; $this->amountOfFiles = $amountOfFiles;
@ -232,10 +234,12 @@ class StationFolder
}else{//Se o ID não foi informado, grava-se um novo registro }else{//Se o ID não foi informado, grava-se um novo registro
/** Consulta SQL */ /** Consulta SQL */
$this->sql = 'insert into station_folder(station_id, $this->sql = 'insert into station_folder(station_id,
client_id,
folder_path, folder_path,
amount_of_files amount_of_files
) values (:station_id, ) values (:station_id,
:client_id,
:folder_path, :folder_path,
:amount_of_files)'; :amount_of_files)';
@ -248,6 +252,7 @@ class StationFolder
$this->connection->connect()->beginTransaction(); $this->connection->connect()->beginTransaction();
/** Preencho os parâmetros do SQL */ /** Preencho os parâmetros do SQL */
$this->stmt->bindParam('client_id', $this->clientId);
$this->stmt->bindParam('station_id', $this->stationId); $this->stmt->bindParam('station_id', $this->stationId);
$this->stmt->bindParam('folder_path', $this->folderPath); $this->stmt->bindParam('folder_path', $this->folderPath);
$this->stmt->bindParam('amount_of_files', $this->amountOfFiles); $this->stmt->bindParam('amount_of_files', $this->amountOfFiles);
@ -289,20 +294,20 @@ class StationFolder
} }
/** Deleta um determinado registro no banco de dados */ /** Deleta um determinado registro no banco de dados */
function Delete(int $stationId) function Delete(int $clientId)
{ {
/** Parametros de entrada */ /** Parametros de entrada */
$this->stationId = $stationId; $this->clientId = $clientId;
/** Consulta SQL */ /** Consulta SQL */
$this->sql = 'delete from station_folder $this->sql = 'delete from station_folder
where station_id = :station_id'; where client_id = :client_id';
/** Preparo o sql para receber os valores */ /** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql); $this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */ /** Preencho os parâmetros do SQL */
$this->stmt->bindParam(':station_id', $this->stationId); $this->stmt->bindParam(':client_id', $this->clientId);
/** Executo o SQL */ /** Executo o SQL */
return $this->stmt->execute(); return $this->stmt->execute();