mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Перенес TypeQueryToDB в DataBaseLMS
This commit is contained in:
@@ -26,6 +26,7 @@ add_library(DataBaseLMS SHARED
|
|||||||
classroom.h
|
classroom.h
|
||||||
tasksAmmFim.cpp
|
tasksAmmFim.cpp
|
||||||
tasksAmmFim.h
|
tasksAmmFim.h
|
||||||
|
typeQueryToDB.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
||||||
|
|||||||
@@ -426,12 +426,12 @@ int DataBaseLMS::insertGroup(Group group)
|
|||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataBaseLMS::deleteGroup(int group_id)
|
int DataBaseLMS::deleteGroup(int id_group)
|
||||||
{
|
{
|
||||||
QString queryStr = QString("DELETE FROM public.groups "
|
QString queryStr = QString("DELETE FROM public.groups "
|
||||||
"WHERE group_id = %1 "
|
"WHERE group_id = %1 "
|
||||||
"RETURNING groups.group_id").arg(
|
"RETURNING groups.group_id").arg(
|
||||||
QString::number(group_id));
|
QString::number(id_group));
|
||||||
|
|
||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
@@ -469,6 +469,47 @@ int DataBaseLMS::updateTaskAMM(TaskAmmFim task)
|
|||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::deleteTaskAMM(int id_task)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("DELETE FROM public.tasks_amm "
|
||||||
|
"WHERE task_id = %1 "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
QString::number(id_task));
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::insertTaskFIM(int id_trainee)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("INSERT INTO public.tasks_fim (title, trainee_task) "
|
||||||
|
"VALUES (DEFAULT, %1) "
|
||||||
|
"RETURNING tasks_fim.task_id").arg(
|
||||||
|
QString::number(id_trainee));
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::updateTaskFIM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("UPDATE public.tasks_fim SET title = '%1' "
|
||||||
|
"WHERE task_id = %2 "
|
||||||
|
"RETURNING tasks_fim.task_id").arg(
|
||||||
|
task.title,
|
||||||
|
QString::number(task.getID()) );
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::deleteTaskFIM(int id_task)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("DELETE FROM public.tasks_fim "
|
||||||
|
"WHERE task_id = %1 "
|
||||||
|
"RETURNING tasks_fim.task_id").arg(
|
||||||
|
QString::number(id_task));
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
Trainee DataBaseLMS::selectTrainee(int id_trainee)
|
Trainee DataBaseLMS::selectTrainee(int id_trainee)
|
||||||
{
|
{
|
||||||
Trainee trainee;
|
Trainee trainee;
|
||||||
@@ -721,12 +762,12 @@ int DataBaseLMS::insertTrainee(Trainee trainee)
|
|||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataBaseLMS::deleteTrainee(int trainee_id)
|
int DataBaseLMS::deleteTrainee(int id_trainee)
|
||||||
{
|
{
|
||||||
QString queryStr = QString("DELETE FROM public.trainees "
|
QString queryStr = QString("DELETE FROM public.trainees "
|
||||||
"WHERE trainee_id = %1 "
|
"WHERE trainee_id = %1 "
|
||||||
"RETURNING trainees.trainee_id").arg(
|
"RETURNING trainees.trainee_id").arg(
|
||||||
QString::number(trainee_id));
|
QString::number(id_trainee));
|
||||||
|
|
||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,12 +50,17 @@ protected:
|
|||||||
Group selectGroup(int id_group);
|
Group selectGroup(int id_group);
|
||||||
int insertGroup();
|
int insertGroup();
|
||||||
int insertGroup(Group group);
|
int insertGroup(Group group);
|
||||||
int deleteGroup(int group_id);
|
int deleteGroup(int id_group);
|
||||||
int updateGroup(Group group);
|
int updateGroup(Group group);
|
||||||
|
|
||||||
//Задача
|
//Задача AMM
|
||||||
int insertTaskAMM(int id_trainee);
|
int insertTaskAMM(int id_trainee);
|
||||||
int updateTaskAMM(TaskAmmFim task);
|
int updateTaskAMM(TaskAmmFim task);
|
||||||
|
int deleteTaskAMM(int id_task);
|
||||||
|
//Задача FIM
|
||||||
|
int insertTaskFIM(int id_trainee);
|
||||||
|
int updateTaskFIM(TaskAmmFim task);
|
||||||
|
int deleteTaskFIM(int id_task);
|
||||||
|
|
||||||
//Обучаемый
|
//Обучаемый
|
||||||
Trainee selectTrainee(int id_trainee);
|
Trainee selectTrainee(int id_trainee);
|
||||||
@@ -72,7 +77,7 @@ protected:
|
|||||||
|
|
||||||
int insertTrainee(int id_group);
|
int insertTrainee(int id_group);
|
||||||
int insertTrainee(Trainee trainee);
|
int insertTrainee(Trainee trainee);
|
||||||
int deleteTrainee(int trainee_id);
|
int deleteTrainee(int id_trainee);
|
||||||
int updateTrainee(Trainee trainee);
|
int updateTrainee(Trainee trainee);
|
||||||
|
|
||||||
QList<Task> selectTasksOfTrainee(int trainee_id);
|
QList<Task> selectTasksOfTrainee(int trainee_id);
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ int InterfaceDataBaseLMS::newTaskAMM(int id_trainee)
|
|||||||
|
|
||||||
int InterfaceDataBaseLMS::delTaskAMM(int id)
|
int InterfaceDataBaseLMS::delTaskAMM(int id)
|
||||||
{
|
{
|
||||||
return 0;
|
return deleteTaskAMM(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::editTaskAMM(TaskAmmFim task)
|
int InterfaceDataBaseLMS::editTaskAMM(TaskAmmFim task)
|
||||||
@@ -296,6 +296,21 @@ int InterfaceDataBaseLMS::editTaskAMM(TaskAmmFim task)
|
|||||||
return updateTaskAMM(task);
|
return updateTaskAMM(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::newTaskFIM(int id_trainee)
|
||||||
|
{
|
||||||
|
return insertTaskFIM(id_trainee);
|
||||||
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::delTaskFIM(int id)
|
||||||
|
{
|
||||||
|
return deleteTaskFIM(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::editTaskFIM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
return updateTaskFIM(task);
|
||||||
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
||||||
{
|
{
|
||||||
return insertTrainee(id_group);
|
return insertTrainee(id_group);
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ public:
|
|||||||
int delTaskAMM(int id);
|
int delTaskAMM(int id);
|
||||||
int editTaskAMM(TaskAmmFim task);
|
int editTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
|
int newTaskFIM(int id_trainee);
|
||||||
|
int delTaskFIM(int id);
|
||||||
|
int editTaskFIM(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);
|
||||||
|
|||||||
21
DataBaseLMS/typeQueryToDB.h
Normal file
21
DataBaseLMS/typeQueryToDB.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef TYPEQUERYTODB_H
|
||||||
|
#define TYPEQUERYTODB_H
|
||||||
|
|
||||||
|
#include "DataBaseLMS_global.h"
|
||||||
|
|
||||||
|
enum TypeQueryToDB{
|
||||||
|
TYPE_QUERY_GET_ALL_LISTS,
|
||||||
|
TYPE_QUERY_NEW_INSTRUCTOR,
|
||||||
|
TYPE_QUERY_DEL_INSTRUCTOR,
|
||||||
|
TYPE_QUERY_EDIT_INSTRUCTOR,
|
||||||
|
TYPE_QUERY_NEW_GROUP,
|
||||||
|
TYPE_QUERY_DEL_GROUP,
|
||||||
|
TYPE_QUERY_EDIT_GROUP,
|
||||||
|
TYPE_QUERY_NEW_TRAINEE,
|
||||||
|
TYPE_QUERY_DEL_TRAINEE,
|
||||||
|
TYPE_QUERY_EDIT_TRAINEE,
|
||||||
|
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
|
||||||
|
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TYPEQUERYTODB_H
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
#define DATAS_H
|
#define DATAS_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include "typeQueryToDB.h"
|
||||||
|
|
||||||
class ServerSettings{
|
class ServerSettings{
|
||||||
public:
|
public:
|
||||||
@@ -41,7 +42,7 @@ class ClientDeAutorization{
|
|||||||
public:
|
public:
|
||||||
QString Login;
|
QString Login;
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
enum TypeQueryToDB{
|
enum TypeQueryToDB{
|
||||||
TYPE_QUERY_GET_ALL_LISTS,
|
TYPE_QUERY_GET_ALL_LISTS,
|
||||||
TYPE_QUERY_NEW_INSTRUCTOR,
|
TYPE_QUERY_NEW_INSTRUCTOR,
|
||||||
@@ -56,6 +57,7 @@ enum TypeQueryToDB{
|
|||||||
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
|
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
|
||||||
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
|
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
class ClientQueryToDB{
|
class ClientQueryToDB{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include "typeQueryToDB.h"
|
||||||
|
|
||||||
#define NOTIFY_SERVER_END "END"
|
#define NOTIFY_SERVER_END "END"
|
||||||
#define NOTIFY_SERVER_BLOCKED "BLOCKED"
|
#define NOTIFY_SERVER_BLOCKED "BLOCKED"
|
||||||
@@ -60,7 +61,7 @@ class ClientDeAutorization
|
|||||||
public:
|
public:
|
||||||
QString Login;
|
QString Login;
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
enum TypeQueryToDB{
|
enum TypeQueryToDB{
|
||||||
TYPE_QUERY_GET_ALL_LISTS,
|
TYPE_QUERY_GET_ALL_LISTS,
|
||||||
TYPE_QUERY_NEW_INSTRUCTOR,
|
TYPE_QUERY_NEW_INSTRUCTOR,
|
||||||
@@ -75,6 +76,7 @@ enum TypeQueryToDB{
|
|||||||
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
|
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
|
||||||
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
|
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
class ClientQueryToDB{
|
class ClientQueryToDB{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -240,6 +240,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
|||||||
//emit sigTasksChanged();
|
//emit sigTasksChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
|
||||||
|
{
|
||||||
|
int id_new;
|
||||||
|
id_new = providerDBLMS->newTaskFIM(id);
|
||||||
|
if(id_new)
|
||||||
|
{
|
||||||
|
(*(TaskAmmFim*)data).setID(id_new);
|
||||||
|
providerDBLMS->editTaskFIM(*(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);
|
||||||
|
|||||||
@@ -307,10 +307,25 @@ int ProviderDBLMS::newTaskAMM(int id_trainee)
|
|||||||
|
|
||||||
int ProviderDBLMS::delTaskAMM(int id)
|
int ProviderDBLMS::delTaskAMM(int id)
|
||||||
{
|
{
|
||||||
return 0;
|
return dbLMS->delTaskAMM(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProviderDBLMS::editTaskAMM(TaskAmmFim task)
|
int ProviderDBLMS::editTaskAMM(TaskAmmFim task)
|
||||||
{
|
{
|
||||||
return dbLMS->editTaskAMM(task);
|
return dbLMS->editTaskAMM(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::newTaskFIM(int id_trainee)
|
||||||
|
{
|
||||||
|
return dbLMS->newTaskFIM(id_trainee);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::delTaskFIM(int id)
|
||||||
|
{
|
||||||
|
return dbLMS->delTaskFIM(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::editTaskFIM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
return dbLMS->editTaskFIM(task);
|
||||||
|
}
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ public:
|
|||||||
int delTaskAMM(int id);
|
int delTaskAMM(int id);
|
||||||
int editTaskAMM(TaskAmmFim task);
|
int editTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
|
int newTaskFIM(int id_trainee);
|
||||||
|
int delTaskFIM(int id);
|
||||||
|
int editTaskFIM(TaskAmmFim task);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
//сигнал о блокировке авторизации
|
//сигнал о блокировке авторизации
|
||||||
void signal_BlockAutorization(bool block);
|
void signal_BlockAutorization(bool block);
|
||||||
|
|||||||
Reference in New Issue
Block a user