2026_08_31

This commit is contained in:
marco committed 2026-08-31 16:19:06 +02:00
commit 73015386e9
2320 files changed
+80291

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import { Controller, Get, Param } from '@nestjs/common';
import { AnzeigeService } from './anzeige.service';
@Controller('procon/anzeigen')
export class AnzeigeController {
constructor(private readonly service: AnzeigeService) { }
//---------------------------------------------------------------------
// Digital Anzeigen
@Get()
getAnzeigenDigital() {
return this.service.getAnzeigen();
}
@Get('/byId/:id')
getAnzeigeDigitalById(@Param('id') id: number) {
return this.service.getAnzeigeById(id);
}
@Get('/byDatenNummer/:datenNummer')
getAnzeigeDigitalByDatenNummer(@Param('datenNummer') datenNummer: number) {
return this.service.getAnzeigeByDatenNummer(datenNummer);
}
@Get('/visuElements/:id')
getAnzeigeDigitalVisuElements(@Param('id') id: number) {
return this.service.getAnzeigeVisuElements(id);
}
}
+12
View File
@@ -0,0 +1,12 @@
import { Module } from '@nestjs/common';
import { AnzeigeService } from './anzeige.service';
import { AnzeigeController } from './anzeige.controller';
import { AnzeigeRepository } from './anzeige.repository';
import { SqlModule } from 'src/infrastructure/sql/sql.module';
@Module({
providers: [AnzeigeService,AnzeigeRepository],
controllers: [AnzeigeController],
imports:[SqlModule]
})
export class AnzeigeModule {}
+95
View File
@@ -0,0 +1,95 @@
import { Injectable } from "@nestjs/common";
import { ProConAnzeigeDto, ProConAnzeigeVisuElementDto } from "src/_dto/procon/proconAnzeige.dto";
import { ProConAnzeigeEntity } from "src/_sql/procon.Anzeige.entity";
import { SqlService } from "src/infrastructure/sql/sql.service";
@Injectable()
export class AnzeigeRepository {
constructor(
private readonly db: SqlService,
) { }
fieldsAnzeigen = [
"Id",
"DatenNummer",
"Text",
"Skalierung",
"Einheit",
"Max",
"Min",
"StatistikTyp",
]
fieldsVisuElements = [
"Id",
"Height",
"Width",
"PositionX",
"PositionY",
"PositionZ",
"Show",
"Discriminator",
"AnzeigeParameterId",
"State",
"ViewId",
];
// Finde alle Anzeigen von Typ analog oder Digital
async findAnzeigen(anlageId: string): Promise<ProConAnzeigeDto[]> {
const pool = await this.db.getPool(anlageId);
const result = await pool
.request()
.query(`
SELECT
${this.fieldsAnzeigen.join(',')}
FROM AnzeigeParameter
`);
const data = result.recordset as ProConAnzeigeEntity[];
return data;
}
async findAnzeigeBy(anlageId: string, by: { id: number; datenNummer?: never } | { id?: never; datenNummer: number }): Promise<ProConAnzeigeDto | undefined> {
const pool = await this.db.getPool(anlageId);
let bySelector = by.id ? "Id=" + by.id : "DatenNummer=" + by.datenNummer;
const result = await pool
.request()
.query(`
SELECT
${this.fieldsAnzeigen.join(',')}
FROM AnzeigeParameter
WHERE ${bySelector};
`);
return result.recordset[0];
}
async findVisuAnzeigeElements(anlageId: string, anzeigeId: number): Promise<ProConAnzeigeVisuElementDto[]> {
const pool = await this.db.getPool(anlageId);
const discriminator = 'AnzeigeParameterXamlVisualisierung';
const result = await pool
.request()
.query(`
SELECT
${this.fieldsVisuElements.join(',')}
FROM Visualisierungen
WHERE Discriminator='${discriminator}' AND AnzeigeParameterId=${anzeigeId};
`);
return result.recordset;
}
}
+34
View File
@@ -0,0 +1,34 @@
import { Injectable } from '@nestjs/common';
import { AnzeigeRepository } from './anzeige.repository';
import { ProConAnzeigeDto, ProConAnzeigeVisuElementDto } from 'src/_dto/procon/proconAnzeige.dto';
@Injectable()
export class AnzeigeService {
anlage = "testXXX"
constructor(
private readonly repo: AnzeigeRepository
) { }
//---------------------------------------------------------------------
// Anzeigen
async getAnzeigen() {
return this.repo.findAnzeigen(this.anlage);
}
async getAnzeigeById(id: number):Promise<ProConAnzeigeDto|undefined> {
return await this.repo.findAnzeigeBy(this.anlage, { id: id });
}
async getAnzeigeByDatenNummer(datenNummer: number):Promise<ProConAnzeigeDto|undefined> {
return await this.repo.findAnzeigeBy(this.anlage, { datenNummer: datenNummer });
}
//--- Visu Elemente
async getAnzeigeVisuElements(anzeigeId: number):Promise<ProConAnzeigeVisuElementDto[]> {
return await this.repo.findVisuAnzeigeElements(this.anlage,anzeigeId);
}
}