From 828ba1dcdd1fa803dddf94f4f1643452d5efa703 Mon Sep 17 00:00:00 2001
From: gong <3218757026@qq.com>
Date: 星期三, 06 十一月 2024 15:08:44 +0800
Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/昆仑_1025

---
 Client/姜可庚/log/姜可庚_1106.doc                                                        |    0 
 Server/王琨元/code/MysqlConn.h                                                        |   88 
 Client/李宵增/log/历史查询_李宵增_1102.doc                                                   |    0 
 表.docx                                                                             |    0 
 Client/申烜/log/日志_申烜_1106.doc                                                       |    0 
 kunlun.sql                                                                         |   55 
 Server/王琨元/log/日志模板_王琨元_1104.doc                                                   |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/qcomboxdelegate.cpp                   |   16 
 Client/姜可庚/code/服务端业务代码/ServerSocket.cpp                                           |  166 +++
 Client/刘子航/log/日志_刘子航_1106.doc                                                     |    0 
 Client/朱航/log/朱航1104.doc                                                           |    0 
 Server/王琨元/code/ConnectionPool.h                                                   |   82 
 Server/马渝杭/log/日志_马渝杭_20241104.doc                                                 |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/pmsqueryresult.h                      |   83 +
 Client/姜可庚/code/服务端业务代码/PermissonManage.h                                          |   16 
 Server/王琨元/code/ConnectionPool.cpp                                                 |  204 +--
 Client/黎弘霖/log/设备管理_黎弘霖_1105.doc                                                   |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/pmsparam.h                            |   19 
 Server/陈楚丹/log/日志_陈楚丹_1105.doc                                                     |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/pmsplusparam.h                        |   62 
 Client/姜可庚/code/2024kunlun_project_permisson/permissonwindow.h                     |    4 
 Server/李转转/log/配置管理_李转转_1106.doc                                                   |    0 
 Client/朱航/log/朱航1105.doc                                                           |    0 
 Client/黎弘霖/log/设备管理_黎弘霖_1106.doc                                                   |    0 
 Client/冀浩昶/log/日志_冀浩昶_1106.doc                                                     |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user |    2 
 Client/姜可庚/code/服务端业务代码/common.h                                                   | 1064 ++++++++++++++++++++
 Client/姜可庚/code/2024kunlun_project_permisson/PmsClientSocket.cpp                   |  100 +
 Client/姜可庚/code/2024kunlun_project_permisson/PmsClientSocket.h                     |   71 
 Server/王琨元/log/日志模板_王琨元_1103 .doc                                                  |    0 
 Server/王琨元/log/日志模板_王琨元_1101.doc                                                   |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/permissondialog.cpp                   |   31 
 Client/宋昊昳/log/日志_宋昊昳_1106.doc                                                     |    0 
 Client/冀浩昶/log/日志_冀浩昶_1105.doc                                                     |    0 
 Client/郑凯文/log/郑凯文1106.doc                                                         |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/syncdatatodb.cpp                      |   52 
 Client/姜可庚/code/服务端业务代码/PermissonManage.cpp                                        |  152 ++
 Client/姜可庚/document/权限管理需求分析.docx                                                  |    0 
 Server/王琨元/code/MysqlConn.cpp                                                      |  310 ++---
 Server/马渝杭/log/20241105昆仑日报.doc                                                    |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/permissonwindow.cpp                   |   99 -
 Server/马渝杭/log/日志_马渝杭_20241105.doc                                                 |    0 
 common.h                                                                           |  142 +
 Server/王琨元/log/日志模板_王琨元_1105.doc                                                   |    0 
 Client/姜可庚/code/2024kunlun_project_permisson/permissondialog.ui                    |  241 +++-
 Client/姜可庚/code/2024kunlun_project_permisson/qcomboxdelegate.h                     |    6 
 46 files changed, 2,377 insertions(+), 688 deletions(-)

