mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Переименована таблица БД tasks_amm
This commit is contained in:
@@ -447,6 +447,27 @@ int DataBaseLMS::updateGroup(Group group)
|
|||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::insertTaskAMM(int id_trainee)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("INSERT INTO public.tasks_amm (name, trainee_task) "
|
||||||
|
"VALUES (DEFAULT, %1) "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
QString::number(id_trainee));
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::updateTaskAMM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("UPDATE public.tasks_amm SET name = '%1' "
|
||||||
|
"WHERE task_id = %2 "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
task.ammProcedure.dmCode,
|
||||||
|
QString::number(task.getID()) );
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
Trainee DataBaseLMS::selectTrainee(int id_trainee)
|
Trainee DataBaseLMS::selectTrainee(int id_trainee)
|
||||||
{
|
{
|
||||||
Trainee trainee;
|
Trainee trainee;
|
||||||
@@ -735,6 +756,7 @@ QList<Task> DataBaseLMS::selectTasksOfTrainee(int trainee_id)
|
|||||||
{
|
{
|
||||||
QList<Task> tasks;
|
QList<Task> tasks;
|
||||||
|
|
||||||
|
/*
|
||||||
QString queryStr = QString("SELECT tasks.task_id, tasks.name "
|
QString queryStr = QString("SELECT tasks.task_id, tasks.name "
|
||||||
"FROM public.trainees "
|
"FROM public.trainees "
|
||||||
"JOIN public.trainees_tasks ON trainees_tasks.trainee_id = trainees.trainee_id "
|
"JOIN public.trainees_tasks ON trainees_tasks.trainee_id = trainees.trainee_id "
|
||||||
@@ -755,6 +777,7 @@ QList<Task> DataBaseLMS::selectTasksOfTrainee(int trainee_id)
|
|||||||
tasks.append(task);
|
tasks.append(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return tasks;
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "instructor.h"
|
#include "instructor.h"
|
||||||
#include "trainee.h"
|
#include "trainee.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
#include "tasksAmmFim.h"
|
||||||
|
|
||||||
class DataBaseLMS
|
class DataBaseLMS
|
||||||
{
|
{
|
||||||
@@ -52,6 +53,10 @@ protected:
|
|||||||
int deleteGroup(int group_id);
|
int deleteGroup(int group_id);
|
||||||
int updateGroup(Group group);
|
int updateGroup(Group group);
|
||||||
|
|
||||||
|
//Задача
|
||||||
|
int insertTaskAMM(int id_trainee);
|
||||||
|
int updateTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
//Обучаемый
|
//Обучаемый
|
||||||
Trainee selectTrainee(int id_trainee);
|
Trainee selectTrainee(int id_trainee);
|
||||||
QList<Trainee> selectAllTraineesInGroup(int id_group);
|
QList<Trainee> selectAllTraineesInGroup(int id_group);
|
||||||
|
|||||||
@@ -281,6 +281,21 @@ int InterfaceDataBaseLMS::editGroup(Group group)
|
|||||||
return updateGroup(group);
|
return updateGroup(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::newTaskAMM(int id_trainee)
|
||||||
|
{
|
||||||
|
return insertTaskAMM(id_trainee);
|
||||||
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::delTaskAMM(int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::editTaskAMM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
return updateTaskAMM(task);
|
||||||
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
||||||
{
|
{
|
||||||
return insertTrainee(id_group);
|
return insertTrainee(id_group);
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ public:
|
|||||||
int delGroup(int id);
|
int delGroup(int id);
|
||||||
int editGroup(Group group);
|
int editGroup(Group group);
|
||||||
|
|
||||||
|
int newTaskAMM(int id_trainee);
|
||||||
|
int delTaskAMM(int id);
|
||||||
|
int editTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
int newTrainee(int id_group);
|
int newTrainee(int id_group);
|
||||||
int delTrainee(int id);
|
int delTrainee(int id);
|
||||||
int editTrainee(Trainee trainee);
|
int editTrainee(Trainee trainee);
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
void initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date);
|
void initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date);
|
||||||
void addMalfunction(Malfunction malfunction);
|
void addMalfunction(Malfunction malfunction);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void setID(int id){this->id = id;};
|
||||||
|
int getID(){return id;};
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int id; // для идентификации в БД
|
int id; // для идентификации в БД
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "processparser.h"
|
#include "processparser.h"
|
||||||
|
#include "tasksAmmFim.h"
|
||||||
|
|
||||||
ProcessParser::ProcessParser(QObject *parent) : QObject(parent)
|
ProcessParser::ProcessParser(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
@@ -139,6 +140,7 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client)
|
|||||||
Instructor instructor;
|
Instructor instructor;
|
||||||
Trainee trainee;
|
Trainee trainee;
|
||||||
Group group;
|
Group group;
|
||||||
|
TaskAmmFim task;
|
||||||
void* data = nullptr;
|
void* data = nullptr;
|
||||||
|
|
||||||
/*Перебираем все атрибуты тега*/
|
/*Перебираем все атрибуты тега*/
|
||||||
@@ -205,6 +207,17 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client)
|
|||||||
else if(name == "name")
|
else if(name == "name")
|
||||||
group.setName(value);
|
group.setName(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
|
||||||
|
if(name == "title")
|
||||||
|
task.ammProcedure.title = value;
|
||||||
|
else if(name == "dmCode")
|
||||||
|
task.ammProcedure.dmCode = value;
|
||||||
|
break;
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
|
||||||
|
if(name == "title")
|
||||||
|
task.title = value;
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,6 +236,10 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client)
|
|||||||
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
||||||
data = &group;
|
data = &group;
|
||||||
break;
|
break;
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
|
||||||
|
data = &task;
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
||||||
|
|||||||
@@ -226,6 +226,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
|||||||
emit sigAuthChanged();
|
emit sigAuthChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
|
||||||
|
{
|
||||||
|
int id_new;
|
||||||
|
id_new = providerDBLMS->newTaskAMM(id);
|
||||||
|
if(id_new)
|
||||||
|
{
|
||||||
|
(*(TaskAmmFim*)data).setID(id_new);
|
||||||
|
providerDBLMS->editTaskAMM(*(TaskAmmFim*)data);
|
||||||
|
}
|
||||||
|
//emit sigTasksChanged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB_LIST_INSTRUCTORS);
|
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB_LIST_INSTRUCTORS);
|
||||||
|
|||||||
@@ -299,3 +299,18 @@ int ProviderDBLMS::editGroup(Group group)
|
|||||||
{
|
{
|
||||||
return dbLMS->editGroup(group);
|
return dbLMS->editGroup(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::newTaskAMM(int id_trainee)
|
||||||
|
{
|
||||||
|
return dbLMS->newTaskAMM(id_trainee);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::delTaskAMM(int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::editTaskAMM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
return dbLMS->editTaskAMM(task);
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "interfacedatabaselms.h"
|
#include "interfacedatabaselms.h"
|
||||||
|
#include "tasksAmmFim.h"
|
||||||
|
|
||||||
class ProviderDBLMS : public QObject
|
class ProviderDBLMS : public QObject
|
||||||
{
|
{
|
||||||
@@ -41,6 +42,10 @@ public:
|
|||||||
int delGroup(int id);
|
int delGroup(int id);
|
||||||
int editGroup(Group group);
|
int editGroup(Group group);
|
||||||
|
|
||||||
|
int newTaskAMM(int id_trainee);
|
||||||
|
int delTaskAMM(int id);
|
||||||
|
int editTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
//сигнал о блокировке авторизации
|
//сигнал о блокировке авторизации
|
||||||
void signal_BlockAutorization(bool block);
|
void signal_BlockAutorization(bool block);
|
||||||
|
|||||||
Reference in New Issue
Block a user