Adicionado a tabela de partição do GED

This commit is contained in:
Kenio 2025-09-08 15:11:17 -03:00
parent 6de255e4ec
commit 0c2b33d8d2
2 changed files with 15 additions and 9 deletions

View file

@ -114,7 +114,7 @@ try {
/** Exclui antigas unidades */
$StationDisk->Delete($stationId);
$StationDisk->Delete($clientId);
// Percorre cada disco (C:, D:, etc.)
foreach ($jsonLog->disk as $drive => $details) {
@ -144,7 +144,8 @@ try {
/** Grava o novo disco ou atualiza o atual */
if (!$StationDisk->Save(
$stationDiskId,
0,
$clientId,
$stationId,
$drive,
$capacidade,
@ -188,7 +189,7 @@ try {
/** Deleta os dados da partição */
//$StationFolder->DeletePartition($clientId);
$StationFolder->DeletePartition($clientId);
/** Grava os detalhes da partição GED */
$StationFolder->SavePartition($jsonLog->ged->{'partition'},

View file

@ -175,7 +175,8 @@ class StationDisk
}
/** Insere um novo registro no banco */
public function Save(? int $stationDiskId,
public function Save(? int $stationDiskId,
? int $clientId,
? int $stationId,
? string $description,
? string $capacity,
@ -186,6 +187,7 @@ class StationDisk
/** Parametros */
$this->clientId = $clientId;
$this->stationDiskId = $stationDiskId;
$this->stationId = $stationId;
$this->description = $description;
@ -244,7 +246,8 @@ class StationDisk
}else{//Se o ID não foi informado, grava-se um novo registro
/** Consulta SQL */
$this->sql = 'insert into station_disk(station_disk_id,
$this->sql = 'insert into station_disk(station_disk_id,
client_id,
station_id,
description,
capacity,
@ -252,6 +255,7 @@ class StationDisk
available,
available_percentage
) values (:station_disk_id,
:client_id,
:station_id,
:description,
:capacity,
@ -269,6 +273,7 @@ class StationDisk
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('station_disk_id', $this->stationDiskId);
$this->stmt->bindParam('client_id', $this->clientId);
$this->stmt->bindParam('station_id', $this->stationId);
$this->stmt->bindParam('description', $this->description);
$this->stmt->bindParam('capacity', $this->capacity);
@ -311,20 +316,20 @@ class StationDisk
}
/** Deleta um determinado registro no banco de dados */
function Delete(int $stationDiskId)
function Delete(int $clientId)
{
/** Parametros de entrada */
$this->stationDiskId = $stationDiskId;
$this->clientId = $clientId;
/** Consulta SQL */
$this->sql = 'delete from station_disk
where station_disk_id = :station_disk_id';
where client_id = :client_id';
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('station_disk_id', $this->stationDiskId);
$this->stmt->bindParam(':client_id', $this->clientId);
/** Executo o SQL */
return $this->stmt->execute();