diff --git "a/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1105.doc" "b/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1105.doc"
new file mode 100644
index 0000000..eb6f7e2
--- /dev/null
+++ "b/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1105.doc"
Binary files differ
diff --git "a/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1106.doc" "b/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1106.doc"
new file mode 100644
index 0000000..8e9710c
--- /dev/null
+++ "b/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1106.doc"
Binary files differ
diff --git "a/Client/\345\210\230\345\255\220\350\210\252/log/\346\227\245\345\277\227_\345\210\230\345\255\220\350\210\252_1106.doc" "b/Client/\345\210\230\345\255\220\350\210\252/log/\346\227\245\345\277\227_\345\210\230\345\255\220\350\210\252_1106.doc"
new file mode 100644
index 0000000..3f4e716
--- /dev/null
+++ "b/Client/\345\210\230\345\255\220\350\210\252/log/\346\227\245\345\277\227_\345\210\230\345\255\220\350\210\252_1106.doc"
Binary files differ
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user"
index afa3031..7049102 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user"
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.5.0, 2024-10-31T16:02:45. -->
+<!-- Written by QtCreator 4.5.0, 2024-11-04T20:34:52. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp"
index 8449947..aca2755 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp"
@@ -5,7 +5,7 @@
 PmsClientSocket::PmsClientSocket(QWidget * parent):QWidget(parent)
 {
     client = new QTcpSocket(this);
-
+    connect(client,SIGNAL(connected()),this,SLOT(connected_Slot()));
     client->connectToHost(targetIp,port);
     if(!client->waitForConnected(3000)){
 
@@ -14,14 +14,12 @@
     }
     connectSuccess = true;
     qDebug()<< "QT缃戠粶閫氫俊鎴愬姛宸茶繛鎺ユ湇鍔″櫒锛�";
-    connect(client,SIGNAL(connected()),this,SLOT(connected_Slot()));
-
 }
 
 void PmsClientSocket::queryAllUserAboutUser()
 {
     if(connectSuccess){
-        QueryPmsRequest req;
+        QueryPmsReq req;
         client->write((char *)&req,req.head.len);
         qDebug() << "鏌ヨ鍏ㄩ儴鏉冮檺璇锋眰鍙戦�佹垚鍔�";
     }
@@ -30,10 +28,10 @@
 void PmsClientSocket::queryPmsByParam(PmsParam param)
 {
     if(connectSuccess){
-        QueryPmsRequest req;
-        strcpy(req.name,param.getName().c_str());
-        strcpy(req.permissonType,param.getPermissonType().c_str());
-        strcpy(req.userNo,param.getUserNo().c_str());
+        QueryPmsReq req;
+        strcpy(req.name,param.getName().toLocal8Bit().data());
+        strcpy(req.permissonType,param.getPermissonType().toLocal8Bit().data());
+        strcpy(req.userNo,param.getUserNo().toLocal8Bit().data());
         client->write((char *)&req,req.head.len);
         qDebug() << "鏉′欢鏌ヨ鏉冮檺璇锋眰鍙戦�佹垚鍔�";
     }
@@ -41,12 +39,23 @@
 
 void PmsClientSocket::updatePmsByParam(PmsPlusParma param)
 {
-    UpdatePmsRequest upReq;
-    upReq.devManage = param.getDevManage();
-    upReq.loggerSearch = param.getLoggerSearch();
-    upReq.mapMark = param.getMapMark();
-    upReq.productPlan = param.getProductPlan();
-    upReq.roleId = param.getRoleId();
+    UpdatePmsReq upReq;
+
+    upReq.id = param.getId();
+    if(param.getPermissonType().isEmpty()){
+        upReq.devManage = param.getDevManage();
+        upReq.loggerSearch = param.getLoggerSearch();
+        upReq.mapMark = param.getMapMark();
+        upReq.productPlan = param.getProductPlan();
+        upReq.warningManage = param.getWarninManage();
+        upReq.versionManage = param.getVersionManage();
+        upReq.admin = param.getAdmin();
+        upReq.queryHistory = param.getQueryHistory();
+
+        memset(upReq.permissonType,0,32);
+    }else {
+        strcpy(upReq.permissonType,param.getPermissonType().toLocal8Bit().data());
+    }
     client->write((char *)&upReq,upReq.head.len);
     qDebug() << "鏇存柊鏉冮檺璇锋眰鍙戦�佹垚鍔�";
 }
@@ -59,40 +68,45 @@
 void PmsClientSocket::readyRead_Slot()
 {
     QByteArray buf = client->readAll();
-    QString recvData = QString::fromLocal8Bit(buf);
-    qDebug()<< "client鏀跺埌鐨勬暟鎹�" << recvData;
-    QueryPmsResponse * res;
-    UpdatePmsResponse * upRes;
-    int type = *(int *)buf.data();
-    if(type == QUERY_PMS_REQ){
-          res = (QueryPmsResponse *)buf.data();
+    qDebug()<< "client鏀跺埌浜嗙殑鏁版嵁";
+    QueryPmsRes * res;
+    UpdatePmsRes * upRes;
+    Head head = *(Head *)buf.data();
+    if(head.type == QUERY_PMS_RES){
+        qDebug()<< "鏌ヨ鍝嶅簲";
+          res = (QueryPmsRes *)buf.data();
           if(res->success){
               vector<PmsQueryResult> vecs;
-              int pmsLen = res->head.len-sizeof(QueryPmsResponse);
-              for(int i =0;i<pmsLen;i+=sizeof(PmsRes)){
-                  PmsRes structRes = *(PmsRes*)(res + sizeof(QueryPmsResponse) + i*sizeof(PmsRes));
-                      PmsQueryResult res;
-                      res.setName(string(structRes.name));
-                      res.setUserNo(string(structRes.userNo));
-                      res.setRoleId(structRes.roleId);
-                      res.setStartDateTime(string(structRes.startDateTime));
-                      res.setEndDateTime(string(structRes.endDateTime));
-                      res.setLoggerSearch(structRes.loggerSearch);
-                      res.setMapMark(structRes.mapMark);
-                      res.setDevManage(structRes.devManage);
-                      res.setProductPlan(structRes.productPlan);
-                      res.setQueryHistory(structRes.queryHistory);
-                      res.setPermissonType(string(structRes.permissonType));
-                      vecs.push_back(res);
+              int pmsLen = (res->head.len-sizeof(QueryPmsRes))/sizeof(PmsRes);
+              for(int i =0;i<pmsLen;i++){
+                  PmsRes structRes = res->pmsList[i];
+                      PmsQueryResult qres;
+                      qres.setName(QString::fromLocal8Bit(structRes.name));
+                      qres.setUserNo(QString::fromLocal8Bit(structRes.userNo));
+                      qres.setId(structRes.id);
+                      qres.setLoginTime(string(structRes.loginTime));
+                      qres.setRegisterTime(string(structRes.registerTime));
+                      qres.setLoggerSearch(structRes.loggerSearch);
+                      qres.setMapMark(structRes.mapMark);
+                      qres.setDevManage(structRes.devManage);
+                      qres.setProductPlan(structRes.productPlan);
+                      qres.setQueryHistory(structRes.queryHistory);
+                      qres.setPermissonType(QString::fromLocal8Bit(structRes.permissonType));
+                      qres.setWarninManage(structRes.warningManage);
+                      qres.setVersionManage(structRes.versionManage);
+                      qres.setAdmin(structRes.admin);
+                      vecs.push_back(qres);
               }
-              if(!vecs.empty()){
-                  emit notifyDateChange(vecs);
-              }
+              emit notifyDateChange(vecs);
+          }else{
+              // 鏌ヨ澶辫触鏁版嵁涓虹┖娓呴櫎琛ㄦ牸鏁版嵁
+              emit notifyDateChange(vector<PmsQueryResult>());
           }
     }
-    if(type == UPDATE_PMS_REQ){
-        res = (QueryPmsResponse *)buf.data();
-        if(res->success){
+    if(head.type == UPDATE_PMS_RES){
+        upRes = (UpdatePmsRes *)buf.data();
+        qDebug()<< "鏇存柊鍝嶅簲";
+        if(upRes->success){
             QString dlgTitle = "鏇存柊缁撴灉";
             QString strInfo = "鏉冮檺淇℃伅鏇存柊鎴愬姛";
             QMessageBox::information(this,dlgTitle,strInfo,
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h"
index 0a0e535..3a17733 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h"
@@ -16,7 +16,7 @@
 };
 
 enum option{
-    QUERY_PMS_REQ,
+    QUERY_PMS_REQ=6,
     UPDATE_PMS_REQ,
     QUERY_PMS_RES,
     UPDATE_PMS_RES,
@@ -24,73 +24,84 @@
 
 
 // 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰
-typedef struct QueryPmsRequest{
+typedef struct QueryPmsReq{
     Head head;
     char userNo[32];
     char name[32];
     char permissonType[32];
-    QueryPmsRequest(){
+    QueryPmsReq(){
         head.type=QUERY_PMS_REQ;
         memset(userNo,0,32);
         memset(permissonType,0,32);
         memset(name,0,32);
-        head.len = sizeof(QueryPmsRequest);
+        head.len = sizeof(QueryPmsReq);
     }
-} QueryPmsRequest;
+} QueryPmsReq;
 
 // 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰
-typedef struct UpdatePmsRequest{
+typedef struct UpdatePmsReq{
     Head head;
-    int roleId;
+    // 浜哄憳琛ㄤ富閿甶d
+    int id;
     int queryHistory;
     int loggerSearch;
     int mapMark;
     int devManage;
     int productPlan;
-    UpdatePmsRequest(){
-        head.type=QUERY_PMS_RES;
-        head.len = sizeof(UpdatePmsRequest);
-    }
-} UpdatePmsRequest;
+    int warningManage;
+    int versionManage; //鐗堟湰绠$悊
+    int admin; //绯荤粺绠$悊鍛�
 
-// 鍗曚釜浜哄憳鏉冮檺缁撴瀯浣�
-typedef struct UserAboutPms{
+    char permissonType[32];
+    UpdatePmsReq(){
+        head.type=UPDATE_PMS_REQ;
+        head.len = sizeof(UpdatePmsReq);
+    }
+} UpdatePmsReq;
+
+// 鍗曚釜浜哄憳鍜屾潈闄愯仈鍚堟煡璇㈢粨鏋勪綋
+typedef struct PmsRes{
     int queryHistory;
     int loggerSearch;
     int mapMark;
     int devManage;
     int productPlan;
-    int roleId;
+    int versionManage; //鐗堟湰绠$悊
+    int warningManage;
+    int admin; //绯荤粺绠$悊鍛�
+
+    int id;
+
     char userNo[32];
     char name[32];
-    char permissonType[32];
-    char startDateTime[32];
-    char endDateTime[32];
+
+    char permissonType[32];  // 瑙掕壊绫诲瀷
+
+    char department[32];
+    char loginTime[32];
+    char registerTime[32];
 } PmsRes;
 
 // 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣�
-typedef struct UserAboutPmsResponse{
+typedef struct QueryPmsRes{
     Head head;
     int success; // 1涓烘垚鍔� ,0涓哄け璐�
-    //PmsRes pmsList[100];
-    char pmsList[0];
-    UserAboutPmsResponse(){
+    PmsRes pmsList[0];
+    QueryPmsRes(){
         head.type=QUERY_PMS_RES;
-//        memset(pmsList,0,sizeof(PmsRes));
-//        head.len = sizeof(UserAboutPmsResponse);
     }
-} QueryPmsResponse;
+} QueryPmsRes;
 
 // 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣�
-typedef struct UpdatePmsResponse{
+typedef struct UpdatePmsRes{
     Head head;
     int success; // 1涓烘垚鍔� ,0涓哄け璐�
-    UpdatePmsResponse(){
+    UpdatePmsRes(){
         head.type = UPDATE_PMS_RES;
-        head.len = sizeof(UpdatePmsResponse);
+        head.len = sizeof(UpdatePmsRes);
     }
 
-} UpdatePmsResponse ;
+} UpdatePmsRes ;
 
 
 class PmsClientSocket : public QWidget
@@ -99,7 +110,7 @@
 
     QTcpSocket *client;
 
-    int port=88888;
+    int port=16888;
     QString targetIp = "127.0.0.1";
 
     bool connectSuccess= false;
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp"
index 98d0f81..ab7a404 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp"
@@ -34,11 +34,29 @@
     map5[2]=ui->radioButton_15;
 
 
+    map<int,QRadioButton *> warningMap;
+    warningMap[0]=ui->radioButton_16;
+    warningMap[1]=ui->radioButton_17;
+    warningMap[2]=ui->radioButton_18;
+
+    map<int,QRadioButton *> versionMap;
+    versionMap[0]=ui->radioButton_19;
+    versionMap[1]=ui->radioButton_20;
+    versionMap[2]=ui->radioButton_21;
+
+    map<int,QRadioButton *> superManager;
+    // 1涓鸿秴绾х鐞嗗憳
+    superManager[0]=ui->radioButton_23;
+    superManager[1]=ui->radioButton_22;
+
     btnList.push_back(map1);
     btnList.push_back(map2);
     btnList.push_back(map3);
     btnList.push_back(map4);
     btnList.push_back(map5);
+    btnList.push_back(warningMap);
+    btnList.push_back(versionMap);
+    btnList.push_back(superManager);
 
 }
 
@@ -50,7 +68,7 @@
 int PermissonDialog::findBoxCheck(map<int, QRadioButton *> map)
 {
     for(int i =0;i<map.size();i++){
-        if(btnList[0][i]->isChecked()){
+        if(map[i]->isChecked()){
             return i;
         }
     }
@@ -65,6 +83,12 @@
     btnList[2][res.getMapMark()]->setChecked(true);
     btnList[3][res.getDevManage()]->setChecked(true);
     btnList[4][res.getProductPlan()]->setChecked(true);
+
+    btnList[5][res.getWarninManage()]->setChecked(true);
+
+    btnList[6][res.getVersionManage()]->setChecked(true);
+
+    btnList[7][res.getAdmin()]->setChecked(true);
 
     curRes = res;
 
@@ -81,8 +105,11 @@
     param.setMapMark(findBoxCheck(btnList[2]));
     param.setDevManage(findBoxCheck(btnList[3]));
     param.setProductPlan(findBoxCheck(btnList[4]));
+    param.setWarninManage(findBoxCheck(btnList[5]));
+    param.setVersionManage(findBoxCheck(btnList[6]));
+    param.setAdmin(findBoxCheck(btnList[7]));
 
-    param.setRoleId(curRes.getRoleId());
+    param.setId(curRes.getId());
     client->updatePmsByParam(param);
 
 }
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.ui" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.ui"
index 2701441..6599cc5 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.ui"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.ui"
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>421</width>
-    <height>361</height>
+    <width>560</width>
+    <height>492</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -16,54 +16,18 @@
   <layout class="QGridLayout" name="gridLayout_3">
    <item row="0" column="0">
     <layout class="QGridLayout" name="gridLayout_2">
+     <item row="3" column="0">
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+       </property>
+      </widget>
+     </item>
      <item row="0" column="0">
       <layout class="QGridLayout" name="gridLayout">
-       <item row="0" column="0">
-        <widget class="QGroupBox" name="groupBox">
-         <property name="title">
-          <string>鍘嗘椂鏌ヨ</string>
-         </property>
-         <widget class="QRadioButton" name="radioButton">
-          <property name="geometry">
-           <rect>
-            <x>20</x>
-            <y>20</y>
-            <width>115</width>
-            <height>19</height>
-           </rect>
-          </property>
-          <property name="text">
-           <string>鏃犳潈闄�</string>
-          </property>
-         </widget>
-         <widget class="QRadioButton" name="radioButton_2">
-          <property name="geometry">
-           <rect>
-            <x>150</x>
-            <y>20</y>
-            <width>115</width>
-            <height>19</height>
-           </rect>
-          </property>
-          <property name="text">
-           <string>鍙煡鐪�</string>
-          </property>
-         </widget>
-         <widget class="QRadioButton" name="radioButton_3">
-          <property name="geometry">
-           <rect>
-            <x>280</x>
-            <y>20</y>
-            <width>115</width>
-            <height>19</height>
-           </rect>
-          </property>
-          <property name="text">
-           <string>鍙慨鏀�</string>
-          </property>
-         </widget>
-        </widget>
-       </item>
        <item row="1" column="0">
         <widget class="QGroupBox" name="groupBox_2">
          <property name="title">
@@ -96,6 +60,52 @@
           </property>
          </widget>
          <widget class="QRadioButton" name="radioButton_6">
+          <property name="geometry">
+           <rect>
+            <x>280</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鍙慨鏀�</string>
+          </property>
+         </widget>
+        </widget>
+       </item>
+       <item row="0" column="0">
+        <widget class="QGroupBox" name="groupBox">
+         <property name="title">
+          <string>鍘嗘椂鏌ヨ</string>
+         </property>
+         <widget class="QRadioButton" name="radioButton">
+          <property name="geometry">
+           <rect>
+            <x>20</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鏃犳潈闄�</string>
+          </property>
+         </widget>
+         <widget class="QRadioButton" name="radioButton_2">
+          <property name="geometry">
+           <rect>
+            <x>150</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鍙煡鐪�</string>
+          </property>
+         </widget>
+         <widget class="QRadioButton" name="radioButton_3">
           <property name="geometry">
            <rect>
             <x>280</x>
@@ -248,17 +258,132 @@
          </widget>
         </widget>
        </item>
+       <item row="5" column="0">
+        <widget class="QGroupBox" name="groupBox_6">
+         <property name="title">
+          <string>璀︽姤绠$悊</string>
+         </property>
+         <widget class="QRadioButton" name="radioButton_16">
+          <property name="geometry">
+           <rect>
+            <x>20</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鏃犳潈闄�</string>
+          </property>
+         </widget>
+         <widget class="QRadioButton" name="radioButton_17">
+          <property name="geometry">
+           <rect>
+            <x>150</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鍙煡鐪�</string>
+          </property>
+         </widget>
+         <widget class="QRadioButton" name="radioButton_18">
+          <property name="geometry">
+           <rect>
+            <x>280</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鍙慨鏀�</string>
+          </property>
+         </widget>
+        </widget>
+       </item>
+       <item row="6" column="0">
+        <widget class="QGroupBox" name="groupBox_7">
+         <property name="title">
+          <string>鐗堟湰绠$悊</string>
+         </property>
+         <widget class="QRadioButton" name="radioButton_19">
+          <property name="geometry">
+           <rect>
+            <x>20</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鏃犳潈闄�</string>
+          </property>
+         </widget>
+         <widget class="QRadioButton" name="radioButton_20">
+          <property name="geometry">
+           <rect>
+            <x>150</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鍙煡鐪�</string>
+          </property>
+         </widget>
+         <widget class="QRadioButton" name="radioButton_21">
+          <property name="geometry">
+           <rect>
+            <x>280</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鍙慨鏀�</string>
+          </property>
+         </widget>
+        </widget>
+       </item>
+       <item row="7" column="0">
+        <widget class="QGroupBox" name="groupBox_8">
+         <property name="title">
+          <string>瓒呯骇绠$悊鍛�</string>
+         </property>
+         <widget class="QRadioButton" name="radioButton_22">
+          <property name="geometry">
+           <rect>
+            <x>20</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鏄�</string>
+          </property>
+         </widget>
+         <widget class="QRadioButton" name="radioButton_23">
+          <property name="geometry">
+           <rect>
+            <x>150</x>
+            <y>20</y>
+            <width>115</width>
+            <height>19</height>
+           </rect>
+          </property>
+          <property name="text">
+           <string>鍚�</string>
+          </property>
+         </widget>
+        </widget>
+       </item>
       </layout>
-     </item>
-     <item row="1" column="0">
-      <widget class="QDialogButtonBox" name="buttonBox">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="standardButtons">
-        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-       </property>
-      </widget>
      </item>
     </layout>
    </item>
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp"
index 71580ef..212aa8a 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp"
@@ -11,46 +11,20 @@
     ui(new Ui::PermissonWindow)
 {
     ui->setupUi(this);
-    clientSocket = new PmsClientSocket(this);
-
-    dia = new PermissonDialog(this,clientSocket);
-
-
-
-    connect(this,SIGNAL(sendUserNo(PmsQueryResult)),dia,SLOT(recvUserNo(PmsQueryResult)));
-    connect(clientSocket,SIGNAL(notifyDateChange(vector<PmsQueryResult>)),this,SLOT(renderItemData(vector<PmsQueryResult>)));
-
-    roleMap["鏅�氶噰鐭垮憳宸�"] = 1;
-    roleMap["鎶�鏈淮鎶や汉鍛�"] = 2;
-    roleMap["绯荤粺绠$悊鍛�"] = 3;
-    roleMap["瀹夊叏绠$悊浜哄憳"] = 4;
-
     this->setWindowTitle("鏉冮檺绠$悊");
     vector<QString> lableList;
     lableList.push_back("鍛樺伐缂栧彿");
     lableList.push_back("濮撳悕");
-    lableList.push_back("褰撳ぉ宸ヤ綔鏃堕棿");
-    lableList.push_back("褰撳ぉ缁撴潫鏃堕棿");
+    lableList.push_back("閮ㄩ棬");
+    lableList.push_back("鐧诲綍鏃堕棿");
+    lableList.push_back("娉ㄥ唽鏃堕棿");
+
     lableList.push_back("鑱屼綅");
+    clientSocket = new PmsClientSocket(this);
 
-
+    dia = new PermissonDialog(this,clientSocket);
 
     m_model = new QStandardItemModel(globalPms.size(),lableList.size(),this);
-
-    ui->tableView->setModel(m_model);
-
-    for(int i=0;i<m_model->rowCount();i++){
-        PmsQueryResult curRes = globalPms[i];
-        m_model->setItem(i,0,new QStandardItem(QString::fromStdString(curRes.getUserNo())));
-        m_model->setItem(i,1,new QStandardItem(QString::fromLocal8Bit(curRes.getName().c_str())));
-        m_model->setItem(i,2,new QStandardItem(QString::fromStdString(curRes.getStartDateTime())));
-        m_model->setItem(i,3,new QStandardItem(QString::fromStdString(curRes.getEndDateTime())));
-        m_model->setItem(i,4,new QStandardItem(QString::fromLocal8Bit(curRes.getPermissonType().c_str())));
-
-    }
-
-    ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
-    ui->tableView->verticalHeader()->hide();
 
 
     QStringList lable;
@@ -60,11 +34,22 @@
 
     m_model->setHorizontalHeaderLabels(lable);
 
+    ui->tableView->setModel(m_model);
+    ui->tableView->verticalHeader()->hide();
+
+    connect(this,SIGNAL(sendUserNo(PmsQueryResult)),dia,SLOT(recvUserNo(PmsQueryResult)));
+    connect(clientSocket,SIGNAL(notifyDateChange(vector<PmsQueryResult>)),this,SLOT(renderItemData(vector<PmsQueryResult>)));
+    connect(m_model,SIGNAL(itemChanged(QStandardItem*)),this,SLOT(listenItemChange(QStandardItem*)));
+
+
+    // 鍙戜竴娆℃煡璇㈠叏閮ㄦ暟鎹姹�
+    clientSocket->queryAllUserAboutUser();
+
+
+
+
     QComBoxDelegate * qc = new QComBoxDelegate(this);
-
-
-
-    ui->tableView->setItemDelegateForColumn(4,qc);
+    ui->tableView->setItemDelegateForColumn(5,qc);
 
 
     m = new QMenu(this);
@@ -82,17 +67,13 @@
     connect(ac1,&QAction::triggered,[=]{
          int row = ui->tableView->currentIndex().row();
          qDebug() << "鏇存柊褰撳墠鍛樺伐淇℃伅"
-                  <<  QString::fromStdString( globalPms[row].getUserNo());
+                  << globalPms[row].getUserNo();
          // 鍙戦�佸憳宸ョ紪鍙蜂俊鎭�
          emit sendUserNo(globalPms[row]);
 
          dia->setModal(true);
          dia->show();
     });
-
-
-    connect(m_model,SIGNAL(itemChanged(QStandardItem*)),this,SLOT(listenItemChange(QStandardItem*)));
-
 
 }
 
@@ -123,44 +104,50 @@
 
 void PermissonWindow::on_pushButton_clicked()
 {
-    qDebug() << "鍙戦�佹煡璇㈣姹�";
+
     PmsParam pm;
-    pm.setName(ui->lineEdit->text().toStdString());
-    pm.setPermissonType(ui->lineEdit_2->text().toStdString());
-    pm.setUserNo(ui->lineEdit_3->text().toStdString());
+    pm.setName(ui->lineEdit->text());
+    pm.setPermissonType(ui->lineEdit_2->text());
+    pm.setUserNo(ui->lineEdit_3->text());
 
     clientSocket->queryPmsByParam(pm);
-    qDebug() << "鏌ヨ涓�";
 
 }
 
 void PermissonWindow::listenItemChange(QStandardItem *item)
 {
-    QString localText = item->text();
-    if(roleMap.count(localText.toStdString())){
-        qDebug() << "鍙戣捣鑱屼綅鏇存柊璇锋眰";
+    if(item->column()==m_model->columnCount()-1){
+        QString localText = item->text();
+
         PmsPlusParma pm;
-        pm.setPermissonType(localText.toStdString());
-        pm.setRoleId(roleMap[localText.toStdString()]);
+        pm.setPermissonType(localText);
+
+        int id = globalPms[item->row()].getId();
+        pm.setId(id);
         clientSocket->updatePmsByParam(pm);
     }
 }
 
 void PermissonWindow::renderItemData(vector<PmsQueryResult> res)
 {
+
     globalPms = res;
     m_model->setRowCount(globalPms.size());
 
     for(int i=0;i<m_model->rowCount();i++){
         PmsQueryResult curRes = globalPms[i];
-        m_model->setItem(i,0,new QStandardItem(QString::fromStdString(curRes.getUserNo())));
-        m_model->setItem(i,1,new QStandardItem(QString::fromLocal8Bit(curRes.getName().c_str())));
-        m_model->setItem(i,2,new QStandardItem(QString::fromStdString(curRes.getStartDateTime())));
-        m_model->setItem(i,3,new QStandardItem(QString::fromStdString(curRes.getEndDateTime())));
-        m_model->setItem(i,4,new QStandardItem(QString::fromLocal8Bit(curRes.getPermissonType().c_str())));
+        m_model->setItem(i,0,new QStandardItem(curRes.getUserNo()));
+        m_model->setItem(i,1,new QStandardItem(curRes.getName()));
+        m_model->setItem(i,2,new QStandardItem(QString::fromStdString(curRes.getDepartment())));
+        m_model->setItem(i,3,new QStandardItem(QString::fromStdString(curRes.getLoginTime())));
+        m_model->setItem(i,4,new QStandardItem(QString::fromStdString(curRes.getRegisterTime())));
 
+        m_model->blockSignals(true);
+        m_model->setItem(i,5,new QStandardItem(curRes.getPermissonType()));
+        m_model->blockSignals(false);
     }
     ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+
     qDebug() << "鏌ヨ鍒扮殑鏁伴噺 " << globalPms.size();
 }
 
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h"
index a9f57be..d0e8f30 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h"
@@ -46,11 +46,13 @@
     QMenu * m;
     PermissonDialog *dia;
     SyncDataToDB * dbInfo;
-    map<string,int> roleMap;
+
 
     vector<PmsQueryResult> globalPms;
     PmsClientSocket * clientSocket;
 
+    bool isRenderData;
+
 
 };
 
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsparam.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsparam.h"
index 0683706..a3ac943 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsparam.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsparam.h"
@@ -1,32 +1,33 @@
 锘�#ifndef PMSPARAM_H
 #define PMSPARAM_H
+#include <QString>
 #include <string>
 using namespace std;
 
 
 class PmsParam {
 protected:
-    string userNo;
-    string name;
-    string permissonType;
+    QString userNo;
+    QString name;
+    QString permissonType;
 public:
-    void setUserNo(string id){
+    void setUserNo(QString id){
         this->userNo = id;
     }
-    void setName(string name){
+    void setName(QString name){
         this->name = name;
     }
-    void setPermissonType(string permissonType){
+    void setPermissonType(QString permissonType){
         this->permissonType = permissonType;
     }
 
-    string getUserNo(){
+    QString getUserNo(){
         return userNo;
     }
-    string getName(){
+    QString getName(){
         return name;
     }
-    string getPermissonType(){
+    QString getPermissonType(){
         return permissonType;
     }
 
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsplusparam.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsplusparam.h"
index 23885dd..789bdc7 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsplusparam.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsplusparam.h"
@@ -1,15 +1,19 @@
-#ifndef PMSPLUSPARAM_H
+锘�#ifndef PMSPLUSPARAM_H
 #define PMSPLUSPARAM_H
 #include "pmsparam.h"
 
 class PmsPlusParma : public PmsParam{
-    int roleId;
+    int id;
 
     int queryHistory;
     int loggerSearch;
     int mapMark;
     int devManage;
     int productPlan;
+
+    int warninManage;
+    int versionManage; //鐗堟湰绠$悊
+    int admin; //绯荤粺绠$悊鍛�
 public:
     void setQueryHistory(int val){
         this->queryHistory = val;
@@ -27,8 +31,8 @@
         this->productPlan = val;
     }
 
-    void setRoleId(int val){
-        this->roleId = val;
+    void setId(int val){
+        this->id = val;
     }
 
     int getQueryHistory(){
@@ -47,19 +51,51 @@
         return productPlan;
     }
 
-    int getRoleId(){
-        return roleId;
+    int getId(){
+        return id;
+    }
+
+    PmsPlusParma(){
+        id = 0;
+        queryHistory = 0;
+        loggerSearch = 0;
+        mapMark = 0;
+        devManage = 0;
+        productPlan = 0;
     }
 
 
-    PmsPlusParma(){
-        roleId = -1;
-        queryHistory = -1;
-        loggerSearch = -1;
-        mapMark = -1;
-        devManage = -1;
-        productPlan = -1;
+    int getVersionManage() const
+    {
+        return versionManage;
+    }
+
+    void setVersionManage(int value)
+    {
+        versionManage = value;
+    }
+
+    int getAdmin() const
+    {
+    return admin;
+    }
+
+    void setAdmin(int value)
+    {
+    admin = value;
+    }
+
+    int getWarninManage() const
+    {
+        return warninManage;
+    }
+
+    void setWarninManage(int value)
+    {
+        warninManage = value;
     }
 };
 
 #endif // PMSPLUSPARAM_H
+
+
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsqueryresult.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsqueryresult.h"
index e35b54f..602a8ed 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsqueryresult.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/pmsqueryresult.h"
@@ -1,10 +1,8 @@
-#ifndef PMSQUERYRESULT_H
+锘�#ifndef PMSQUERYRESULT_H
 #define PMSQUERYRESULT_H
 
 #include "pmsparam.h"
 class PmsQueryResult : public PmsParam{
-    string startDateTime;
-    string endDateTime;
 
     int queryHistory;
     int loggerSearch;
@@ -12,13 +10,22 @@
     int devManage;
     int productPlan;
 
+    int warninManage;
+    int versionManage; //鐗堟湰绠$悊
+    int admin; //绯荤粺绠$悊鍛�
+
+    int id;
     int roleId;
+
+    string department;
+    string loginTime;
+    string registerTime;
 public:
-    void setStartDateTime(string time){
-        this->startDateTime = time;
+    void setLoginTime(string time){
+        this->loginTime = time;
     }
-    void setEndDateTime(string time){
-        this->endDateTime = time;
+    void setRegisterTime(string time){
+        this->registerTime = time;
     }
 
     void setQueryHistory(int val){
@@ -36,16 +43,16 @@
     void setProductPlan(int val){
         this->productPlan = val;
     }
-    void setRoleId(int val){
-        this->roleId = val;
+    void setId(int val){
+        this->id = val;
     }
 
 
-    string getStartDateTime(){
-        return startDateTime;
+    string getLoginTime(){
+        return loginTime;
     }
-    string getEndDateTime(){
-        return endDateTime;
+    string getRegisterTime(){
+        return registerTime;
     }
     int getQueryHistory(){
         return queryHistory;
@@ -62,12 +69,58 @@
     int getProductPlan(){
         return productPlan;
     }
-    int getRoleId(){
-        return roleId;
+    int getId(){
+        return id;
     }
 
+
+
+
+    int getVersionManage() const
+    {
+        return versionManage;
+    }
+
+    void setVersionManage(int value)
+    {
+        versionManage = value;
+    }
+
+    int getAdmin() const
+    {
+    return admin;
+    }
+
+    void setAdmin(int value)
+    {
+    admin = value;
+    }
+
+    int getWarninManage() const
+    {
+        return warninManage;
+    }
+
+    void setWarninManage(int value)
+    {
+        warninManage = value;
+    }
+
+
+
+    string getDepartment() const
+    {
+        return department;
+    }
+
+    void setDepartment(const string &value)
+    {
+        department = value;
+    }
 
 };
 
 
 #endif // PMSQUERYRESULT_H
+
+
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.cpp"
index 8eab6b3..01d0fde 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.cpp"
@@ -16,7 +16,21 @@
 {
     QComboBox * box = new QComboBox(parent);
     QStringList text;
-    text << "鏅�氶噰鐭垮憳宸�" << "鎶�鏈淮鎶や汉鍛�" << "绯荤粺绠$悊鍛�"<< "瀹夊叏绠$悊浜哄憳";
+
+    QString curText = qvariant_cast<QString>(index.data());
+
+    vector<QString> vecq;
+    vecq.push_back("鎶�鏈淮鎶や汉鍛�");
+    vecq.push_back("绯荤粺绠$悊鍛�");
+    vecq.push_back("瀹夊叏绠$悊浜哄憳");
+    vecq.push_back("鏅�氶噰鐭垮憳宸�");
+
+    text << curText;
+    for(QString role : vecq){
+        if(curText!=role){
+            text << role;
+        }
+    }
     box->addItems(text);
 
     return box;
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.h"
index d9e575e..5e31c91 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/qcomboxdelegate.h"
@@ -1,12 +1,14 @@
-#ifndef QCOMBOXDELEGATE_H
+锘�#ifndef QCOMBOXDELEGATE_H
 #define QCOMBOXDELEGATE_H
 
 #include <QItemDelegate>
 #include <QComboBox>
-#pragma execution_character_set("utf-8")
+#include <vector>
+using namespace std;
 
 class QComBoxDelegate : public QItemDelegate
 {
+
 public:
     QComBoxDelegate();
     QComBoxDelegate(QObject * p=0);
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/syncdatatodb.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/syncdatatodb.cpp"
index 96ca144..47d836c 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/syncdatatodb.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/syncdatatodb.cpp"
@@ -23,17 +23,17 @@
 {
     string sql = "SELECT * FROM user_info AS u, employee_permisson AS e WHERE u.role_id=e.id";
 
-    if(!param.getUserNo().empty()){
-        sql += " and u.user_no='" + param.getUserNo() + "'";
-    }
+//    if(!param.getUserNo().empty()){
+//        sql += " and u.user_no='" + param.getUserNo() + "'";
+//    }
 
-    if(!param.getName().empty()){
-        sql += " and u.name='" + param.getName()+ "'";
-    }
+//    if(!param.getName().empty()){
+//        sql += " and u.name='" + param.getName()+ "'";
+//    }
 
-    if(!param.getPermissonType().empty()){
-        sql += " and e.permission_type='" + param.getPermissonType()+ "'";
-    }
+//    if(!param.getPermissonType().empty()){
+//        sql += " and e.permission_type='" + param.getPermissonType()+ "'";
+//    }
 
     qDebug() << "sql璇彞" << QString::fromStdString(sql);
 
@@ -56,16 +56,16 @@
     string sql = "update employee_permisson";
 
     // 鍙洿鏀硅亴浣�
-    if(!param.getPermissonType().empty()){
-        sql.append(" set permission_type='" + param.getPermissonType())+ "'";
-    }else{
-        sql.append(" set query_history=") + to_string(param.getQueryHistory());
-        sql.append(",logger_search=") + to_string(param.getLoggerSearch());
-        sql.append(",map_mark=") + to_string(param.getMapMark());
-        sql.append(",dev_manage=") + to_string(param.getDevManage());
-        sql.append(",product_plan=") + to_string(param.getProductPlan());
-    }
-    sql.append(" where e.id=" + param.getRoleId());
+//    if(!param.getPermissonType().empty()){
+//        sql.append(" set permission_type='" + param.getPermissonType())+ "'";
+//    }else{
+//        sql.append(" set query_history=") + to_string(param.getQueryHistory());
+//        sql.append(",logger_search=") + to_string(param.getLoggerSearch());
+//        sql.append(",map_mark=") + to_string(param.getMapMark());
+//        sql.append(",dev_manage=") + to_string(param.getDevManage());
+//        sql.append(",product_plan=") + to_string(param.getProductPlan());
+//    }
+    //sql.append(" where e.id=" + param.getRoleId());
 
     mysql_real_query(&mysql, sql.c_str(), sql.size());
     mysql_store_result(&mysql);
@@ -76,13 +76,13 @@
 
 void SyncDataToDB::setPmsResult(PmsQueryResult &res, char **row)
 {
-    res.setName(string(row[1]));
-    res.setUserNo(string(row[5]));
-    res.setStartDateTime(string(row[2]));
-    res.setEndDateTime(string(row[3]));
-    res.setRoleId(stoi(string(row[4])));
+//    res.setName(string(row[1]));
+//    res.setUserNo(string(row[5]));
+//    res.setStartDateTime(string(row[2]));
+//    res.setEndDateTime(string(row[3]));
+//    res.setRoleId(stoi(string(row[4])));
 
-    res.setPermissonType(string(row[8]));
+   // res.setPermissonType(string(row[8]));
     res.setQueryHistory(stoi(string(row[9])));
     res.setLoggerSearch(stoi(string(row[10])));
     res.setMapMark(stoi(string(row[11])));
@@ -90,5 +90,5 @@
     res.setProductPlan(stoi(string(row[13])));
 
 
-    qDebug() << QString::fromStdString(res.getUserNo());
+    //qDebug() << QString::fromStdString(res.getUserNo());
 }
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/PermissonManage.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/PermissonManage.cpp"
new file mode 100644
index 0000000..45d78a0
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/PermissonManage.cpp"
@@ -0,0 +1,152 @@
+#include "stdafx.h"
+#include "PermissonManage.h"
+#include <iostream>
+#include "MysqlConn.h"
+#include <string.h>
+#include <vector>
+using namespace std;
+
+
+PermissonManage::PermissonManage()
+{
+}
+
+
+PermissonManage::~PermissonManage()
+{
+}
+
+bool PermissonManage::queryPmsByParam(SOCKET client, QueryPmsReq * req)
+{
+	// 组装SQL语句
+	string sql = "SELECT * FROM user_info AS u, role_info AS e WHERE u.role_id=e.id";
+
+	if (*(req->userNo)) {
+		sql += " and u.user_no='" + string(req->userNo) + "'";
+	}
+
+	if (*(req->name)) {
+		sql += " and u.name='" + string(req->name) + "'";
+	}
+
+	if (*(req->permissonType)) {
+		sql += " and e.permission_type='" + string(req->permissonType) + "'";
+	}
+
+	cout << "sql:" << sql << endl;
+
+	// 调用MySQL API 执行SQL语句,根据返回值组装响应结构体
+	MysqlConn conn;
+	conn.connect("127.0.0.1", "root", "root", "mydb");
+
+
+	bool ret = conn.query (sql);
+
+	vector<PmsRes> pmsTempList;
+	while (conn.getResult()){
+		PmsRes pmsRes;
+		pmsRes.admin = stoi(conn.getField(22));
+		strcpy_s(pmsRes.department, conn.getField(1).c_str());
+
+		pmsRes.devManage = stoi(conn.getField(18));
+		pmsRes.id = stoi(conn.getField(0));
+		pmsRes.loggerSearch = stoi(conn.getField(16));
+		strcpy_s(pmsRes.loginTime, conn.getField(11).c_str());
+		pmsRes.mapMark = stoi(conn.getField(17));
+
+		strcpy_s(pmsRes.name, conn.getField(2).c_str());
+		strcpy_s(pmsRes.permissonType, conn.getField(14).c_str());
+		pmsRes.productPlan = stoi(conn.getField(19));
+		pmsRes.queryHistory = stoi(conn.getField(15));
+		strcpy_s(pmsRes.registerTime, conn.getField(12).c_str());
+		strcpy_s(pmsRes.userNo, conn.getField(4).c_str());
+		pmsRes.versionManage = stoi(conn.getField(21));
+		pmsRes.warningManage = stoi(conn.getField(20));
+		pmsTempList.push_back(pmsRes);
+
+
+		cout << "获取结果集2" <<  conn.getField(0) << conn.getField(1) << conn.getField(2);
+	}
+	
+	QueryPmsRes  *res;
+	int len = sizeof(QueryPmsRes) + pmsTempList.size() * sizeof(PmsRes);
+	res = (QueryPmsRes *)malloc(len);
+
+	
+	PmsRes * pmArr = new PmsRes[pmsTempList.size()];
+	for (int i = 0; i < pmsTempList.size();i++) {
+		pmArr[i] = pmsTempList[i];	
+	}
+
+	memcpy(res->pmsList,pmArr, pmsTempList.size() * sizeof(PmsRes));
+
+
+	res->head.type = QUERY_PMS_RES;
+	res->head.len = len;
+
+	if (ret > 0) {
+		res->success = 1; // 成功
+	}
+	else {
+		res->success = 0; // 失败
+	}
+	cout <<  "id="<< res->pmsList[0].id << endl;
+	// 发送结构体给客户端
+	cout << __FUNCTION__ << send(client, (char*)res, res->head.len, 0) << endl;
+
+	delete[] pmArr;
+	delete res;
+	return true;
+}
+
+bool PermissonManage::updatePms(SOCKET client, UpdatePmsReq * req)
+{
+	// 调用MySQL API 执行SQL语句,根据返回值组装响应结构体
+	MysqlConn conn;
+	conn.connect("127.0.0.1", "root", "root", "mydb");
+
+	char sql[512] = { 0 };
+
+	UpdatePmsRes res;
+	if (*(req->permissonType)) {
+
+		// 先用角色类型查一遍角色表id
+		sprintf(sql, "select id from role_info where permission_type='%s'", req->permissonType);
+		bool ret = conn.query(sql);
+		bool retRes = conn.getResult();
+		if (!ret || !retRes) {
+			res.success = 0;
+		}
+		else {
+			int roleId = stoi(conn.getField(0));
+			memset(sql, 0, 512);
+			sprintf(sql, "update user_info set role_id=%d where id=%d", roleId, req->id);
+			ret = conn.update(sql);
+			res.success = ret;
+		}
+	}
+	else {
+		// 先用id查一遍角色id
+		sprintf(sql,"select role_id from user_info where id=%d", req->id);
+
+		bool ret = conn.query(sql);
+		bool retRes = conn.getResult();
+		if (!ret || !retRes) {
+			res.success = 0;
+		}else {
+			int roleId = stoi(conn.getField(0));
+			memset(sql, 0, 512);
+			sprintf(sql, "update  role_info set query_history=%d,logger_search=%d,map_mark=%d,dev_manage=%d"
+							",product_plan=%d,warning_manage=%d,version_manage=%d,role_info.admin=%d where id=%d",req->queryHistory,req->loggerSearch,
+								req->mapMark,req->devManage,req->productPlan,req->warningManage,req->versionManage,req->admin,roleId);
+
+			cout << "更新权限sql:" << sql << endl;
+			ret = conn.update(sql);
+			res.success = ret;
+		}
+	}
+	// 发送结构体给客户端
+	cout << __FUNCTION__ << send(client, (char*)&res, res.head.len, 0) << endl;
+
+	return true;
+}
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/PermissonManage.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/PermissonManage.h"
new file mode 100644
index 0000000..2c9335d
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/PermissonManage.h"
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "common.h"
+#include <WinSock2.h>
+#include <string>
+using namespace std;
+
+class PermissonManage
+{
+public:
+	PermissonManage();
+	~PermissonManage();
+	bool queryPmsByParam(SOCKET client, QueryPmsReq * req);
+	bool updatePms(SOCKET client, UpdatePmsReq * req);
+};
+
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/ServerSocket.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/ServerSocket.cpp"
new file mode 100644
index 0000000..9b7c45a
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/ServerSocket.cpp"
@@ -0,0 +1,166 @@
+#include "stdafx.h"
+#include "ServerSocket.h"
+#include "common.h"
+#include "DeviceManage.h"
+#include "PermissonManage.h"
+
+#define HEART_CHECK_TIMES 60  // 心跳检测的次数
+
+struct TestData
+{
+	int type;
+	int len;
+	char data[32];
+};
+
+ServerSocket::ServerSocket(bool openHeartCheck):m_openHeartCheck(openHeartCheck)
+{
+	if (initSocket()) {
+		cout << "init socket ok" << endl;
+	}
+	else {
+		cout << "init socket fail" << endl;
+	}
+}
+
+
+ServerSocket::~ServerSocket()
+{
+	closesocket(m_server); //  关闭服务端套接字
+	WSACleanup(); // 关闭网络环境
+}
+
+bool ServerSocket::initSocket()
+{
+	WSAData wsa = { 0 };
+	WSAStartup(MAKEWORD(2, 2), &wsa); // 启动网络环境
+	// SOCK_STREAM:TCP协议
+	// SOCK_DGRAM:UDP协议
+	m_server = socket(AF_INET, SOCK_STREAM, 0);
+	SOCKADDR_IN addr;
+	addr.sin_family = AF_INET;
+	addr.sin_port = htons(16888);
+	addr.sin_addr.S_un.S_addr = 0;
+	int ret_bind = ::bind(m_server, (sockaddr*)&addr, sizeof(addr));
+	if (ret_bind) {
+		cout << "bind fail:" << WSAGetLastError() << endl;
+		return false;
+	}
+	int ret_listen = listen(m_server, 5);
+	if (ret_listen) {
+		cout << "listen fail:" << WSAGetLastError() << endl;
+		return false;
+	}
+	// 正常,成功初始化
+	// 启动accept线程
+	thread accept_thread(&ServerSocket::acceptThread, this);
+	accept_thread.detach(); // 剥离线程,防止异常结束
+	// 启动心跳检测线程
+	thread heart_check_thread(&ServerSocket::heartCheckThread, this);
+	heart_check_thread.detach();
+
+	return true;
+}
+
+void ServerSocket::acceptThread()
+{
+	while (true)
+	{
+		SOCKADDR_IN addr;
+		SOCKET client; // 当前连接上的客户端套接字
+		int len = sizeof(addr);
+
+		cout << "wait for conn..." << endl;
+		client = accept(m_server, (sockaddr*)&addr, &len);
+		cout << "conn client:" << client << endl;
+
+		if (client == SOCKET_ERROR) {
+			cout << "socket error:" << WSAGetLastError() << endl;
+			break;
+		}
+		else if (client == 0) {
+			cout << "socket close:" << WSAGetLastError() << endl;
+			break;
+		}
+		// 正常
+			// 建立新的键值对
+		m_clientsMap[client] = HEART_CHECK_TIMES;
+		// 创建长连接的线程
+		thread recv_send_thread(&ServerSocket::recvAndSendThread, this, client);
+		recv_send_thread.detach();
+	}
+}
+void ServerSocket::recvAndSendThread(SOCKET client)
+{
+	while (true) {
+		char buffer[1024] = { 0 };
+		int len_recv = recv(client, buffer, sizeof(buffer), 0);
+		cout << "len_recv:" << len_recv << " client:" << client << endl;
+		if (len_recv <= 0) {
+			cout << "client socket 已关闭或异常结束:" << WSAGetLastError() << endl;
+			break;
+		}
+		// 正常
+			// 重置心跳阈值
+		m_clientsMap[client] = HEART_CHECK_TIMES; 
+		// 解包处理
+		cout << "buffer:" << buffer << endl;
+		
+		int type = *(int*)buffer;
+		if (type == 100) {
+			TestData* td = (TestData*)buffer;
+			cout << "收到结构体:" << td->len << " " << td->data << endl;
+		}
+		else if (type == AD_REQ) {
+			// 添加设备
+			cout << "收到添加设备请求" << endl;
+			ADReq *req = (ADReq*)buffer;
+			cout << "设备名称" << req->devInfo[0].deviceName << endl;
+
+			// 调用 添加设备 业务API
+			DeviceManage devMan;
+			devMan.addDeviceBusiness(client, req);
+		}
+		else if (type == QUERY_PMS_REQ) {
+			cout << "查询权限请求" << endl;
+			QueryPmsReq * req = (QueryPmsReq *)buffer;
+			PermissonManage pmsManage;
+			pmsManage.queryPmsByParam(client, req);
+		
+		}
+		else if (type == UPDATE_PMS_REQ) {
+			cout << "更新权限请求" << endl;
+			UpdatePmsReq * req = (UpdatePmsReq *)buffer;
+			PermissonManage pmsManage;
+			pmsManage.updatePms(client, req);
+
+		}
+
+		// 原封不动的回收到的内容给对应客户端
+		//send(client, buffer, len_recv, 0);
+	}
+	closesocket(client);
+}
+
+void ServerSocket::heartCheckThread()
+{
+	while (m_openHeartCheck)
+	{
+		// 轮询map
+		for (auto iter = m_clientsMap.begin();iter != m_clientsMap.end();) {
+			iter->second--; // 阈值递减
+			cout << "client:" << iter->first << " 阈值:" << iter->second << endl;
+			if (iter->second == 0) {
+				// 连接无效了,关闭连接,再删除
+				cout << "发现无效客户端连接:" << iter->first << endl;
+				closesocket(iter->first);
+				iter = m_clientsMap.erase(iter); // 接收返回值,防止迭代器失效
+			}
+			else {
+				++iter;
+			}
+		}
+		// 间隔5秒
+		Sleep(5 * 1000); // 睡眠5000毫秒,就是5秒
+	}
+}
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/common.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/common.h"
new file mode 100644
index 0000000..bc4085c
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/\346\234\215\345\212\241\347\253\257\344\270\232\345\212\241\344\273\243\347\240\201/common.h"
@@ -0,0 +1,1064 @@
+锘�#ifndef COMMON_H
+#define COMMON_H
+
+#include <string.h>
+
+enum TypeInfo {
+
+	//娉ㄥ唽鐧诲綍
+	LOGIN_REQ, // 鐧诲綍璇锋眰
+	LOGIN_RES, // 鐧诲綍鍝嶅簲
+	REGISTER_REQ, //娉ㄥ唽璇锋眰
+	REGISTER_RES, //娉ㄥ唽鍝嶅簲
+	RESET_REQ, //閲嶇疆瀵嗙爜璇锋眰
+	RESET_RES, //閲嶇疆瀵嗙爜鍝嶅簲
+
+
+	//鏉冮檺绠$悊
+	QUERY_PMS_REQ,      // 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰
+	UPDATE_PMS_REQ,     // 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰
+	QUERY_PMS_RES,      // 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣�
+	UPDATE_PMS_RES,     // 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣�
+
+	//璁惧绠$悊
+	AD_REQ,//娣诲姞璁惧璇锋眰
+	AD_RES,//娣诲姞璁惧鍝嶅簲
+	MD_REQ,//淇敼璁惧璇锋眰
+	MD_RES,//淇敼璁惧鍝嶅簲
+	QD_REQ,//鏌ヨ璁惧璇锋眰
+	QD_RES,//鏌ヨ璁惧鍝嶅簲
+
+	//鍦板浘鏍囨敞
+	MML_REQ,//鍦板浘鏍囨敞鍔犺浇璇锋眰
+	MML_RES,//鍦板浘鏍囨敞鍔犺浇鍝嶅簲	
+	MMI_REQ,//鍦板浘鏍囨敞鎻掑叆璇锋眰
+	MMI_RES,//鍦板浘鏍囨敞鎻掑叆鍝嶅簲	
+	MMD_REQ,//鍦板浘鏍囨敞鍒犻櫎璇锋眰
+	MMD_RES,//鍦板浘鏍囨敞鍒犻櫎鍝嶅簲
+
+	//澶у睆鏄剧ず
+	ENVIRONMENT_REQ,//鐜鏁版嵁璇锋眰
+	ENVIRONMENT_RES,//鐜鏁版嵁鍝嶅簲
+	DEVICESTATUS_REQ,//璁惧鐘舵�佽姹�
+	DEVICESTATUS_RES,//璁惧鐘舵�佸搷搴�
+	MOVEMENTRECORD_REQ,//鎿嶄綔鏃ュ織璇锋眰
+	MOVEMENTRECORD_RES,//鎿嶄綔鏃ュ織鍝嶅簲
+	ALARMRECORD_REQ,//璀︽姤璁板綍璇锋眰
+	ALARMRECORD_RES,//璀︽姤璁板綍鍝嶅簲
+	YIELD_REQ,//鐓ょ熆浜ч噺璇锋眰
+	YIELD_RES,//鐓ょ熆浜ч噺鍝嶅簲
+
+	//璀︽姤绠$悊
+	WARNING_REQ, // 璀︽姤璇锋眰
+	WARNING_RES, // 璀︽姤鍝嶅簲
+
+
+	//鐢熶骇璁″垝绠$悊
+	ADD_PDPLAN_REQ,//娣诲姞涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�
+	ADD_PDPLAN_RES,//娣诲姞涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+	DEL_PDPLAN_REQ,//鍒犻櫎涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�
+	DEL_PDPLAN_RES,//鍒犻櫎涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+	UPDATE_PDPLAN_REQ,//鏇存敼涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�
+	UPDATE_PDPLAN_RES,//鏇存敼涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+	QUERY_PDPLAN_REQ,//鏌ヨ涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�
+	QUERY_PDPLAN_RES,//鏌ヨ涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+
+
+	ADD_MONOUTPUT_REQ,//娣诲姞鏈堜骇閲忕殑璇锋眰缁撴瀯浣�
+	ADD_MONOUTPUT_RES,//娣诲姞鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+	DEL_MONOUTPUT_REQ,//鍒犻櫎鏈堜骇閲忕殑璇锋眰缁撴瀯浣�
+	DEL_MONOUTPUT_RES,//鍒犻櫎鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+	UPDATE_MONOUTPUT_REQ,//鏇存柊鏈堜骇閲忕殑璇锋眰缁撴瀯浣�
+	UPDATE_MONOUTPUT_RES,//鏇存柊鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+	QUERY_MONOUTPUT_REQ,//鏌ヨ鏈堜骇閲忕殑璇锋眰缁撴瀯浣�
+	QUERY_MONOUTPUT_RES,//鏌ヨ鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+
+
+	//鑷姩鍗囩骇
+	VERSION_NUM_REQ,  // 鐗堟湰鍙疯姹�
+	VERSION_NUM_RES,   // 鐗堟湰鍙峰搷搴�
+	UPLOAD_FILE_REQ, // 涓婁紶鏂囦欢鐨勮姹�
+	UPLOAD_FILE_RES, // 涓婁紶鏂囦欢鐨勫搷搴�
+	VERSION_INFOENTRY_REQ,       // 鐗堟湰淇℃伅褰曞叆璇锋眰
+	VERSION_INFOENTRY_RES,       //鐗堟湰淇℃伅褰曞叆鍝嶅簲
+	VERSION_UPDATE_REQ, // 鐗堟湰鏇存柊璇锋眰
+	VERSION_UPDATE_RES, // 鐗堟湰鏇存柊鍝嶅簲
+	FILE_DOWNLOADS_REQ, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇璇锋眰
+	FILE_DOWNLOADS_RES, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇鍝嶅簲
+	DOWNLOAD_SUCCESSFULLY_RES,       // 鏇存柊鏂囦欢涓嬭浇鎴愬姛鐨勫搷搴�
+
+	//鏃ュ織
+	LOGSEARCH_REQ,//鏃ュ織鏌ヨ璇锋眰
+	LOGSEARCH_RES,//鏃ュ織鏌ヨ鍝嶅簲
+
+};
+
+struct Head {
+	int type;
+	int len;
+};
+
+//娉ㄥ唽鐧诲綍
+//鐧诲綍璇锋眰 
+struct LoginReq
+{
+	Head head;
+	char userName[32];
+	char password[32];
+	LoginReq() {
+		head.type = LOGIN_REQ;
+		head.len = sizeof(LoginReq);
+	}
+};
+
+struct Permission
+{
+	int admin;//瓒呯骇绠$悊鍛�
+	int loggerSearch; //鏃ュ織鏌ヨ
+	int queryHistory; //鍘嗗彶璁板綍
+	int mapMark;//鍦板浘
+	int versionManage; // 鐗堟湰绠$悊
+	int warning; //璀︽姤
+	int devManage; //璁惧绠$悊
+	int productPlan;//鐢熶骇璁″垝
+	char roleName[32]; // 瑙掕壊鍚�
+};
+
+//鐧诲綍鍝嶅簲
+struct LoginRes
+{
+	Head head;
+	char userName[32];
+	int status; // 鐧诲綍鐘舵��
+	// 鐧诲綍鎴愬姛鏃讹紝璇ヨ处鍙峰搴旂殑鏉冮檺缁勫悎
+	Permission per;
+	LoginRes()
+	{
+		head.type = LOGIN_RES;
+		head.len = sizeof(LoginRes);
+	}
+};
+
+//娉ㄥ唽璇锋眰 
+struct RegisterReq
+{
+	Head head;
+	char userName[32];
+	char password[32];
+	char email[50];
+	char capcha[10];//楠岃瘉鐮�
+	char telephone[32];
+	RegisterReq() {
+		head.type = REGISTER_REQ;
+		head.len = sizeof(RegisterReq);
+	}
+};
+
+//娉ㄥ唽鍝嶅簲
+struct RegisterRes
+{
+	Head head;
+	char userName[32];
+	int status; // 娉ㄥ唽鐘舵��
+	RegisterRes()
+	{
+		head.type = REGISTER_RES;
+		head.len = sizeof(RegisterRes);
+	}
+};
+
+//閲嶇疆瀵嗙爜璇锋眰 
+struct ResetReq
+{
+	Head head;
+	char email[50];
+	char capcha[10];//楠岃瘉鐮�
+	char password[32];//鏂板瘑鐮�
+	char confirmPassword[32];//纭瀵嗙爜
+	ResetReq() {
+		head.type = RESET_REQ;
+		head.len = sizeof(ResetReq);
+	}
+};
+
+//閲嶇疆瀵嗙爜鍝嶅簲
+struct ResetRes
+{
+	Head head;
+	char user_name[32];
+	int status; // 閲嶇疆瀵嗙爜鐘舵��
+	ResetRes()
+	{
+		head.type = RESET_RES;
+		head.len = sizeof(ResetRes);
+	}
+};
+
+//鏉冮檺绠$悊
+// 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰
+typedef struct QueryPmsReq {
+	Head head;
+	char userNo[32];
+	char name[32];
+	char permissonType[32];
+	QueryPmsReq() {
+		head.type = QUERY_PMS_REQ;
+		memset(userNo, 0, 32);
+		memset(permissonType, 0, 32);
+		memset(name, 0, 32);
+		head.len = sizeof(QueryPmsReq);
+	}
+} QueryPmsReq;
+
+// 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰
+typedef struct UpdatePmsReq {
+	Head head;
+	// 浜哄憳琛ㄤ富閿甶d
+	int id;
+	int queryHistory;
+	int loggerSearch;
+	int mapMark;
+	int devManage;
+	int productPlan;
+	int warningManage;
+	int versionManage; //鐗堟湰绠$悊
+	int admin; //绯荤粺绠$悊鍛�
+
+	char permissonType[32];
+	UpdatePmsReq() {
+		head.type = QUERY_PMS_RES;
+		head.len = sizeof(UpdatePmsReq);
+	}
+} UpdatePmsReq;
+
+// 鍗曚釜浜哄憳鍜屾潈闄愯仈鍚堟煡璇㈢粨鏋勪綋
+typedef struct PmsRes {
+	int queryHistory;
+	int loggerSearch;
+	int mapMark;
+	int devManage;
+	int productPlan;
+	int versionManage; //鐗堟湰绠$悊
+	int warningManage;
+	int admin; //绯荤粺绠$悊鍛�
+
+	int id;
+
+	char userNo[32];
+	char name[32];
+
+	char permissonType[32];  // 瑙掕壊绫诲瀷
+
+	char department[32];
+	char loginTime[32];
+	char registerTime[32];
+} PmsRes;
+
+// 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣�
+typedef struct QueryPmsRes {
+	Head head;
+	int success; // 1涓烘垚鍔� ,0涓哄け璐�
+	PmsRes pmsList[0];
+	QueryPmsRes() {
+		head.type = QUERY_PMS_REQ;
+	}
+} QueryPmsRes;
+
+// 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣�
+struct UpdatePmsRes {
+	Head head;
+	int success; // 1涓烘垚鍔� ,0涓哄け璐�
+	UpdatePmsRes() {
+		head.type = UPDATE_PMS_RES;
+		head.len = sizeof(UpdatePmsRes);
+	}
+
+};
+
+
+
+
+//璁惧绠$悊
+struct DevicesInfo
+{
+	char deviceName[32];//璁惧鍚嶇О
+	char deviceStatus[32];//璁惧鐘舵��
+    char area[32]; // 鍦板尯
+    double longitude;//缁忓害
+    double latitude;//绾害
+    char purchasingTime[15];//璐拱鏃堕棿
+    char installTime[15];//瀹夎鏃堕棿
+	char manufacturer[100];//鍘傚
+    char devicesSerialNumber[32];//璁惧缂栫爜
+	char devicesType[32];//璁惧绫诲瀷
+};
+//娣诲姞璁惧
+struct ADReq//娣诲姞璇锋眰
+{
+	Head head;
+    DevicesInfo devInfo[0];
+
+	ADReq() {
+		head.type = AD_REQ;
+		head.len = sizeof(ADReq);
+	}
+
+};
+
+struct ADRes//娣诲姞鍝嶅簲
+{
+	Head head;
+	int status;
+	ADRes() {
+		head.type = AD_RES;
+		head.len = sizeof(ADRes);
+	}
+
+};
+//淇敼璁惧
+struct MDRes//淇敼鍝嶅簲
+{
+	Head head;
+	DevicesInfo info;
+	MDRes() {
+		head.type = MD_RES;
+		head.len = sizeof(MDRes);
+	}
+};
+struct MDReq//淇敼璇锋眰
+{
+	Head head;
+	int type;
+	MDReq() {
+		head.type = MD_REQ;
+		head.len = sizeof(MDReq);
+	}
+};
+//鏌ヨ璁惧
+struct QDReq//鏌ヨ璇锋眰
+{
+	Head head;
+	DevicesInfo info;
+	QDReq() {
+		head.type = QD_REQ;
+		head.len = sizeof(QDReq);
+	}
+};
+struct QDRes//鏌ヨ鍝嶅簲
+{
+	Head head;
+	int type;
+	QDRes() {
+		head.type = QD_RES;
+		head.len = sizeof(QDRes);
+	}
+};
+
+
+//鍦板浘鏍囨敞
+struct MarkInfo
+{
+	int markId;//鏍囨敞鐐筰d
+	double latitude;//绾害
+	double longitude;//缁忓害
+	int deviceId;//璁惧ID
+	int deviceStatus;//璁惧鐘舵��
+	char deviceName[32];//璁惧鍚嶇О
+};
+//鍦板浘鏍囨敞鍔犺浇璇锋眰
+struct MMLReq//鍦板浘
+{
+	Head head;
+	MMLReq() {
+		head.type = MML_REQ;
+		head.len = sizeof(MMLReq);
+	}
+};
+//鍦板浘鏍囨敞鍔犺浇鍝嶅簲锛�
+struct MMLRes
+{
+	Head head;
+	int status;//鎿嶄綔鐘舵��
+	MarkInfo info[0];
+	MMLRes() {
+		head.type = MML_RES;
+		head.len = sizeof(MMLRes);
+	}
+};
+//鍦板浘鏍囨敞鎻掑叆璇锋眰
+struct MMIReq//鍦板浘
+{
+	Head head;
+	MarkInfo info[0];
+	MMIReq() {
+		head.type = MMI_REQ;
+		head.len = sizeof(MMIReq);
+	}
+};
+//鍦板浘鏍囨敞鎻掑叆鍝嶅簲锛�
+struct MMIRes
+{
+	Head head;
+	int status;//鎿嶄綔鐘舵��
+	MarkInfo info[0];
+	MMIRes() {
+		head.type = MMI_RES;
+		head.len = sizeof(MMIRes);
+	}
+};
+
+//鍦板浘鏍囨敞鍒犻櫎璇锋眰
+struct MMDReq//鍦板浘
+{
+	Head head;
+	MarkInfo info[0];
+	MMDReq() {
+		head.type = MMD_REQ;
+		head.len = sizeof(MMDReq);
+	}
+};
+//鍦板浘鏍囨敞鍒犻櫎鍝嶅簲锛�
+struct MMDRes
+{
+	Head head;
+	int status;//鎿嶄綔鐘舵��
+	MarkInfo info[0];
+	MMDRes() {
+		head.type = MMD_RES;
+		head.len = sizeof(MMDRes);
+	}
+};
+
+//澶у睆鏄剧ず
+//鐜鏁版嵁璇锋眰
+struct EnvironmentReq
+{
+	Head head;
+	EnvironmentReq() {
+		head.type = ENVIRONMENT_REQ;
+		head.len = sizeof(EnvironmentReq);
+	}
+};
+//鐜鏁版嵁鍝嶅簲
+struct Environment
+{
+	double longitude;//缁忓害
+	double latitude;//绾害
+	float temp;//娓╁害
+	float humidity;//婀垮害
+	float oxygen;//姘ф皵娴撳害
+	float carbon;//涓�姘у寲纰虫祿搴�
+};
+struct EnvironmentRes
+{
+	Head head;
+	int status;
+	Environment environment[0];
+	EnvironmentRes() {
+		head.type = ENVIRONMENT_RES;
+		head.len = sizeof(EnvironmentRes);
+	}
+};
+//璁惧鐘舵�佽姹�
+struct DeviceStatusReq
+{
+	Head head;
+	DeviceStatusReq() {
+		head.type = DEVICESTATUS_REQ;
+		head.len = sizeof(DeviceStatusReq);
+	}
+};
+//璁惧鐘舵�佸搷搴�
+struct DeviceStatus
+{
+	double longitude;//缁忓害
+	double latitude;//绾害
+	int deviceID;//璁惧缂栧彿
+	char deviceName[32];//璁惧鍚嶇О
+	char deviceStatus[32];//璁惧鐘舵��
+};
+struct DeviceStatusRes
+{
+	Head head;
+	int status;
+	DeviceStatus deviceStatus[0];
+	DeviceStatusRes() {
+		head.type = DEVICESTATUS_RES;
+		head.len = sizeof(DeviceStatusRes);
+	}
+};
+//鎿嶄綔鏃ュ織璇锋眰
+struct MovementRecordReq
+{
+	Head head;
+	MovementRecordReq() {
+		head.type = MOVEMENTRECORD_REQ;
+		head.len = sizeof(MovementRecordReq);
+	}
+};
+//鎿嶄綔鏃ュ織鍝嶅簲
+struct MovementRecord
+{
+	double longitude;//缁忓害
+	double latitude;//绾害
+	char userName;//鎿嶄綔鐢ㄦ埛鍚�
+	char operateTime[32];//鎿嶄綔鏃堕棿
+	char deviceName[32];//鎿嶄綔璁惧
+	char movement[256];//鎿嶄綔鎻忚堪
+};
+struct MovementRecordRes
+{
+	Head head;
+	int status;
+	MovementRecord movementRecord[0];
+	MovementRecordRes() {
+		head.type = MOVEMENTRECORD_RES;
+		head.len = sizeof(MovementRecordRes);
+	}
+};
+//璀︽姤璁板綍璇锋眰
+struct AlarmRecordReq
+{
+	Head head;
+	AlarmRecordReq() {
+		head.type = ALARMRECORD_REQ;
+		head.len = sizeof(AlarmRecordReq);
+	}
+};
+//璀︽姤璁板綍鍝嶅簲
+struct AlarmRecord
+{
+	double longitude;//缁忓害
+	double latitude;//绾害
+	char alarmTime[32];//璀︽姤鏃堕棿
+	char alarmtype[32];//澶勭悊鏃堕棿
+	char alarmContent[256];//璀︽姤鍐呭
+};
+struct AlarmRecordRes
+{
+	Head head;
+	int status;
+	AlarmRecord alarmRecord[0];
+	AlarmRecordRes() {
+		head.type = ALARMRECORD_RES;
+		head.len = sizeof(AlarmRecordRes);
+	}
+};
+//鐓ょ熆浜ч噺璇锋眰
+struct YieldReq
+{
+	Head head;
+	YieldReq() {
+		head.type = YIELD_REQ;
+		head.len = sizeof(YieldReq);
+	}
+};
+//鐓ょ熆浜ч噺鍝嶅簲
+struct Yield
+{
+	int month;//鏈堜唤
+	int output;//浜ч噺
+};
+struct YieldRes
+{
+	Head head;
+	int status;
+	Yield yield[0];
+	YieldRes() {
+		head.type = YIELD_RES;
+		head.len = sizeof(YieldRes);
+	}
+};
+
+//璀︽姤绠$悊
+// 璀︽姤璇锋眰缁撴瀯浣�  
+struct WarningReq {
+	Head head;
+
+	float oxygenWarning;
+	float carbonWarning;
+	float tempWarning;
+	float humidityWarning;
+
+	WarningReq() {
+		head.type = WARNING_REQ;
+		head.len = sizeof(WarningReq);
+	}
+};
+
+
+struct DataThreshold {
+	//闃堝��
+	float oxygenThreshold;
+	float carbonThreshold;
+	float tempThreshold;
+	float humidityThreshold;
+};
+
+struct Data {
+	float oxygen;   // 姘ф皵娴撳害  
+	float carbon;   // 涓�姘у寲纰虫祿搴�  
+	float temp;     // 娓╁害  
+	float humidity; // 婀垮害 
+};
+
+// 璀︽姤鍝嶅簲缁撴瀯浣�  
+struct WarningRes {
+	Head head;
+	int status;         // 鍝嶅簲鐘舵�侊紙姣斿 0 琛ㄧず鎴愬姛锛�1 琛ㄧず澶辫触绛夛級  
+	const char* message; // 鍝嶅簲娑堟伅鎻忚堪  
+
+	WarningRes(int stat, const char* msg) {
+		head.type = WARNING_RES;
+		head.len = sizeof(WarningRes);
+		status = stat;
+		message = msg;
+	}
+};
+
+//鐢熶骇璁″垝绠$悊
+struct PdplanInfo
+{
+	int planId;//璁㈠崟缂栧彿
+	char planName[32];//璁㈠崟鍚嶅瓧
+	char startDate[32];//璧峰鏃ユ湡
+	char closingDate[32];//浜や粯鏃ユ湡
+	char pdName[8];//浜у搧鍚�
+	double plannedPd;//璁″垝鐢熶骇閲�
+	double actualPd;//瀹為檯鐢熶骇閲�
+	double progress;//鐢熶骇杩涘害
+	int finishOntime;//鏄惁鎸夋湡瀹屾垚
+};
+
+struct MonoutputInfo
+{
+	int month;//鏈堜唤
+	double aOutput;//a浜у搧鏈堜骇閲�
+	double bOutput;//b浜у搧鏈堜骇閲�
+	double cOutput;//c浜у搧鏈堜骇閲�
+};
+
+//娣诲姞涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�
+struct AddPdplanReq
+{
+	Head head;
+	PdplanInfo info[0];
+	AddPdplanReq() {
+		head.type = ADD_PDPLAN_REQ;
+		head.len = sizeof(AddPdplanReq);
+	}
+};
+
+//娣诲姞涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+struct AddPdplanRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁娣诲姞鎴愬姛锛�0鍚�1鏄�
+	AddPdplanRes() {
+		head.type = ADD_PDPLAN_RES;
+		head.len = sizeof(AddPdplanRes);
+	}
+};
+
+//鍒犻櫎涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�
+struct DelPdplanReq
+{
+	Head head;
+	PdplanInfo info[0];
+	DelPdplanReq() {
+		head.type = DEL_PDPLAN_REQ;
+		head.len = sizeof(DelPdplanReq);
+	}
+};
+
+//鍒犻櫎涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+struct DelPdplanRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁鍒犻櫎鎴愬姛锛�0鍚�1鏄�
+	DelPdplanRes() {
+		head.type = DEL_PDPLAN_RES;
+		head.len = sizeof(DelPdplanRes);
+	}
+};
+
+//鏇存敼涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�.
+struct UpdatePdplanReq
+{
+	Head head;
+	PdplanInfo info[0];
+	UpdatePdplanReq() {
+		head.type = UPDATE_PDPLAN_REQ;
+		head.len = sizeof(UpdatePdplanReq);
+	}
+};
+
+//鏇存敼涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+struct UpdatePdplanRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁鏇存柊鎴愬姛锛�0鍚�1鏄�
+	PdplanInfo info[0];
+	UpdatePdplanRes() {
+		head.type = UPDATE_PDPLAN_RES;
+		head.len = sizeof(UpdatePdplanRes);
+	}
+};
+
+//鏌ヨ涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣�
+struct QueryPdplanReq
+{
+	Head head;
+	int planId;//璁㈠崟缂栧彿
+	char planName[32];//璁㈠崟鍒掑悕瀛�
+	char startDate[32];//璧峰鏃ユ湡
+	char closingDate[32];//浜や粯鏃ユ湡
+	char pdName[8];//浜у搧鍚�
+	double plannedPd;//璁″垝鐢熶骇閲�
+	double actualPd;//瀹為檯鐢熶骇閲�
+	double progress;//鐢熶骇杩涘害
+	int finishOntime;//鏄惁鎸夋湡瀹屾垚
+	QueryPdplanReq() {
+		head.type = QUERY_PDPLAN_REQ;
+		head.len = sizeof(QueryPdplanReq);
+	}
+};
+
+//鏌ヨ涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣�
+struct QueryPdplanRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁娣诲姞鎴愬姛锛�0鍚�1鏄�
+	PdplanInfo info[0];
+	QueryPdplanRes() {
+		head.type = QUERY_PDPLAN_RES;
+		head.len = sizeof(QueryPdplanRes);
+	}
+};
+
+
+//娣诲姞鏈堜骇閲忕殑璇锋眰缁撴瀯浣�
+struct AddMonoutputReq
+{
+	Head head;
+	MonoutputInfo info[0];
+	AddMonoutputReq() {
+		head.type = ADD_MONOUTPUT_REQ;
+		head.len = sizeof(AddMonoutputReq);
+	}
+};
+
+//娣诲姞鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+struct AddMonoutputRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁娣诲姞鎴愬姛锛�0鍚�1鏄�
+	AddMonoutputRes() {
+		head.type = ADD_MONOUTPUT_RES;
+		head.len = sizeof(AddMonoutputRes);
+	}
+};
+
+//鍒犻櫎鏈堜骇閲忕殑璇锋眰缁撴瀯浣�
+struct DelMonoutputReq
+{
+	Head head;
+	MonoutputInfo info[0];
+	DelMonoutputReq() {
+		head.type = DEL_MONOUTPUT_REQ;
+		head.len = sizeof(DelMonoutputReq);
+	}
+};
+
+//鍒犻櫎鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+struct DelMonoutputRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁鍒犻櫎鎴愬姛锛�0鍚�1鏄�
+	DelMonoutputRes() {
+		head.type = DEL_MONOUTPUT_RES;
+		head.len = sizeof(DelMonoutputRes);
+	}
+};
+
+//鏇存敼鏈堜骇閲忕殑璇锋眰缁撴瀯浣�.
+struct UpdateMonoutputReq
+{
+	Head head;
+	MonoutputInfo info[0];
+	UpdateMonoutputReq() {
+		head.type = UPDATE_MONOUTPUT_REQ;
+		head.len = sizeof(UpdateMonoutputReq);
+	}
+};
+
+//鏇存敼鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+struct UpdateMonoutputRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁鏇存柊鎴愬姛锛�0鍚�1鏄�
+	MonoutputInfo info[0];
+	UpdateMonoutputRes() {
+		head.type = UPDATE_MONOUTPUT_RES;
+		head.len = sizeof(UpdateMonoutputRes);
+	}
+};
+
+//鏌ヨ鏈堜骇閲忕殑璇锋眰缁撴瀯浣�
+struct QueryMonoutputReq
+{
+	Head head;
+	int month;//鏈堜唤
+	double aOutput;//a浜у搧鏈堜骇閲�
+	double bOutput;//b浜у搧鏈堜骇閲�
+	double cOutput;//c浜у搧鏈堜骇閲�
+	QueryMonoutputReq() {
+		head.type = QUERY_MONOUTPUT_REQ;
+		head.len = sizeof(QueryMonoutputReq);
+	}
+};
+
+//鏌ヨ鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣�
+struct QueryMonoutputRes
+{
+	Head head;
+	int status;//琛ㄧず鏄惁娣诲姞鎴愬姛锛�0鍚�1鏄�
+	MonoutputInfo info[0];
+	QueryMonoutputRes() {
+		head.type = QUERY_MONOUTPUT_RES;
+		head.len = sizeof(QueryMonoutputRes);
+	}
+};
+
+
+
+//鍘嗗彶鏌ヨ鍒嗘瀽
+// 鍘嗗彶鏌ヨ璇锋眰缁撴瀯浣�
+struct HistoryQueryReq {
+	Head head;
+	//鏍规嵁鏃堕棿鑼冨洿鏌ヨ
+	char startTime[32];
+	char endTime[32];
+	//鍏抽敭瀛楁煡璇�
+	char keyWord[32];
+	HistoryQueryReq() {
+		// 鍒濆鍖栨暟鎹ご
+		head.type = QUERY_MONOUTPUT_REQ;
+		head.len = sizeof(HistoryQueryReq);
+		// 鍒濆鍖栨煡璇㈡潯浠跺瓧娈�
+        memset(startTime, 0, sizeof(startTime));
+        memset(endTime, 0, sizeof(endTime));
+
+	}
+};
+
+// 鍘嗗彶鏌ヨ鍝嶅簲缁撴瀯浣�
+
+// 绯荤粺杩愯鐘舵�佽〃鐩稿叧淇℃伅
+struct HistroyInfo {
+	WarningRes warn;//璀︽姤鏌ヨ
+	QDRes dev;//璁惧鏌ヨ
+	QueryPdplanRes  pro;//鐢熶骇璁″垝鏌ヨ
+};
+struct HistoryQueryRes {
+	Head head;
+	//HistroyInfo sys[0];
+	HistoryQueryRes() {
+		// 鍒濆鍖栨暟鎹ご
+		head.type = QUERY_MONOUTPUT_RES;
+		head.len = sizeof(HistoryQueryRes);
+	}
+};
+
+
+//鑷姩鍗囩骇
+struct VersionNumReq        // 鐗堟湰鍙疯姹�
+{
+	Head head;
+	VersionNumReq() {
+		head.type = VERSION_NUM_REQ;
+		head.len = sizeof(VersionNumReq);
+	}
+};
+
+struct VersionNumRes        // 鐗堟湰鍙峰搷搴�
+{
+	Head head;
+	char versionId[64]; // 鐗堟湰鍙�
+	VersionNumRes() {
+		head.type = VERSION_NUM_RES;
+		head.len = sizeof(VersionNumRes);
+	}
+};
+
+// 鏂囦欢浼犺緭
+struct FileInfo
+{
+	char fileName[256];
+	long long fileSize;
+	char s_filepath[128];
+	char content[0];
+};
+
+struct UploadFileReq        // 涓婁紶鏂囦欢鐨勮姹�
+{
+	Head head;
+	FileInfo fileInfo;
+	UploadFileReq() {
+		head.type = UPLOAD_FILE_REQ;
+		head.len = sizeof(UploadFileReq);
+	}
+};
+
+struct UploadFileRes {      // 涓婁紶鏂囦欢鐨勫搷搴�
+	Head head;
+	bool state = false;
+	char fileName[256];
+	long long file_size;
+	UploadFileRes()
+	{
+		head.type = UPLOAD_FILE_RES;
+		head.len = sizeof(UploadFileRes);
+	}
+};
+
+// 鐗堟湰淇℃伅褰曞叆
+// 璇锋眰
+struct VersionInfoEntryReq {
+	Head head;
+	char versionId[64]; // 鐗堟湰鍙�
+	char versionIdOld[64]; // 涓婁竴涓増鏈彿
+	int fileNum;
+	char context[0];		//鍖呭惈涓嬭浇鏂囦欢淇℃伅
+
+	VersionInfoEntryReq()
+	{
+		head.type = VERSION_INFOENTRY_REQ;
+		head.len = sizeof(VersionInfoEntryReq);
+	}
+};
+
+// 鐗堟湰淇℃伅褰曞叆鍝嶅簲
+struct VersionInfoEntryRes {
+	Head head;
+	bool state = false;
+	VersionInfoEntryRes()
+	{
+		head.type = VERSION_INFOENTRY_RES;
+		head.len = sizeof(VersionInfoEntryRes);
+	}
+};
+
+// 鐗堟湰鏇存柊璇锋眰
+struct VersionUpdateReq {
+	Head head;
+
+	char curVersionId[64]; // 鐗堟湰鍙�
+	VersionUpdateReq()
+	{
+		head.type = VERSION_UPDATE_REQ;
+		head.len = sizeof(VersionUpdateReq);
+	}
+};
+
+// 鐗堟湰鏇存柊鍝嶅簲
+struct VersionUpdateRes {
+	Head head;
+	bool state = false;
+	char versionId[64]; // 鐗堟湰鍙�
+	char updateDate[32]; // 鏇存柊鏃堕棿
+	char versionDescription[1024]; //鏇存柊鎻忚堪
+
+	VersionUpdateRes()
+	{
+		head.type = VERSION_UPDATE_RES;
+		head.len = sizeof(VersionUpdateRes);
+	}
+};
+
+// 鐗堟湰鏇存柊鏂囦欢涓嬭浇璇锋眰
+struct FileDownloadsReq {
+	Head head;
+	char versionId[64]; // 鐗堟湰鍙�
+	FileDownloadsReq()
+	{
+		head.type = FILE_DOWNLOADS_REQ;
+		head.len = sizeof(FileDownloadsReq);
+	}
+};
+
+// 鐗堟湰鏇存柊鏂囦欢涓嬭浇鍝嶅簲
+struct FileDownloadsRes {
+	Head head;
+	char versionId[64]; // 鐗堟湰鍙�
+	char filename[128]; //鏂囦欢鍚�
+	long long filesize; //鏂囦欢澶у皬
+	char c_filepath[128];	//瀹㈡埛绔斁鏈�鏂扮増鏈殑鏈湴璺緞
+	int fileNum; // 鏂囦欢鏁伴噺
+	long long allFileSize; // 鏂囦欢鎬诲ぇ灏�
+	char content[0];
+	FileDownloadsRes()
+	{
+		head.type = FILE_DOWNLOADS_RES;
+		head.len = sizeof(FileDownloadsRes);
+	}
+};
+
+// 鏇存柊鏂囦欢涓嬭浇鎴愬姛鐨勫搷搴�
+struct DownloadSuccessfullyRes {
+	Head head;
+	bool state = false;
+	char fileName[256];
+	long long fileSize;
+	DownloadSuccessfullyRes()
+	{
+		head.type = DOWNLOAD_SUCCESSFULLY_RES;
+		head.len = sizeof(DownloadSuccessfullyRes);
+	}
+};
+
+
+//鏃ュ織
+struct ParsedLog {
+	char timeStamp[64]; // 鏃堕棿鎴�
+	char deviceId[64]; // 璁惧ID
+	char level[16];    // 鏃ュ織绾у埆
+	char content[256];  // 鏃ュ織鍐呭
+	char userId[64];    // 鐢ㄦ埛ID
+	char fileName[32];   //鏂囦欢鍚�
+	char functionName[32];  //鍑芥暟鍚�
+	int problemLine;    //浜х敓閿欒琛屽彿
+};
+
+// 鏃ュ織鏌ヨ璇锋眰缁撴瀯浣�
+// 鏃ュ織鏌ヨ璇锋眰缁撴瀯浣�
+struct LogQueryReq {
+	Head head;                      // 鏁版嵁澶�
+	char timeStamp[64];             // 鏃堕棿鎴�
+	char content[256];           // 鏃ュ織鍐呭
+	char level[16];                 //鏃ュ織绾у埆
+	char deviceId[64];             // 璁惧ID
+	// 鏃犲弬鏋勯�犲嚱鏁�
+	LogQueryReq() {
+		head.type = LOGSEARCH_REQ;
+		head.len = sizeof(LogQueryReq);
+	}
+};
+
+// 鏃ュ織鏌ヨ鍝嶅簲缁撴瀯浣�
+struct LogQueryRes {
+	Head head;
+	int status;                    // 鍝嶅簲鐘舵�� (濡� 0 琛ㄧず鎴愬姛锛岄潪 0 琛ㄧず澶辫触)
+	char errorMessage[256];        // 閿欒淇℃伅锛堝鏋滄湁锛�
+
+	// 鏃犲弬鏋勯�犲嚱鏁�
+	LogQueryRes() {
+		head.type = LOGSEARCH_RES;
+		head.len = sizeof(LogQueryRes);
+	}
+};
+
+
+
+
+#endif // COMMON_H
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/document/\346\235\203\351\231\220\347\256\241\347\220\206\351\234\200\346\261\202\345\210\206\346\236\220.docx" "b/Client/\345\247\234\345\217\257\345\272\232/document/\346\235\203\351\231\220\347\256\241\347\220\206\351\234\200\346\261\202\345\210\206\346\236\220.docx"
index a879fd2..b53130b 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/document/\346\235\203\351\231\220\347\256\241\347\220\206\351\234\200\346\261\202\345\210\206\346\236\220.docx"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/document/\346\235\203\351\231\220\347\256\241\347\220\206\351\234\200\346\261\202\345\210\206\346\236\220.docx"
Binary files differ
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1106.doc" "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1106.doc"
new file mode 100644
index 0000000..ced568e
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1106.doc"
Binary files differ
diff --git "a/Client/\345\256\213\346\230\212\346\230\263/log/\346\227\245\345\277\227_\345\256\213\346\230\212\346\230\263_1106.doc" "b/Client/\345\256\213\346\230\212\346\230\263/log/\346\227\245\345\277\227_\345\256\213\346\230\212\346\230\263_1106.doc"
new file mode 100644
index 0000000..1f49258
--- /dev/null
+++ "b/Client/\345\256\213\346\230\212\346\230\263/log/\346\227\245\345\277\227_\345\256\213\346\230\212\346\230\263_1106.doc"
Binary files differ
diff --git "a/Client/\346\234\261\350\210\252/log/\346\234\261\350\210\2521104.doc" "b/Client/\346\234\261\350\210\252/log/\346\234\261\350\210\2521104.doc"
new file mode 100644
index 0000000..ba33b71
--- /dev/null
+++ "b/Client/\346\234\261\350\210\252/log/\346\234\261\350\210\2521104.doc"
Binary files differ
diff --git "a/Client/\346\234\261\350\210\252/log/\346\234\261\350\210\2521105.doc" "b/Client/\346\234\261\350\210\252/log/\346\234\261\350\210\2521105.doc"
new file mode 100644
index 0000000..1d30c29
--- /dev/null
+++ "b/Client/\346\234\261\350\210\252/log/\346\234\261\350\210\2521105.doc"
Binary files differ
diff --git "a/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1102.doc" "b/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1102.doc"
index 096b020..d26635a 100644
--- "a/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1102.doc"
+++ "b/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1102.doc"
Binary files differ
diff --git "a/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1106.doc" "b/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1106.doc"
new file mode 100644
index 0000000..4738a32
--- /dev/null
+++ "b/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1106.doc"
Binary files differ
diff --git "a/Client/\351\203\221\345\207\257\346\226\207/log/\351\203\221\345\207\257\346\226\2071106.doc" "b/Client/\351\203\221\345\207\257\346\226\207/log/\351\203\221\345\207\257\346\226\2071106.doc"
new file mode 100644
index 0000000..ee4c004
--- /dev/null
+++ "b/Client/\351\203\221\345\207\257\346\226\207/log/\351\203\221\345\207\257\346\226\2071106.doc"
Binary files differ
diff --git "a/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1105.doc" "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1105.doc"
new file mode 100644
index 0000000..8f5f121
--- /dev/null
+++ "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1105.doc"
Binary files differ
diff --git "a/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1106.doc" "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1106.doc"
new file mode 100644
index 0000000..4fce824
--- /dev/null
+++ "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1106.doc"
Binary files differ
diff --git "a/Server/\346\235\216\350\275\254\350\275\254/log/\351\205\215\347\275\256\347\256\241\347\220\206_\346\235\216\350\275\254\350\275\254_1106.doc" "b/Server/\346\235\216\350\275\254\350\275\254/log/\351\205\215\347\275\256\347\256\241\347\220\206_\346\235\216\350\275\254\350\275\254_1106.doc"
new file mode 100644
index 0000000..e56058d
--- /dev/null
+++ "b/Server/\346\235\216\350\275\254\350\275\254/log/\351\205\215\347\275\256\347\256\241\347\220\206_\346\235\216\350\275\254\350\275\254_1106.doc"
Binary files differ
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.cpp" "b/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.cpp"
index 367a7f1..ce7acb2 100644
--- "a/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.cpp"
+++ "b/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.cpp"
@@ -1,95 +1,102 @@
+#include "stdafx.h"
 #include "ConnectionPool.h"
-ConnectionPool::ConnectionPool()
-{
-	if (!parseXmlFile())
+
+#include <fstream>
+#include <iostream>
+#include <thread>
+
+ConnectionPool* ConnectionPool::getInstance() {
+	static ConnectionPool connPool;
+	return &connPool;
+}
+
+ConnectionPool::ConnectionPool() {
+	// 加载配置文件
+	if (!parseJsonFile()) {
+		std::cout << "parseJsonFile is failed!" << std::endl;
 		return;
-	for (m_num = 0; m_num < m_minSize;) {
-		bool flag = addConnection();
-		if (!flag) {
-			return;
-		}
 	}
-	// 如果子线程的任务函数是类的非静态函数,我们需要指定任务函数的地址和任务函数的所有者
-	thread producer(&ConnectionPool::productConnection, this); // 创建连接
-	thread recycler(&ConnectionPool::recycleConnection, this); // 检测并销毁连接
-															   // 线程分离,防止阻塞主线程
+	for ( int i = 0 ; i < m_min_conn ; i++ ) {
+		addConnection( );
+	}
+	// 创建一个线程,对连接数进行监控 ,连接数不足就再继续创建
+	std::thread producer(&ConnectionPool::produce, this);
+	// 对连接数进行监控 ,如果有太多空闲得线程 ,那么就对其进行销毁
+	std::thread recycler( &ConnectionPool::recycle,  this);
+
+	// 线程分离
 	producer.detach();
 	recycler.detach();
 }
-ConnectionPool::~ConnectionPool()
-{
-	while (!m_connections.empty()) {
-		MysqlConn* conn = m_connections.front();
-		m_connections.pop();
-		delete conn;
-	}
-}
-bool ConnectionPool::parseXmlFile()
-{
-	TiXmlDocument xml("mysql.xml");
-	// 加载文件
-	bool res = xml.LoadFile();
-	if (!res) {
-		return false; // 提示
-	}
-	// 根
-	TiXmlElement* rootElement = xml.RootElement();
-	TiXmlElement* childElement = rootElement->FirstChildElement("mysql");
-	// 读取信息
-	m_ip = childElement->FirstChildElement("ip")->GetText();
-	m_port = static_cast<unsigned short>(stoi(string(childElement->FirstChildElement("port")->GetText())));
-	m_user = childElement->FirstChildElement("username")->GetText();
-	m_passwd = childElement->FirstChildElement("password")->GetText();
-	m_dbName = childElement->FirstChildElement("dbName")->GetText();
-	m_minSize = static_cast<int>(stoi(string(childElement->FirstChildElement("minSize")->GetText())));
-	m_maxSize = static_cast<int>(stoi(string(childElement->FirstChildElement("maxSize")->GetText())));
-	m_maxIdleTime = static_cast<int>(stoi(string(childElement->FirstChildElement("maxIdleTime")->GetText())));
-	m_timeout = static_cast<int>(stoi(string(childElement->FirstChildElement("timeout")->GetText())));
-	return true;
-}
-bool ConnectionPool::addConnection()
-{
-	MysqlConn* conn = new MysqlConn;
-	bool res = conn->connect(m_user, m_passwd, m_dbName, m_ip, m_port);
-	if (res) {
-		// 刷新空闲时间
-		conn->refreashAliveTime();
-		m_connections.push(conn);
-		++m_num;
+
+bool ConnectionPool::parseJsonFile() {
+
+	/*std::ifstream ifs("dbconf.json");
+	Reader rd;
+	Value root;
+	rd.parse(ifs, root);
+	if ( root.isObject( ) ) {
+		m_ip = root["ip"].asString();
+		m_port = root["port"].asInt();
+		m_userName = root["userName"].asString();
+		m_passwd = root["password"].asString();
+		m_db = root["dbName"].asString();
+		m_min_conn = root["minSize"].asInt();
+		m_max_conn = root["maxSize"].asInt();
+		max_del_time = root["maxDleTime"].asInt();
+		m_timeout = root["timeout"].asInt();
 		return true;
+	}*/
+	return false;
+}
+
+void ConnectionPool::description() {
+	std::cout << m_ip << ". " << m_userName << ". " << m_passwd << ". " << m_db << ". "
+		       << m_port << ". " << m_max_conn << ". " << m_min_conn << ". " << m_timeout << ". " 
+		       << max_del_time << std::endl;
+}
+
+ConnectionPool::~ConnectionPool() {
+	while (!m_connkQueue.empty()) {
+		MysqlConn* conn = m_connkQueue.front();
+		m_connkQueue.pop();
+		delete  conn;
 	}
-	else {
+
+}
+
+void ConnectionPool::addConnection() {
+	MysqlConn* conn = new MysqlConn();
+	if ( !conn->connect( m_ip, m_userName, m_passwd, m_db, m_port  ) ) {
+		std::cout << "ConnectionPool connect to mysql is failed!" << std::endl;
 		delete conn;
-		return false; // 提示
+		return;
 	}
+	conn->refreshActiveTime( );
+	m_connkQueue.push(conn);
+	m_cond.notify_one();   // 唤醒一个线程
 }
-void ConnectionPool::productConnection()
-{
+
+void ConnectionPool::produce(){
 	while (true) {
-		unique_lock<mutex> lc(m_mutex);
-		m_cond.wait(lc, [this]() {return m_connections.empty(); });
-		if (m_num < m_maxSize) {
-			bool flag = addConnection();
-			if (!flag) {
-				return;
-			}
+		std::unique_lock<std::mutex> lock(m_mutex);
+		while (m_connkQueue.size() >= m_min_conn) { // 连接队列的数量大于最小的连接数
+			m_cond.wait(lock);
 		}
-		// 唤醒
-		m_cond1.notify_all();
+		addConnection();
 	}
 }
-void ConnectionPool::recycleConnection()
-{
-	while (true) {
-		// 休眠一段时间 0.5s
-		this_thread::sleep_for(milliseconds(500));
-		lock_guard<mutex> lc(m_mutex);
-		while (!m_connections.empty() && m_num > m_minSize) {
-			MysqlConn* conn = m_connections.front();
-			if (conn->getAliveTime() >= m_maxIdleTime) {
-				m_connections.pop();
+
+// 删除空闲连接
+void ConnectionPool::recycle() {
+	while ( true ) {
+		std::this_thread::sleep_for( std::chrono::milliseconds(500));   // 休眠500 ms
+		std::unique_lock<std::mutex>lock(m_mutex);
+		while ( m_connkQueue.size() > m_min_conn ) {
+			MysqlConn* conn = m_connkQueue.front( );
+			if (conn->getActiveTime() >= max_del_time) {
+				m_connkQueue.pop();
 				delete conn;
-				--m_num;
 			}
 			else {
 				break;
@@ -97,35 +104,22 @@
 		}
 	}
 }
-ConnectionPool* ConnectionPool::getConnectPool()
-{
-	// 不使用互斥锁的线程安全的懒汉模式
-	static ConnectionPool pool; // 只在第一次调用函数时初始化
-	return &pool;
-}
-shared_ptr<MysqlConn> ConnectionPool::getConnection()
-{
-	unique_lock<mutex> lc(m_mutex);
-	while (m_connections.empty()) {
-		if (cv_status::timeout == m_cond1.wait_for(lc, chrono::milliseconds(m_timeout))) {
-			if (m_connections.empty()) {
-				// cout << "out of time" << endl;
-				return nullptr; // 结束  // 提示
-								// continue; // 利用while配合continue 继续阻塞
-			}
+
+std::shared_ptr<MysqlConn>  ConnectionPool::getMysqlConn() {
+	
+	std::unique_lock<std::mutex>lock(m_mutex);
+	while ( m_connkQueue.empty()) {
+		// 如果等待一段时间后,队列还是为空,返回一个 null
+		if ( std::cv_status::timeout == m_cond.wait_for(lock, std::chrono::milliseconds(m_timeout)) ) {
+			if( m_connkQueue.empty( ) )    return nullptr;
 		}
 	}
-	// 要指定删除器destructor,来保证连接的归还
-	shared_ptr<MysqlConn> conn(m_connections.front(), [this](MysqlConn* conn) {
-		// 加锁保证队列线程安全
-		// m_mutex.lock(); // 1
-		unique_lock<mutex> lc(m_mutex); // 2
-		// lock_guard<mutex> lc(m_mutex); // 3
-		conn->refreashAliveTime();
-		m_connections.push(conn);
-		// m_mutex.unlock(); // 1
+	std::shared_ptr<MysqlConn> connPtr(std::move(m_connkQueue.front()), [this](MysqlConn* conn) {
+		std::unique_lock <std::mutex>lock(m_mutex) ;
+		conn->refreshActiveTime();
+		m_connkQueue.push(conn);
 		});
-	m_connections.pop();
-	m_cond.notify_all();
-	return conn;
-}
+	m_connkQueue.pop();
+	m_cond.notify_one();   // 唤醒阻塞的生产者线程,开始生产
+	return connPtr;
+}
\ No newline at end of file
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.h" "b/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.h"
index 3ad1ee0..bce6a07 100644
--- "a/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.h"
+++ "b/Server/\347\216\213\347\220\250\345\205\203/code/ConnectionPool.h"
@@ -1,54 +1,50 @@
 #pragma once
-#include "MysqlConn.h"
-#include "./tinyxml/tinyxml.h"
+
 #include <queue>
 #include <mutex>
-#include <thread>
-#include <atomic>
 #include <condition_variable>
+//#include <json/json.h>
 
+#include "MysqlConn.h"
 
-#pragma comment(lib, "./tinyxml/x64/Debug/tinyxml.lib")
+//using namespace Json;
 
-// 应用-单例模式:懒汉模式[需要考虑多线程安全问题]
 class ConnectionPool
 {
-private:
-	ConnectionPool();
-	// 移动拷贝最终还是有且仅有一个对象,所以依旧是属于单例模式。
-	// delete 阻止拷贝构造和拷贝赋值的类对象生成
-	ConnectionPool(ConnectionPool&) = delete;
-	ConnectionPool& operator=(ConnectionPool&) = delete;
-	~ConnectionPool();
-	// 解析xml配置文件 读取数据库及连接池的相关信息
-	bool parseXmlFile();
-	// 添加连接
-	bool addConnection();
-	// 线程函数
-	void productConnection();
-	void recycleConnection();
-
-	// 存放数据库连接池建立的连接
-	queue<MysqlConn*>	m_connections;
-	// 一些基本信息
-	string				m_ip;			// IP
-	unsigned short		m_port;			// 端口
-	string				m_user;			// 用户名
-	string				m_passwd;		// 密码
-	string				m_dbName;		// 数据库名称
-	int					m_minSize;		// 初始连接量(最小连接量)
-	int					m_maxSize;		// 最大连接量
-	int					m_timeout;		// 超时时长
-	int					m_maxIdleTime;	// 最大空闲时长
-										// 线程安全相关
-	mutex				m_mutex;
-	condition_variable	m_cond;			// 仅用一个条件变量来唤醒线程,但并不影响线程运行
-	condition_variable  m_cond1;
-	// 连接数量
-	atomic_int			m_num;			// 连接的总数量
 public:
-	// 获取单例对象的接口
-	static ConnectionPool* getConnectPool();
-	// 用户获取连接的接口, 如果获取失败,会返回nullptr
-	shared_ptr<MysqlConn> getConnection();
+	static ConnectionPool* getInstance( );
+
+	std::shared_ptr<MysqlConn>  getMysqlConn();    // 从数据库连接池获取连接
+
+	ConnectionPool(const ConnectionPool& other) = delete;
+	ConnectionPool& operator = (const ConnectionPool & other ) = delete;
+	
+	~ConnectionPool();
+
+	void description();
+
+protected:
+	ConnectionPool( );   // 构造函数
+private:
+	bool parseJsonFile();   // 解析配置
+
+	void produce();
+	void recycle();
+	void addConnection();  // 增加连接数
+
+	std::string  m_ip;
+	std::string  m_userName;
+	std::string  m_passwd;
+	std::string  m_db;
+	unsigned short m_port;
+
+	int m_max_conn;
+	int m_min_conn;
+
+	int m_timeout;      // 连接超时时间
+	int max_del_time;   // 最大删除时间( 连接空闲时间超过这个,就给当前连接关闭 )
+	std::queue<MysqlConn*>m_connkQueue ;   // 连接队列
+	std::mutex m_mutex;  // 互斥锁
+	std::condition_variable m_cond;   // 条件变量
 };
+
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.cpp" "b/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.cpp"
index 57ba1c6..5725af8 100644
--- "a/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.cpp"
+++ "b/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.cpp"
@@ -1,174 +1,144 @@
+#include "stdafx.h"
 #include "MysqlConn.h"
+#include <regex>
 
-MysqlConn::MysqlConn()//初始化数据库
-{
-	m_result = nullptr;
-	m_mysqlRow = nullptr;
-	// 传入nullptr空指针时,会自动分配一个MYSQL对象
-	m_conn = mysql_init(nullptr);
-}
-MysqlConn::~MysqlConn()//释放数据库连接
-{
-	freeRes(); // 释放结果集
-	if (m_conn != nullptr) {
-		mysql_close(m_conn);
-		m_conn = nullptr;
-	}
-}
-void MysqlConn::freeRes()//结果集释放
-{
-	if (m_result) {
-		mysql_free_result(m_result);
-		m_result = nullptr;
-	}
-}
-bool MysqlConn::connect(const string user, const string passwd, \
-	const string dbName, string ip, \
-	const unsigned short port)//连接数据库
-{
-	MYSQL* res = mysql_real_connect(m_conn, ip.c_str(), user.c_str(), \
-		passwd.c_str(), dbName.c_str(), port, nullptr, 0);
-	// 修改编码
-	mysql_set_character_set(m_conn, "gb2312");
-	return res != nullptr;
-}
-bool MysqlConn::update(const string sql) const
-{
-	// 执行成功返回0;
-	int res = mysql_real_query(m_conn, sql.c_str(), static_cast<unsigned int>(sql.size()));
-	if (res != 0) {
-		return false; // 提示
-	}
-	return true;
-}
-bool MysqlConn::query(const string sql)
-{
-	freeRes();
-	int res = mysql_real_query(m_conn, sql.c_str(), static_cast<unsigned int>(sql.size()));
-	if (res != 0) {
-		return false; // 提示
-	}
-	m_result = mysql_store_result(m_conn);
-	return true;
-}
-bool MysqlConn::getRes()
-{
-	if (m_result != nullptr) {
-		// char** 获取单行记录
-		m_mysqlRow = mysql_fetch_row(m_result);
-		if (m_mysqlRow != nullptr) {
-			return true;
-		}
-		freeRes();
-	}
-	return false;
-}
-string MysqlConn::getValue(const int fieldIndex) const
-{
-	int fieldCount = mysql_num_fields(m_result);
-	if (fieldIndex >= fieldCount || fieldIndex < 0) {
-		return string(); // 提示
-	}
-	char* value = m_mysqlRow[fieldIndex];
-	// 得到一个保存各字段值长度的数组
-	unsigned long* len = mysql_fetch_lengths(m_result);
-	unsigned long length = len[fieldIndex];
-	// 防止结果中存在\0导致数据丢失
-	return string(value, length);
-}
-bool MysqlConn::selectDB(const string dbName) const
-{
-	int res = mysql_select_db(m_conn, dbName.c_str());
-	if (res != 0) {
-		return false;  // 提示
-	}
-	return true;
-}
-void MysqlConn::backupCurrentDB(const string path)
-{
-	string sql = "show tables";
-	int r = mysql_real_query(m_conn, sql.c_str(), static_cast<unsigned long>(sql.size()));
-	if (r != 0) {
-		return; // 提示
-	}
-	MYSQL_RES* tableRes = mysql_store_result(m_conn);
-	for (int i = 0; i < mysql_num_rows(tableRes); ++i) {
-		MYSQL_ROW tableName = mysql_fetch_row(tableRes);
-		backupCurrentTable(path, tableName[0]);
-	}
-}
-void MysqlConn::backupCurrentTable(const string path, const string tableName)
-{
-	string file = path + tableName + ".sql";
-	ofstream ofs(file);
-	if (!ofs.is_open()) {
-		return; // 提示
-	}
-	// 表结构写入
-	string showCreate = "show create table " + tableName + ";";
-	bool res = query(showCreate);
-	if (!res) {
-		return; // 提示
-	}
-	if (getRes()) {
-		string writeSQL = getValue(1) + ";\n";
-		ofs.write(writeSQL.c_str(), writeSQL.size());
-		// cout << writeSQL << endl;
-	}
-	// 表数据写入
-	string sql = "select * from " + tableName + ";";
-	res = query(sql);
-	if (!res) {
-		return; // 提示
-	}
-	while (getRes()) {
-		string writeSQL = "insert into `" + tableName + "` values(";
-		for (int i = 0; !getValue(i).empty(); ++i) {
-			if (i != 0) {
-				writeSQL += ",";
-			}
-			MYSQL_FIELD* valueType = mysql_fetch_field_direct(m_result, i);
-			if (valueType->type == MYSQL_TYPE_DECIMAL
-				|| valueType->type == MYSQL_TYPE_TINY
-				|| valueType->type == MYSQL_TYPE_SHORT
-				|| valueType->type == MYSQL_TYPE_LONG
-				|| valueType->type == MYSQL_TYPE_FLOAT
-				|| valueType->type == MYSQL_TYPE_DOUBLE
-				|| valueType->type == MYSQL_TYPE_TIMESTAMP
-				|| valueType->type == MYSQL_TYPE_LONGLONG
-				|| valueType->type == MYSQL_TYPE_INT24) {
-				writeSQL += getValue(i);
-			}
-			else {
-				writeSQL += "'" + getValue(i) + "'";
-			}
-		}
-		writeSQL += ");\n";
-		ofs.write(writeSQL.c_str(), writeSQL.size());
-	}
-	ofs.close();
-}
-bool MysqlConn::transaction() const
-{
-	// 将事务提交设置为手动提交
-	return mysql_autocommit(m_conn, false);
-}
-bool MysqlConn::commit() const
-{
-	return mysql_commit(m_conn);
-}
-bool MysqlConn::rollback() const
-{
-	return mysql_rollback(m_conn);
-}
-void MysqlConn::refreashAliveTime()
-{
-	m_alivetime = steady_clock::now();
-}
-ll MysqlConn::getAliveTime()
-{
-	// 毫秒 <<= 纳秒:精度降低
-	milliseconds res = duration_cast<milliseconds>(steady_clock::now() - m_alivetime);
-	return res.count();
+
+// 初始化连接
+MysqlConn::MysqlConn() {
+    mysql_ = mysql_init(mysql_);
+    // 设置字符集
+    if (mysql_) mysql_set_character_set(mysql_, "gbk");
 }
 
+// 连接数据库
+bool MysqlConn::connect(std::string ip, std::string userName, std::string passwd, std::string db, int port) {
+    mysql_ = mysql_real_connect(mysql_, ip.c_str(), userName.c_str(), passwd.c_str(), db.c_str(), port, nullptr, 0);
+    if (!mysql_) {
+        return false;
+    }
+    return true;
+}
+
+// 释放资源
+MysqlConn::~MysqlConn() {
+    if (mysql_) {
+        mysql_close(mysql_);
+        mysql_ = nullptr;
+    }
+    freeRes();
+}
+
+// 更新数据
+bool MysqlConn::update(std::string sql) {
+    // 参数化查询优化后的安全检查
+    MYSQL_STMT* stmt = mysql_stmt_init(mysql_);
+    if (!stmt) {
+        return false;
+    }
+    if (mysql_stmt_prepare(stmt, sql.c_str(), sql.length())) {
+        mysql_stmt_close(stmt);
+        return false;
+    }
+    int paramCount = mysql_stmt_param_count(stmt);
+    if (paramCount > 0) {
+        // 如果有参数,需要进行参数绑定等操作,这里暂不实现
+        mysql_stmt_close(stmt);
+        return false;
+    }
+    if (mysql_stmt_execute(stmt)) {
+        mysql_stmt_close(stmt);
+        return false;
+    }
+    mysql_stmt_close(stmt);
+    return true;
+}
+
+// 查询数据库
+bool MysqlConn::query(std::string sql) {
+    freeRes();
+    // 参数化查询优化后的安全检查
+    MYSQL_STMT* stmt = mysql_stmt_init(mysql_);
+    if (!stmt) {
+        return false;
+    }
+    if (mysql_stmt_prepare(stmt, sql.c_str(), sql.length())) {
+        mysql_stmt_close(stmt);
+        return false;
+    }
+    int paramCount = mysql_stmt_param_count(stmt);
+    if (paramCount > 0) {
+        // 如果有参数,需要进行参数绑定等操作,这里暂不实现
+        mysql_stmt_close(stmt);
+        return false;
+    }
+    if (mysql_stmt_execute(stmt)) {
+        mysql_stmt_close(stmt);
+        return false;
+    }
+    res_ = mysql_stmt_result_metadata(stmt);
+    if (!res_) {
+        mysql_stmt_close(stmt);
+        return false;
+    }
+    mysql_stmt_close(stmt);
+    return true;
+}
+
+// 得到结果集
+bool MysqlConn::getResult() {
+    if (res_) {
+        row_ = mysql_fetch_row(res_);
+        if (row_) return true;
+    }
+    return false;
+}
+
+// 获取结果集的字段
+std::string MysqlConn::getField(int index) {
+    int cols = mysql_num_fields(res_);
+    if (index >= cols || index < 0) return std::string("");
+
+    char* value = row_[index];
+    unsigned long len = mysql_fetch_lengths(res_)[index];
+    return std::string(value, len);
+}
+
+// 事务操作
+bool MysqlConn::transaction() {
+    return mysql_autocommit(mysql_, false);
+}
+
+// 提交事务
+bool MysqlConn::commit() {
+    return mysql_commit(mysql_);
+}
+
+// 事务回滚
+bool MysqlConn::rollback() {
+    return mysql_rollback(mysql_);
+}
+
+void MysqlConn::refreshActiveTime() {
+    activeTime_ = std::chrono::steady_clock::now();
+}
+
+long long MysqlConn::getActiveTime() {
+    // 纳米
+    std::chrono::nanoseconds nased = std::chrono::steady_clock::now() - activeTime_;
+    // 转换成毫米
+    std::chrono::microseconds millsed = std::chrono::duration_cast<std::chrono::microseconds>(nased);
+    return millsed.count();   // 多少毫秒
+}
+
+// 安全校验实现,这里简单使用正则表达式判断是否包含危险字符
+bool MysqlConn::isSqlSafe(const std::string& sql) {
+    std::regex dangerousPattern(".*(['\";\\-+=]).*");
+    return!std::regex_search(sql, dangerousPattern);
+}
+
+void MysqlConn::freeRes() {
+    if (res_) {
+        mysql_free_result(res_);
+        res_ = nullptr;
+    }
+}
\ No newline at end of file
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h" "b/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h"
index 0dbbea9..00c9917 100644
--- "a/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h"
+++ "b/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h"
@@ -1,63 +1,49 @@
 #pragma once
-#include<iostream>
-#include <memory>
-#include <string>
-#include <mysql.h>
-#include <chrono> // 时钟
-#include <fstream>
 
-#pragma comment(lib, "./lib/libmysql.lib") // 加载数据库库文件
-using namespace std;
-using namespace chrono;
-typedef long long ll;
+#include <string>
+#include <WinSock2.h>
+//#include <mysql.h>
+#include "MySQL/include/mysql.h"
+#include <string.h>
+#include <chrono>
+
+#pragma comment(lib,"./MySQL/lib/libmysql.lib")
 
 class MysqlConn
 {
-private:
-	// 绝对时钟
-	steady_clock::time_point	m_alivetime;
-	// 连接
-	MYSQL* m_conn;
-	// 查询的结果集
-	MYSQL_RES* m_result;
-	// 单记录结果集
-	MYSQL_ROW					m_mysqlRow;
-
-	// 结果集释放
-	void freeRes();
-	// 导出某一张表中的数据
-	void backupCurrentTable(const string path, const string tableName);
 public:
-	// 初始化数据库
+	// 初始化连接
 	MysqlConn();
-	// 数据库连接释放
-	~MysqlConn();
-	// 连接数据库, 需提供用户 密码 数据库名称 ip 端口
-	bool connect(const string user, const string passwd, \
-		const string dbName, string ip, \
-		const unsigned short port = 3306U);
-	// 更新数据库:增删改操作
-	bool update(const string sql) const;
+	// 连接数据库
+	bool connect(std::string ip, std::string userName, std::string passwd, std::string db , int port = 3306);
+	// 释放资源
+	~MysqlConn( );
+	// 更新数据库  ( insert  update delete )
+	bool update(std::string sql);
 	// 查询数据库
-	bool query(const string sql);
-	// 遍历查询结果集
-	bool getRes();
-	// 获取结果集中的字段值
-	string getValue(const int fieldIndex) const;
-	// 切换数据库
-	bool selectDB(const string dbName) const;
-	// 建库
-	//bool createDB(const string dbName) const;
-	// 备份某个库
-	void backupCurrentDB(const string path);
+	bool query(std::string sql);
+	// 得到结果集
+	bool getResult();
+	// 获取结果集的字段
+	std::string getField(int index);
 	// 事务操作
-	bool transaction() const;
+	bool transaction();
 	// 提交事务
-	bool commit() const;
+	bool commit( );
 	// 事务回滚
-	bool rollback() const;
-	// 刷新起始的空闲时间点
-	void refreashAliveTime();
-	// 计算存活总时长
-	ll getAliveTime();
+	bool rollback();
+
+	void refreshActiveTime( );   // 刷新活跃时间
+	long long getActiveTime();   // 获取当前活跃的时间间隔 
+	// 安全校验接口
+	bool isSqlSafe(const std::string& sql);
+
+private:
+
+	void freeRes();
+	MYSQL* mysql_ = NULL ;
+	MYSQL_RES* res_ = NULL;
+	MYSQL_ROW row_ = nullptr;
+	std::chrono::steady_clock::time_point  activeTime_;
 };
+
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1101.doc" "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1101.doc"
index cbc2406..7b25abd 100644
--- "a/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1101.doc"
+++ "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1101.doc"
Binary files differ
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1103 .doc" "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1103 .doc"
index 9461d22..02c7ceb 100644
--- "a/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1103 .doc"
+++ "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1103 .doc"
Binary files differ
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1104.doc" "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1104.doc"
new file mode 100644
index 0000000..f61ee94
--- /dev/null
+++ "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1104.doc"
Binary files differ
diff --git "a/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1105.doc" "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1105.doc"
new file mode 100644
index 0000000..53afd59
--- /dev/null
+++ "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1105.doc"
Binary files differ
diff --git "a/Server/\351\231\210\346\245\232\344\270\271/log/\346\227\245\345\277\227_\351\231\210\346\245\232\344\270\271_1105.doc" "b/Server/\351\231\210\346\245\232\344\270\271/log/\346\227\245\345\277\227_\351\231\210\346\245\232\344\270\271_1105.doc"
new file mode 100644
index 0000000..6ab23ea
--- /dev/null
+++ "b/Server/\351\231\210\346\245\232\344\270\271/log/\346\227\245\345\277\227_\351\231\210\346\245\232\344\270\271_1105.doc"
Binary files differ
diff --git "a/Server/\351\251\254\346\270\235\346\235\255/log/20241105\346\230\206\344\273\221\346\227\245\346\212\245.doc" "b/Server/\351\251\254\346\270\235\346\235\255/log/20241105\346\230\206\344\273\221\346\227\245\346\212\245.doc"
new file mode 100644
index 0000000..0dea9ff
--- /dev/null
+++ "b/Server/\351\251\254\346\270\235\346\235\255/log/20241105\346\230\206\344\273\221\346\227\245\346\212\245.doc"
Binary files differ
diff --git "a/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241104.doc" "b/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241104.doc"
index b7876b4..0c98430 100644
--- "a/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241104.doc"
+++ "b/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241104.doc"
Binary files differ
diff --git "a/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241105.doc" "b/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241105.doc"
new file mode 100644
index 0000000..3a3ac9a
--- /dev/null
+++ "b/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241105.doc"
Binary files differ
diff --git a/common.h b/common.h
index fb8ffa3..6d36e1f 100644
--- a/common.h
+++ b/common.h
@@ -90,6 +90,14 @@
 	//鏃ュ織
 	LOGSEARCH_REQ,//鏃ュ織鏌ヨ璇锋眰
 	LOGSEARCH_RES,//鏃ュ織鏌ヨ鍝嶅簲
+	
+	//鍘嗗彶鏌ヨ鍒嗘瀽
+	HISTORY_DEV_REQ,        //鍘嗗彶鏌ヨ纭欢璇锋眰
+	HISTORY_DEV_RES,        //鍘嗗彶鏌ヨ纭欢鍝嶅簲
+	HISTORY_PRODUCE_REQ,    //鍘嗗彶鏌ヨ鐢熶骇璇锋眰
+	HISTORY_PRODUCE_RES,    //鍘嗗彶鏌ヨ鐢熶骇鍝嶅簲
+	HISTORY_ENV_REQ,    //鍘嗗彶鏌ヨ鐜璇锋眰
+	HISTORY_ENV_RES,    //鍘嗗彶鏌ヨ鐜鍝嶅簲
 
 };
 
@@ -276,22 +284,22 @@
 //璁惧绠$悊
 struct DevicesInfo
 {
-	int deviceID;
 	char deviceName[32];//璁惧鍚嶇О
 	char deviceStatus[32];//璁惧鐘舵��
+    char area[32]; // 鍦板尯
+    double longitude;//缁忓害
+    double latitude;//绾害
+    char purchasingTime[15];//璐拱鏃堕棿
+    char installTime[15];//瀹夎鏃堕棿
 	char manufacturer[100];//鍘傚
+    char devicesSerialNumber[32];//璁惧缂栫爜
 	char devicesType[32];//璁惧绫诲瀷
-	double longitude;//缁忓害
-	double latitude;//绾害
-	char purchasingTime[15];//璐拱鏃堕棿
-	char installTime[15];//瀹夎鏃堕棿
-	char devicesSerialNumber[32];//璁惧缂栫爜
 };
 //娣诲姞璁惧
 struct ADReq//娣诲姞璇锋眰
 {
 	Head head;
-	char deviceName[32];
+	DevicesInfo devInfo[0];
 	ADReq() {
 		head.type = AD_REQ;
 		head.len = sizeof(ADReq);
@@ -302,7 +310,7 @@
 struct ADRes//娣诲姞鍝嶅簲
 {
 	Head head;
-	int type;
+	int status;
 	ADRes() {
 		head.type = AD_RES;
 		head.len = sizeof(ADRes);
@@ -310,22 +318,23 @@
 
 };
 //淇敼璁惧
-struct MDRes//淇敼璇锋眰
+struct MDReq//淇敼璇锋眰
 {
 	Head head;
-	DevicesInfo info;
-	MDRes() {
-		head.type = MD_RES;
-		head.len = sizeof(MDRes);
-	}
-};
-struct MDReq//淇敼鍝嶅簲
-{
-	Head head;
-	int type;
+	
 	MDReq() {
 		head.type = MD_REQ;
 		head.len = sizeof(MDReq);
+	}
+};
+struct MDRes//淇敼鍝嶅簲
+{
+	Head head;
+	DevicesInfo info;
+	int status;
+	MDRes() {
+		head.type = MD_RES;
+		head.len = sizeof(MDRes);
 	}
 };
 //鏌ヨ璁惧
@@ -341,7 +350,7 @@
 struct QDRes//鏌ヨ鍝嶅簲
 {
 	Head head;
-	int type;
+	int status;
 	QDRes() {
 		head.type = QD_RES;
 		head.len = sizeof(QDRes);
@@ -827,40 +836,91 @@
 
 
 //鍘嗗彶鏌ヨ鍒嗘瀽
-// 鍘嗗彶鏌ヨ璇锋眰缁撴瀯浣�
-struct HistoryQueryReq {
+
+//鍘嗗彶鏌ヨ鍒嗘瀽
+
+struct warningInfo {
+	int device_id;
+	char des[32];
+	char time[32];
+	float data;
+	char type[16];
+	char status[16];
+};
+// 鍘嗗彶鏌ヨ璁惧淇℃伅璇锋眰缁撴瀯浣�
+struct HistoryDevReq {
 	Head head;
 	//鏍规嵁鏃堕棿鑼冨洿鏌ヨ
 	char startTime[32];
 	char endTime[32];
 	//鍏抽敭瀛楁煡璇�
 	char keyWord[32];
-	HistoryQueryReq() {
+	HistoryDevReq() {
 		// 鍒濆鍖栨暟鎹ご
-		head.type = QUERY_MONOUTPUT_REQ;
-		head.len = sizeof(HistoryQueryReq);
+		head.type = HISTORY_DEV_REQ;
+		head.len = sizeof(HISTORY_DEV_REQ);
 		// 鍒濆鍖栨煡璇㈡潯浠跺瓧娈�
-		std::memset(startTime, 0, sizeof(startTime));
-		std::memset(endTime, 0, sizeof(endTime));
-
+	}
+};
+// 鍘嗗彶鏌ヨ鐢熶骇璁″垝璇锋眰缁撴瀯浣�
+struct HistoryProReq {
+	Head head;
+	//鏍规嵁鏃堕棿鑼冨洿鏌ヨ
+	char startTime[32];
+	char endTime[32];
+	//鍏抽敭瀛楁煡璇�
+	char keyWord[32];
+	HistoryProReq() {
+		// 鍒濆鍖栨暟鎹ご
+		head.type = HISTORY_PRODUCE_REQ;
+		head.len = sizeof(HistoryProReq);
+		// 鍒濆鍖栨煡璇㈡潯浠跺瓧娈�
+	}
+};
+// 鍘嗗彶鏌ヨ鐜淇℃伅璇锋眰缁撴瀯浣�
+struct HistoryEnvReq {
+	Head head;
+	//鏍规嵁鏃堕棿鑼冨洿鏌ヨ
+	char startTime[32];
+	char endTime[32];
+	//鍏抽敭瀛楁煡璇�
+	char keyWord[32];
+	HistoryEnvReq() {
+		// 鍒濆鍖栨暟鎹ご
+		head.type = HISTORY_ENV_REQ;
+		head.len = sizeof(HistoryEnvReq);
+		// 鍒濆鍖栨煡璇㈡潯浠跺瓧娈�
 	}
 };
 
-// 鍘嗗彶鏌ヨ鍝嶅簲缁撴瀯浣�
-
-// 绯荤粺杩愯鐘舵�佽〃鐩稿叧淇℃伅
-struct HistroyInfo {
-	WarningRes warn;//璀︽姤鏌ヨ
-	QDRes dev;//璁惧鏌ヨ
-	QueryPdplanRes  pro;//鐢熶骇璁″垝鏌ヨ
-};
-struct HistoryQueryRes {
+//鏌ヨ璁惧淇℃伅鍝嶅簲缁撴瀯浣�
+struct HistoryDevRes {
 	Head head;
-	HistroyInfo sys[0];
-	HistoryQueryRes() {
+	DevicesInfo dev[0];
+	HistoryDevRes() {
 		// 鍒濆鍖栨暟鎹ご
-		head.type = QUERY_MONOUTPUT_RES;
-		head.len = sizeof(HistoryQueryRes);
+		head.type = HISTORY_DEV_RES;
+		head.len = sizeof(HistoryDevRes);
+	}
+};
+//鏌ヨ鐢熶骇璁″垝鍝嶅簲缁撴瀯浣�
+struct HistoryProRes {
+	Head head;
+	PdplanInfo pro[0];
+	HistoryProRes() {
+		// 鍒濆鍖栨暟鎹ご
+		head.type = HISTORY_PRODUCE_RES;
+		head.len = sizeof(HistoryProRes);
+	}
+};
+//鏌ヨ鐜淇℃伅鍝嶅簲缁撴瀯浣�
+struct HistoryEnvRes {
+	Head head;
+	warningInfo env[0];
+	HistoryEnvRes() {
+		// 鍒濆鍖栨暟鎹ご
+		head.type = HISTORY_ENV_RES;
+		head.len = sizeof(HistoryEnvRes);
 	}
 };
 
diff --git a/kunlun110401.sql b/kunlun.sql
similarity index 83%
rename from kunlun110401.sql
rename to kunlun.sql
index 989de5f..f3d7846 100644
--- a/kunlun110401.sql
+++ b/kunlun.sql
@@ -31,24 +31,29 @@
 
 -- 姝e湪瀵煎嚭琛�  mayi_kunlun.data_info 鐨勬暟鎹細~0 rows (澶х害)
 
--- 瀵煎嚭  琛� mayi_kunlun.devices_management 缁撴瀯
-CREATE TABLE IF NOT EXISTS `devices_management` (
-  `id` int NOT NULL,
+-- 瀵煎嚭  琛� mayi_kunlun.devices_management_info 缁撴瀯
+CREATE TABLE IF NOT EXISTS `devices_management_info` (
+  `id` int NOT NULL AUTO_INCREMENT,
   `devices_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
   `devices_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
   `devices_serial_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
   `devices_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
+  `area` varchar(50) DEFAULT NULL,
   `longitude` double DEFAULT NULL,
   `latitude` double DEFAULT NULL,
-  `purchasing_time` datetime DEFAULT NULL,
-  `install_time` datetime DEFAULT NULL,
+  `purchasing_time` varchar(50) DEFAULT NULL,
+  `install_time` varchar(50) DEFAULT NULL,
   `manufacturer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
   `mark_name` varchar(50) DEFAULT NULL,
-  `mark_time` datetime DEFAULT NULL,
+  `mark_time` varchar(50) DEFAULT NULL,
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 
--- 姝e湪瀵煎嚭琛�  mayi_kunlun.devices_management 鐨勬暟鎹細~0 rows (澶х害)
+-- 姝e湪瀵煎嚭琛�  mayi_kunlun.devices_management_info 鐨勬暟鎹細~3 rows (澶х害)
+INSERT INTO `devices_management_info` (`id`, `devices_name`, `devices_type`, `devices_serial_number`, `devices_status`, `area`, `longitude`, `latitude`, `purchasing_time`, `install_time`, `manufacturer`, `mark_name`, `mark_time`) VALUES
+	(2, '12', '3', '2', '2', '3', 4, 6, '6', '3', '3', NULL, NULL),
+	(3, '3', '1', '3', '3', '1', 2, 5, '6', '3', '6', NULL, NULL),
+	(4, '10', '1', '3', '3', '1', 2, 5, '9', '3', '6', NULL, NULL);
 
 -- 瀵煎嚭  琛� mayi_kunlun.month_info 缁撴瀯
 CREATE TABLE IF NOT EXISTS `month_info` (
@@ -112,6 +117,16 @@
 
 -- 姝e湪瀵煎嚭琛�  mayi_kunlun.role_info 鐨勬暟鎹細~0 rows (澶х害)
 
+-- 瀵煎嚭  琛� mayi_kunlun.student 缁撴瀯
+CREATE TABLE IF NOT EXISTS `student` (
+  `id` int NOT NULL AUTO_INCREMENT,
+  `name` varchar(50) DEFAULT NULL,
+  `age` int DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+
+-- 姝e湪瀵煎嚭琛�  mayi_kunlun.student 鐨勬暟鎹細~0 rows (澶х害)
+
 -- 瀵煎嚭  琛� mayi_kunlun.threshold_info 缁撴瀯
 CREATE TABLE IF NOT EXISTS `threshold_info` (
   `id` int NOT NULL AUTO_INCREMENT,
@@ -128,19 +143,21 @@
 -- 瀵煎嚭  琛� mayi_kunlun.user_info 缁撴瀯
 CREATE TABLE IF NOT EXISTS `user_info` (
   `id` int NOT NULL AUTO_INCREMENT,
-  `department` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
-  `user_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
+  `department` varchar(50) DEFAULT NULL,
+  `user_name` varchar(32) DEFAULT NULL,
   `password` varchar(32) DEFAULT NULL,
-  `user_no` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
+  `user_no` varchar(10) DEFAULT NULL,
   `age` int DEFAULT NULL,
   `sex` varchar(10) DEFAULT NULL,
-  `role_id` int DEFAULT NULL,
   `email` varchar(32) DEFAULT NULL,
   `telephone` varchar(32) DEFAULT NULL,
   `status` int DEFAULT NULL,
+  `role_id` int DEFAULT NULL,
   `login_time` datetime DEFAULT NULL,
   `register_time` datetime DEFAULT NULL,
-  PRIMARY KEY (`id`)
+  PRIMARY KEY (`id`),
+  KEY `role_id` (`role_id`),
+  CONSTRAINT `user_info_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role_info` (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 
 -- 姝e湪瀵煎嚭琛�  mayi_kunlun.user_info 鐨勬暟鎹細~0 rows (澶х害)
@@ -155,13 +172,9 @@
   `c_filepath` varchar(256) NOT NULL,
   `uploader` char(64) NOT NULL DEFAULT '',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 
--- 姝e湪瀵煎嚭琛�  mayi_kunlun.version_file 鐨勬暟鎹細~3 rows (澶х害)
-INSERT INTO `version_file` (`id`, `version_id`, `filename`, `fliesize`, `s_filepath`, `c_filepath`, `uploader`) VALUES
-	(1, '1.3', '1.jpd', 12555, './versoin', './2', ''),
-	(2, '1.4', '2.jpd', 1255, './', './2', ''),
-	(3, '1.5', '3.jpd', 122, './', './2', '');
+-- 姝e湪瀵煎嚭琛�  mayi_kunlun.version_file 鐨勬暟鎹細~0 rows (澶х害)
 
 -- 瀵煎嚭  琛� mayi_kunlun.version_info 缁撴瀯
 CREATE TABLE IF NOT EXISTS `version_info` (
@@ -171,9 +184,9 @@
   `version_description` char(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
   `version_creatime` datetime NOT NULL,
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 
--- 姝e湪瀵煎嚭琛�  mayi_kunlun.version_info 鐨勬暟鎹細~3 rows (澶х害)
+-- 姝e湪瀵煎嚭琛�  mayi_kunlun.version_info 鐨勬暟鎹細~2 rows (澶х害)
 INSERT INTO `version_info` (`id`, `version_id`, `version_id_old`, `version_description`, `version_creatime`) VALUES
 	(1, '1.3', '1.3', '225', '2024-10-29 15:47:00'),
 	(2, '1.4', '1.4', '226', '2024-10-30 02:47:30'),
diff --git "a/\350\241\250.docx" "b/\350\241\250.docx"
index 50f24ec..5a560d6 100644
--- "a/\350\241\250.docx"
+++ "b/\350\241\250.docx"
Binary files differ

--
Gitblit v1.8.0