├── G28_图书管理系统报告.pdf ├── Library ├── .vs │ └── Library │ │ └── v14 │ │ └── .suo ├── BOOK.h ├── GeneratedFiles │ └── Debug │ │ └── moc_library.cpp ├── Library.VC.db ├── Library.pro ├── Library.pro.user ├── Library.sln ├── Library.vcxproj ├── Library.vcxproj.filters ├── Library.vcxproj.user ├── User.h ├── a.jpg ├── controller.h ├── debug │ ├── Library.exe │ ├── Library.ilk │ ├── Library.pdb │ └── libmysql.dll ├── library.cpp ├── library.h ├── library.jpg ├── log_ctl.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── picture.jpg ├── title.jpg └── x64 │ └── Debug │ ├── Library.log │ ├── Library.tlog │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── Library.lastbuildstate │ ├── custombuild.command.1.tlog │ ├── custombuild.read.1.tlog │ ├── custombuild.write.1.tlog │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ └── link.write.1.tlog │ ├── library.obj │ ├── main.obj │ ├── moc_library.obj │ └── vc140.pdb └── README.md /G28_图书管理系统报告.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/G28_图书管理系统报告.pdf -------------------------------------------------------------------------------- /Library/.vs/Library/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/.vs/Library/v14/.suo -------------------------------------------------------------------------------- /Library/BOOK.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/BOOK.h -------------------------------------------------------------------------------- /Library/GeneratedFiles/Debug/moc_library.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'library.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.6.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../../library.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'library.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.6.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | struct qt_meta_stringdata_Library_t { 22 | QByteArrayData data[25]; 23 | char stringdata0[263]; 24 | }; 25 | #define QT_MOC_LITERAL(idx, ofs, len) \ 26 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 27 | qptrdiff(offsetof(qt_meta_stringdata_Library_t, stringdata0) + ofs \ 28 | - idx * sizeof(QByteArrayData)) \ 29 | ) 30 | static const qt_meta_stringdata_Library_t qt_meta_stringdata_Library = { 31 | { 32 | QT_MOC_LITERAL(0, 0, 7), // "Library" 33 | QT_MOC_LITERAL(1, 8, 10), // "updatetime" 34 | QT_MOC_LITERAL(2, 19, 0), // "" 35 | QT_MOC_LITERAL(3, 20, 10), // "setwindow4" 36 | QT_MOC_LITERAL(4, 31, 10), // "setwindow5" 37 | QT_MOC_LITERAL(5, 42, 11), // "setwindow01" 38 | QT_MOC_LITERAL(6, 54, 11), // "setwindow02" 39 | QT_MOC_LITERAL(7, 66, 12), // "setbutton011" 40 | QT_MOC_LITERAL(8, 79, 11), // "setbutton21" 41 | QT_MOC_LITERAL(9, 91, 11), // "setbutton72" 42 | QT_MOC_LITERAL(10, 103, 11), // "setbutton83" 43 | QT_MOC_LITERAL(11, 115, 11), // "setbutton92" 44 | QT_MOC_LITERAL(12, 127, 6), // "Query1" 45 | QT_MOC_LITERAL(13, 134, 10), // "QueryTree1" 46 | QT_MOC_LITERAL(14, 145, 16), // "QTreeWidgetItem*" 47 | QT_MOC_LITERAL(15, 162, 8), // "AddBook7" 48 | QT_MOC_LITERAL(16, 171, 8), // "AddUser5" 49 | QT_MOC_LITERAL(17, 180, 5), // "Logon" 50 | QT_MOC_LITERAL(18, 186, 9), // "Logon_out" 51 | QT_MOC_LITERAL(19, 196, 11), // "Borrow_Book" 52 | QT_MOC_LITERAL(20, 208, 11), // "Return_Book" 53 | QT_MOC_LITERAL(21, 220, 11), // "DeleteUser3" 54 | QT_MOC_LITERAL(22, 232, 8), // "OpenFile" 55 | QT_MOC_LITERAL(23, 241, 12), // "DeleteBook01" 56 | QT_MOC_LITERAL(24, 254, 8) // "AddBook8" 57 | 58 | }, 59 | "Library\0updatetime\0\0setwindow4\0" 60 | "setwindow5\0setwindow01\0setwindow02\0" 61 | "setbutton011\0setbutton21\0setbutton72\0" 62 | "setbutton83\0setbutton92\0Query1\0" 63 | "QueryTree1\0QTreeWidgetItem*\0AddBook7\0" 64 | "AddUser5\0Logon\0Logon_out\0Borrow_Book\0" 65 | "Return_Book\0DeleteUser3\0OpenFile\0" 66 | "DeleteBook01\0AddBook8" 67 | }; 68 | #undef QT_MOC_LITERAL 69 | 70 | static const uint qt_meta_data_Library[] = { 71 | 72 | // content: 73 | 7, // revision 74 | 0, // classname 75 | 0, 0, // classinfo 76 | 22, 14, // methods 77 | 0, 0, // properties 78 | 0, 0, // enums/sets 79 | 0, 0, // constructors 80 | 0, // flags 81 | 0, // signalCount 82 | 83 | // slots: name, argc, parameters, tag, flags 84 | 1, 0, 124, 2, 0x08 /* Private */, 85 | 3, 0, 125, 2, 0x08 /* Private */, 86 | 4, 0, 126, 2, 0x08 /* Private */, 87 | 5, 0, 127, 2, 0x08 /* Private */, 88 | 6, 0, 128, 2, 0x08 /* Private */, 89 | 7, 0, 129, 2, 0x08 /* Private */, 90 | 8, 0, 130, 2, 0x08 /* Private */, 91 | 9, 0, 131, 2, 0x08 /* Private */, 92 | 10, 0, 132, 2, 0x08 /* Private */, 93 | 11, 0, 133, 2, 0x08 /* Private */, 94 | 12, 0, 134, 2, 0x08 /* Private */, 95 | 13, 2, 135, 2, 0x08 /* Private */, 96 | 15, 0, 140, 2, 0x08 /* Private */, 97 | 16, 0, 141, 2, 0x08 /* Private */, 98 | 17, 0, 142, 2, 0x08 /* Private */, 99 | 18, 0, 143, 2, 0x08 /* Private */, 100 | 19, 0, 144, 2, 0x08 /* Private */, 101 | 20, 0, 145, 2, 0x08 /* Private */, 102 | 21, 0, 146, 2, 0x08 /* Private */, 103 | 22, 0, 147, 2, 0x08 /* Private */, 104 | 23, 0, 148, 2, 0x08 /* Private */, 105 | 24, 0, 149, 2, 0x08 /* Private */, 106 | 107 | // slots: parameters 108 | QMetaType::Void, 109 | QMetaType::Void, 110 | QMetaType::Void, 111 | QMetaType::Void, 112 | QMetaType::Void, 113 | QMetaType::Void, 114 | QMetaType::Void, 115 | QMetaType::Void, 116 | QMetaType::Void, 117 | QMetaType::Void, 118 | QMetaType::Void, 119 | QMetaType::Void, 0x80000000 | 14, QMetaType::Int, 2, 2, 120 | QMetaType::Void, 121 | QMetaType::Void, 122 | QMetaType::Void, 123 | QMetaType::Void, 124 | QMetaType::Void, 125 | QMetaType::Void, 126 | QMetaType::Void, 127 | QMetaType::Void, 128 | QMetaType::Void, 129 | QMetaType::Void, 130 | 131 | 0 // eod 132 | }; 133 | 134 | void Library::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 135 | { 136 | if (_c == QMetaObject::InvokeMetaMethod) { 137 | Library *_t = static_cast(_o); 138 | Q_UNUSED(_t) 139 | switch (_id) { 140 | case 0: _t->updatetime(); break; 141 | case 1: _t->setwindow4(); break; 142 | case 2: _t->setwindow5(); break; 143 | case 3: _t->setwindow01(); break; 144 | case 4: _t->setwindow02(); break; 145 | case 5: _t->setbutton011(); break; 146 | case 6: _t->setbutton21(); break; 147 | case 7: _t->setbutton72(); break; 148 | case 8: _t->setbutton83(); break; 149 | case 9: _t->setbutton92(); break; 150 | case 10: _t->Query1(); break; 151 | case 11: _t->QueryTree1((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; 152 | case 12: _t->AddBook7(); break; 153 | case 13: _t->AddUser5(); break; 154 | case 14: _t->Logon(); break; 155 | case 15: _t->Logon_out(); break; 156 | case 16: _t->Borrow_Book(); break; 157 | case 17: _t->Return_Book(); break; 158 | case 18: _t->DeleteUser3(); break; 159 | case 19: _t->OpenFile(); break; 160 | case 20: _t->DeleteBook01(); break; 161 | case 21: _t->AddBook8(); break; 162 | default: ; 163 | } 164 | } 165 | } 166 | 167 | const QMetaObject Library::staticMetaObject = { 168 | { &QObject::staticMetaObject, qt_meta_stringdata_Library.data, 169 | qt_meta_data_Library, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} 170 | }; 171 | 172 | 173 | const QMetaObject *Library::metaObject() const 174 | { 175 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 176 | } 177 | 178 | void *Library::qt_metacast(const char *_clname) 179 | { 180 | if (!_clname) return Q_NULLPTR; 181 | if (!strcmp(_clname, qt_meta_stringdata_Library.stringdata0)) 182 | return static_cast(const_cast< Library*>(this)); 183 | return QObject::qt_metacast(_clname); 184 | } 185 | 186 | int Library::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 187 | { 188 | _id = QObject::qt_metacall(_c, _id, _a); 189 | if (_id < 0) 190 | return _id; 191 | if (_c == QMetaObject::InvokeMetaMethod) { 192 | if (_id < 22) 193 | qt_static_metacall(this, _c, _id, _a); 194 | _id -= 22; 195 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 196 | if (_id < 22) 197 | *reinterpret_cast(_a[0]) = -1; 198 | _id -= 22; 199 | } 200 | return _id; 201 | } 202 | QT_END_MOC_NAMESPACE 203 | -------------------------------------------------------------------------------- /Library/Library.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/Library.VC.db -------------------------------------------------------------------------------- /Library/Library.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-05-24T16:14:13 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = Library 12 | TEMPLATE = app 13 | 14 | 15 | SOURCES += main.cpp \ 16 | library.cpp 17 | 18 | HEADERS += \ 19 | library.h 20 | -------------------------------------------------------------------------------- /Library/Library.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {ba9da7b9-8e45-474b-8e00-af3c0e101def} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | 0 45 | 8 46 | true 47 | 1 48 | true 49 | true 50 | true 51 | false 52 | 53 | 54 | 55 | ProjectExplorer.Project.PluginSettings 56 | 57 | 58 | 59 | ProjectExplorer.Project.Target.0 60 | 61 | Desktop Qt 5.6.0 MSVC2015 64bit 62 | Desktop Qt 5.6.0 MSVC2015 64bit 63 | qt.56.win64_msvc2015_64_kit 64 | 0 65 | 0 66 | 0 67 | 68 | D:/QT/build-Library-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug 69 | 70 | 71 | true 72 | qmake 73 | 74 | QtProjectManager.QMakeBuildStep 75 | true 76 | 77 | false 78 | false 79 | false 80 | 81 | 82 | true 83 | Make 84 | 85 | Qt4ProjectManager.MakeStep 86 | 87 | false 88 | 89 | 90 | 91 | 2 92 | 构建 93 | 94 | ProjectExplorer.BuildSteps.Build 95 | 96 | 97 | 98 | true 99 | Make 100 | 101 | Qt4ProjectManager.MakeStep 102 | 103 | true 104 | clean 105 | 106 | 107 | 1 108 | 清理 109 | 110 | ProjectExplorer.BuildSteps.Clean 111 | 112 | 2 113 | false 114 | 115 | Debug 116 | 117 | Qt4ProjectManager.Qt4BuildConfiguration 118 | 2 119 | true 120 | 121 | 122 | D:/QT/build-Library-Desktop_Qt_5_6_0_MSVC2015_64bit-Release 123 | 124 | 125 | true 126 | qmake 127 | 128 | QtProjectManager.QMakeBuildStep 129 | false 130 | 131 | false 132 | false 133 | false 134 | 135 | 136 | true 137 | Make 138 | 139 | Qt4ProjectManager.MakeStep 140 | 141 | false 142 | 143 | 144 | 145 | 2 146 | 构建 147 | 148 | ProjectExplorer.BuildSteps.Build 149 | 150 | 151 | 152 | true 153 | Make 154 | 155 | Qt4ProjectManager.MakeStep 156 | 157 | true 158 | clean 159 | 160 | 161 | 1 162 | 清理 163 | 164 | ProjectExplorer.BuildSteps.Clean 165 | 166 | 2 167 | false 168 | 169 | Release 170 | 171 | Qt4ProjectManager.Qt4BuildConfiguration 172 | 0 173 | true 174 | 175 | 176 | D:/QT/build-Library-Desktop_Qt_5_6_0_MSVC2015_64bit-Profile 177 | 178 | 179 | true 180 | qmake 181 | 182 | QtProjectManager.QMakeBuildStep 183 | true 184 | 185 | false 186 | true 187 | false 188 | 189 | 190 | true 191 | Make 192 | 193 | Qt4ProjectManager.MakeStep 194 | 195 | false 196 | 197 | 198 | 199 | 2 200 | 构建 201 | 202 | ProjectExplorer.BuildSteps.Build 203 | 204 | 205 | 206 | true 207 | Make 208 | 209 | Qt4ProjectManager.MakeStep 210 | 211 | true 212 | clean 213 | 214 | 215 | 1 216 | 清理 217 | 218 | ProjectExplorer.BuildSteps.Clean 219 | 220 | 2 221 | false 222 | 223 | Profile 224 | 225 | Qt4ProjectManager.Qt4BuildConfiguration 226 | 0 227 | true 228 | 229 | 3 230 | 231 | 232 | 0 233 | 部署 234 | 235 | ProjectExplorer.BuildSteps.Deploy 236 | 237 | 1 238 | 在本地部署 239 | 240 | ProjectExplorer.DefaultDeployConfiguration 241 | 242 | 1 243 | 244 | 245 | false 246 | 1000 247 | 248 | true 249 | 250 | false 251 | false 252 | false 253 | false 254 | true 255 | 0.01 256 | 10 257 | true 258 | 1 259 | 25 260 | 261 | 1 262 | true 263 | false 264 | true 265 | valgrind 266 | 267 | 0 268 | 1 269 | 2 270 | 3 271 | 4 272 | 5 273 | 6 274 | 7 275 | 8 276 | 9 277 | 10 278 | 11 279 | 12 280 | 13 281 | 14 282 | 283 | 2 284 | 285 | Library 286 | 287 | Qt4ProjectManager.Qt4RunConfiguration:D:/QT/Library/Library.pro 288 | true 289 | 290 | Library.pro 291 | false 292 | false 293 | 294 | 3768 295 | false 296 | true 297 | false 298 | false 299 | true 300 | 301 | 1 302 | 303 | 304 | 305 | ProjectExplorer.Project.TargetCount 306 | 1 307 | 308 | 309 | ProjectExplorer.Project.Updater.FileVersion 310 | 18 311 | 312 | 313 | Version 314 | 18 315 | 316 | 317 | -------------------------------------------------------------------------------- /Library/Library.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Library", "Library.vcxproj", "{4664641C-25A9-393B-A458-E9EA451295C3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {4664641C-25A9-393B-A458-E9EA451295C3}.Debug|x64.ActiveCfg = Debug|x64 15 | {4664641C-25A9-393B-A458-E9EA451295C3}.Debug|x64.Build.0 = Debug|x64 16 | {4664641C-25A9-393B-A458-E9EA451295C3}.Release|x64.ActiveCfg = Release|x64 17 | {4664641C-25A9-393B-A458-E9EA451295C3}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Library/Library.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Release 6 | x64 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | 14 | {4664641C-25A9-393B-A458-E9EA451295C3} 15 | Library 16 | Qt4VSv1.0 17 | 18 | 19 | 20 | v140 21 | release\ 22 | false 23 | NotSet 24 | Application 25 | release\ 26 | Library 27 | 28 | 29 | v140 30 | debug\ 31 | false 32 | NotSet 33 | Application 34 | debug\ 35 | Library 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | release\ 48 | $(Platform)\$(Configuration)\ 49 | Library 50 | true 51 | false 52 | debug\ 53 | $(Platform)\$(Configuration)\ 54 | Library 55 | true 56 | 57 | 58 | 59 | .;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtWidgets;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtGui;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtANGLE;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtCore;release;C:\Qt\Qt5.6.0\5.6\msvc2015_64\mkspecs\win32-msvc2015;%(AdditionalIncludeDirectories) 60 | -Zc:strictStrings -Zc:throwingNew -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) 61 | release\ 62 | false 63 | None 64 | 4577;%(DisableSpecificWarnings) 65 | Sync 66 | $(IntDir) 67 | MaxSpeed 68 | _WINDOWS;UNICODE;WIN32;WIN64;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;NDEBUG;%(PreprocessorDefinitions) 69 | false 70 | $(IntDir)vc$(PlatformToolsetVersion).pdb 71 | MultiThreadedDLL 72 | true 73 | true 74 | true 75 | Level3 76 | 77 | 78 | C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\qtmain.lib;shell32.lib;C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\Qt5Widgets.lib;C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\Qt5Gui.lib;C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\Qt5Core.lib;%(AdditionalDependencies) 79 | C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib;C:\utils\postgresql\pgsql\lib;C:\utils\my_sql\my_sql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories) 80 | "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) 81 | true 82 | false 83 | true 84 | false 85 | $(OutDir)\Library.exe 86 | true 87 | Windows 88 | true 89 | 90 | 91 | Unsigned 92 | None 93 | 0 94 | 95 | 96 | _WINDOWS;UNICODE;WIN32;WIN64;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) 97 | 98 | 99 | 100 | 101 | C:\Program Files\MySQL\MySQL Server 5.7\include;.;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtWidgets;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtGui;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtANGLE;C:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtCore;debug;C:\Qt\Qt5.6.0\5.6\msvc2015_64\mkspecs\win32-msvc2015;%(AdditionalIncludeDirectories) 102 | -Zc:strictStrings -Zc:throwingNew -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) 103 | debug\ 104 | false 105 | ProgramDatabase 106 | 4577;%(DisableSpecificWarnings) 107 | Sync 108 | $(IntDir) 109 | Disabled 110 | _WINDOWS;UNICODE;WIN32;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) 111 | false 112 | MultiThreadedDebugDLL 113 | true 114 | true 115 | true 116 | Level3 117 | $(IntDir)vc$(PlatformToolsetVersion).pdb 118 | 119 | 120 | C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\qtmaind.lib;shell32.lib;C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\Qt5Widgetsd.lib;libmysql.lib;C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\Qt5Guid.lib;C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib\Qt5Cored.lib;%(AdditionalDependencies) 121 | C:\Program Files\MySQL\MySQL Server 5.7\lib;C:\Qt\Qt5.6.0\5.6\msvc2015_64\lib;C:\utils\postgresql\pgsql\lib;C:\utils\my_sql\my_sql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories) 122 | "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) 123 | true 124 | true 125 | true 126 | $(OutDir)\Library.exe 127 | true 128 | Windows 129 | true 130 | 131 | 132 | Unsigned 133 | None 134 | 0 135 | 136 | 137 | _WINDOWS;UNICODE;WIN32;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) 138 | 139 | 140 | 141 | 142 | true 143 | 144 | 145 | true 146 | 147 | 148 | 149 | 150 | 151 | 152 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG "-I." "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtWidgets" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtGui" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtANGLE" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtCore" "-I.\release" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\mkspecs\win32-msvc2015" 153 | Moc%27ing library.h... 154 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB "-IC:\Program Files\MySQL\MySQL Server 5.7\include" "-I." "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtWidgets" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtGui" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtANGLE" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\include\QtCore" "-I.\debug" "-IC:\Qt\Qt5.6.0\5.6\msvc2015_64\mkspecs\win32-msvc2015" 155 | Moc%27ing library.h... 156 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 157 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 158 | $(QTDIR)\bin\moc.exe;%(FullPath) 159 | $(QTDIR)\bin\moc.exe;%(FullPath) 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /Library/Library.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} 6 | cpp;c;cxx;moc;h;def;odl;idl;res; 7 | 8 | 9 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} 10 | cpp;c;cxx;moc;h;def;odl;idl;res; 11 | 12 | 13 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 14 | h;hpp;hxx;hm;inl;inc;xsd 15 | 16 | 17 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 18 | h;hpp;hxx;hm;inl;inc;xsd 19 | 20 | 21 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 22 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 23 | 24 | 25 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 26 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 27 | 28 | 29 | {fdaa3326-b125-41cc-b1a7-472365ba02ee} 30 | cpp;moc 31 | False 32 | 33 | 34 | {a524ead8-bc26-4255-801d-d62fe60711e6} 35 | cpp;moc 36 | False 37 | 38 | 39 | 40 | 41 | Source Files 42 | 43 | 44 | Source Files 45 | 46 | 47 | Generated Files\Debug 48 | 49 | 50 | Generated Files\Release 51 | 52 | 53 | 54 | 55 | Header Files 56 | 57 | 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | -------------------------------------------------------------------------------- /Library/Library.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Qt\Qt5.6.0\5.6\msvc2015_64 6 | PATH=$(QTDIR)\bin%3b$(PATH) 7 | 8 | 9 | C:\Qt\Qt5.6.0\5.6\msvc2015_64 10 | PATH=$(QTDIR)\bin%3b$(PATH) 11 | 12 | -------------------------------------------------------------------------------- /Library/User.h: -------------------------------------------------------------------------------- 1 | #ifndef _USER_H_ 2 | #define _USER_H_ 3 | #include 4 | using namespace std; 5 | 6 | class User { 7 | public: 8 | string id; 9 | string name; 10 | string password; 11 | bool priv; 12 | int booknum; 13 | }; 14 | class UserQuery { 15 | public: 16 | string id; 17 | string name; 18 | string password; 19 | std::vector Users; 20 | }; 21 | 22 | class Manager { 23 | public: 24 | string id; 25 | string name; 26 | string password; 27 | }; 28 | #endif // !_USER_H_ 29 | -------------------------------------------------------------------------------- /Library/a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/a.jpg -------------------------------------------------------------------------------- /Library/controller.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONTROLLER_H_ 2 | #define _CONTROLLER_H_ 3 | #include"BOOK.h" 4 | #include"mysql.h" 5 | #include"User.h" 6 | #include 7 | using namespace std; 8 | 9 | class controller { 10 | private: 11 | string interpret(BookQuery & q) { 12 | if (q.book_id.empty() && q.name.empty() && q.author.empty() && q.publisher.empty() && q.publisher.empty() && (!q.begin_year) 13 | && (!q.end_year) && (q.low_price < 0) && (q.high_price < 0) && (q.type.empty())) 14 | { 15 | if (q.have_stock) 16 | return "select * from book where stock > 0;"; 17 | else return "select * from book;"; 18 | } 19 | string query = "select * from book where "; 20 | 21 | if (!q.book_id.empty()) { 22 | query += " book_id= '" + q.book_id + "' and"; 23 | } 24 | if (!q.name.empty()) { 25 | query += " name= '" + q.name + "' and"; 26 | } 27 | if (!q.author.empty()) { 28 | query += " author_name = '" + q.author + "' and"; 29 | } 30 | if (!q.publisher.empty()) { 31 | query += " publisher= '" + q.publisher + "' and"; 32 | } 33 | if (q.begin_year) { 34 | char tem[10]; 35 | sprintf(tem, "%d", q.begin_year); 36 | string tem1 = tem; 37 | query += " publish_year>= " + tem1 + " and"; 38 | } 39 | if (q.end_year) { 40 | char tem[10]; 41 | sprintf(tem, "%d", q.end_year); 42 | string tem1 = tem; 43 | query += " publish_year<= " + tem1 + " and"; 44 | } 45 | if (q.low_price) { 46 | char tem[10]; 47 | sprintf(tem, "%lf", q.low_price); 48 | string tem1 = tem; 49 | query += " price >= " + tem1 + " and"; 50 | } 51 | if (q.high_price > 0 && q.high_price >= q.low_price) { 52 | char tem[10]; 53 | sprintf(tem, "%lf", q.high_price); 54 | string tem1 = tem; 55 | query += " price <= " + tem1 + " and"; 56 | } 57 | if (q.have_stock) { 58 | query += " stock > 0 and"; 59 | } 60 | if (!q.type.empty()) { 61 | query += " type = '" + q.type + "' and"; 62 | } 63 | query.erase(query.size() - 3, 3); 64 | query += ";"; 65 | return query; 66 | } 67 | string interpret9(BookQuery & q) { 68 | if (q.book_id.empty() && q.name.empty() && q.author.empty() && q.publisher.empty() && q.publisher.empty() && (!q.begin_year) 69 | && (!q.end_year) && (q.low_price < 0) && (q.high_price < 0) && (q.type.empty())) 70 | { 71 | return ""; 72 | } 73 | string query = "select * from book where "; 74 | 75 | if (!q.book_id.empty()) { 76 | query += " book_id= '" + q.book_id + "' and"; 77 | } 78 | if (!q.name.empty()) { 79 | query += " name= '" + q.name + "' and"; 80 | } 81 | if (!q.author.empty()) { 82 | query += " author_name = '" + q.author + "' and"; 83 | } 84 | if (!q.publisher.empty()) { 85 | query += " publisher= '" + q.publisher + "' and"; 86 | } 87 | if (q.begin_year) { 88 | char tem[10]; 89 | sprintf(tem, "%d", q.begin_year); 90 | string tem1 = tem; 91 | query += " publish_year>= " + tem1 + " and"; 92 | } 93 | if (q.end_year) { 94 | char tem[10]; 95 | sprintf(tem, "%d", q.end_year); 96 | string tem1 = tem; 97 | query += " publish_year<= " + tem1 + " and"; 98 | } 99 | if (q.low_price >= 0) { 100 | char tem[10]; 101 | sprintf(tem, "%lf", q.low_price); 102 | string tem1 = tem; 103 | query += " price >= " + tem1 + " and"; 104 | } 105 | if (q.high_price > 0 && q.high_price >= q.low_price) { 106 | char tem[10]; 107 | sprintf(tem, "%lf", q.high_price); 108 | string tem1 = tem; 109 | query += " price <= " + tem1 + " and"; 110 | } 111 | if (q.have_stock) { 112 | query += " stock > 0 and"; 113 | } 114 | if (q.type != " ") { 115 | query += " type = '" + q.type + "' and"; 116 | } 117 | query.erase(query.size() - 3, 3); 118 | query += ";"; 119 | return query; 120 | } 121 | int type; 122 | public: 123 | void select(BookQuery & q, MYSQL& sql) { 124 | q.Catalog.clear(); 125 | MYSQL_RES *res_ptr; 126 | MYSQL_ROW result_row; 127 | Book tem; 128 | int column, row; 129 | string query = interpret(q); 130 | if (query.size() > 0) 131 | { 132 | mysql_query(&sql, query.c_str()); 133 | res_ptr = mysql_store_result(&sql); 134 | column = mysql_num_fields(res_ptr); 135 | row = mysql_num_rows(res_ptr) + 1; 136 | for (int i = 1; i < row; i++) { 137 | result_row = mysql_fetch_row(res_ptr); 138 | tem.book_id = result_row[0]; 139 | tem.name = result_row[1]; 140 | tem.author = result_row[2]; 141 | tem.price = atof(result_row[3]); 142 | tem.num = atoi(result_row[4]); 143 | tem.stock = atoi(result_row[5]); 144 | tem.publisher = result_row[6]; 145 | tem.publish_date = result_row[7]; 146 | tem.type = result_row[8]; 147 | q.Catalog.push_back(tem); 148 | } 149 | } 150 | } 151 | void select9(BookQuery & q, MYSQL& sql) { 152 | q.Catalog.clear(); 153 | MYSQL_RES *res_ptr; 154 | MYSQL_ROW result_row; 155 | Book tem; 156 | int column, row; 157 | string query = interpret9(q); 158 | if (query != "select * from book whe;") 159 | { 160 | mysql_query(&sql, query.c_str()); 161 | res_ptr = mysql_store_result(&sql); 162 | column = mysql_num_fields(res_ptr); 163 | row = mysql_num_rows(res_ptr) + 1; 164 | for (int i = 1; i < row; i++) { 165 | result_row = mysql_fetch_row(res_ptr); 166 | tem.book_id = result_row[0]; 167 | tem.name = result_row[1]; 168 | tem.author = result_row[2]; 169 | tem.price = atof(result_row[3]); 170 | tem.num = atoi(result_row[4]); 171 | tem.stock = atoi(result_row[5]); 172 | tem.publisher = result_row[6]; 173 | tem.publish_date = result_row[7]; 174 | tem.type = result_row[8]; 175 | q.Catalog.push_back(tem); 176 | } 177 | } 178 | } 179 | int insert(Book& q, MYSQL& sql) { 180 | MYSQL_RES *res_ptr; 181 | MYSQL_ROW result_row; 182 | string query = "select * from book where book_id ='" + q.book_id + "';"; 183 | mysql_query(&sql, query.c_str()); 184 | res_ptr = mysql_store_result(&sql); 185 | result_row = mysql_fetch_row(res_ptr); 186 | //row = mysql_num_rows(res_ptr); 187 | if (result_row == NULL) { 188 | query = "insert into book values('"; 189 | char tem[10]; 190 | sprintf(tem, "%lf", q.price); 191 | string tem1 = tem; 192 | query += q.book_id + "','" + q.name + "','" + q.author + "'," + tem1; 193 | sprintf(tem, "%d", q.num); 194 | tem1 = tem; 195 | query += "," + tem1 + ","; 196 | sprintf(tem, "%d", q.stock); 197 | tem1 = tem; 198 | query += tem1 + ",'" + q.publisher + "',"; 199 | /*sprintf(tem, "%d", q.publish_date); 200 | tem1 = tem;*/ 201 | query += q.publish_date + ",'" + q.type + "');"; 202 | int x = mysql_query(&sql, query.c_str()); 203 | return x; 204 | } 205 | else { 206 | string tem1, tem2; 207 | char tem[10]; 208 | sprintf(tem, "%d", q.num); 209 | tem1 = tem; 210 | sprintf(tem, "%d", q.stock); 211 | tem2 = tem; 212 | query = "UPDATE book SET num = num+" + tem1 + " ,stock=stock+" + tem2 + " WHERE book_id = '" + q.book_id + "' ;"; 213 | int x = mysql_query(&sql, query.c_str()); 214 | return x; 215 | } 216 | } 217 | bool insertuser(User & _user, MYSQL &sql) { 218 | string query; 219 | query = "insert into user values('" + _user.id + "','" + _user.name + "','" + _user.password + "');"; 220 | int r = mysql_query(&sql, query.c_str()); 221 | return r == 0; 222 | } 223 | bool selectUser(User &_user, MYSQL &sql) { 224 | string query, query2; 225 | MYSQL_RES *res_ptr, *res_ptr1; 226 | MYSQL_ROW result_row, result_row1; 227 | int row; 228 | query = "select * from user where id='" + _user.id + "';"; 229 | query2 = "select count(*) from borrow where user_id ='" + _user.id + "';"; 230 | mysql_query(&sql, query.c_str()); 231 | res_ptr = mysql_store_result(&sql); 232 | row = mysql_num_rows(res_ptr); 233 | mysql_query(&sql, query2.c_str()); 234 | res_ptr1 = mysql_store_result(&sql); 235 | result_row1 = mysql_fetch_row(res_ptr1); 236 | _user.booknum = atoi(result_row1[0]); 237 | if (row == NULL) return 0; 238 | else { 239 | result_row = mysql_fetch_row(res_ptr); 240 | _user.name = result_row[1]; 241 | _user.password = result_row[2]; 242 | return 1; 243 | } 244 | } 245 | bool selectManager(Manager &_manager, MYSQL &sql) { 246 | string query; 247 | MYSQL_RES *res_ptr; 248 | MYSQL_ROW result_row; 249 | int row; 250 | query = "select * from manager where id='" + _manager.id + "';"; 251 | mysql_query(&sql, query.c_str()); 252 | res_ptr = mysql_store_result(&sql); 253 | row = mysql_num_rows(res_ptr); 254 | if (row == NULL) return 0; 255 | else { 256 | result_row = mysql_fetch_row(res_ptr); 257 | _manager.name = result_row[1]; 258 | _manager.password = result_row[2]; 259 | return 1; 260 | } 261 | } 262 | 263 | bool displayUser(UserQuery &q, MYSQL &sql) { 264 | string query, query2; 265 | MYSQL_RES *res_ptr, *res_ptr1; 266 | MYSQL_ROW result_row, result_row1; 267 | int row; 268 | query = "select * from user;"; 269 | query2 = "select count(*) from borrow where user_id ='"; 270 | int r = mysql_query(&sql, query.c_str()); 271 | if (r != 0)return 0; 272 | else 273 | { 274 | res_ptr = mysql_store_result(&sql); 275 | row = mysql_num_rows(res_ptr) + 1; 276 | User tem; 277 | for (int i = 1; i < row; i++) { 278 | result_row = mysql_fetch_row(res_ptr); 279 | tem.id = result_row[0]; 280 | tem.name = result_row[1]; 281 | tem.password = result_row[2]; 282 | tem.priv = 1; 283 | query2 = "select count(*) from borrow where user_id ='"; 284 | query2 += tem.id + "';"; 285 | mysql_query(&sql, query2.c_str()); 286 | res_ptr1 = mysql_store_result(&sql); 287 | result_row1 = mysql_fetch_row(res_ptr1); 288 | tem.booknum = atoi(result_row1[0]); 289 | q.Users.push_back(tem);//将查询信息压到vector中,主要查询信息为借书数量 290 | } 291 | return true; 292 | } 293 | } 294 | void displayborrow(string user_id, BookQuery &q, MYSQL& sql) { 295 | string query; 296 | MYSQL_RES *res_ptr, *res_ptr1; 297 | MYSQL_ROW result_row; 298 | q.Catalog.clear(); 299 | query = "select * from user where id='" + user_id + "';"; 300 | mysql_query(&sql, query.c_str()); 301 | res_ptr = mysql_store_result(&sql); 302 | result_row = mysql_fetch_row(res_ptr); 303 | if (result_row == NULL) { 304 | q.Catalog.clear(); 305 | return; 306 | } 307 | query = "select book_id from borrow where user_id='" + user_id + "'"; 308 | mysql_query(&sql, query.c_str()); 309 | res_ptr = mysql_store_result(&sql); 310 | int row; 311 | row = mysql_num_rows(res_ptr); 312 | for (int i = 1; i < row + 1; i++) { 313 | result_row = mysql_fetch_row(res_ptr); 314 | string book_id = result_row[0]; 315 | query = "select * from book where book_id='" + book_id + "'"; 316 | mysql_query(&sql, query.c_str()); 317 | res_ptr1 = mysql_store_result(&sql); 318 | result_row = mysql_fetch_row(res_ptr1); 319 | Book tem; 320 | tem.book_id = result_row[0]; 321 | tem.name = result_row[1]; 322 | tem.author = result_row[2]; 323 | tem.price = atof(result_row[3]); 324 | tem.num = atoi(result_row[4]); 325 | tem.stock = atoi(result_row[5]); 326 | tem.publisher = result_row[6]; 327 | tem.publish_date = result_row[7]; 328 | tem.type = result_row[8]; 329 | q.Catalog.push_back(tem); 330 | } 331 | } 332 | 333 | int borrowbook(string user_id, string book_id, MYSQL &sql) { //user manager 334 | MYSQL_RES *res_ptr; 335 | MYSQL_ROW result_row; 336 | int y; 337 | string query = "select * from book where book_id ='" + book_id + "';"; 338 | y = mysql_query(&sql, query.c_str()); 339 | res_ptr = mysql_store_result(&sql); 340 | result_row = mysql_fetch_row(res_ptr); 341 | if (result_row[5] == "0") 342 | { 343 | return 0;//没有库存 344 | } 345 | else 346 | { 347 | query = "update book set stock=stock-1 where book_id = '" + book_id + "';"; 348 | y = mysql_query(&sql, query.c_str()); 349 | if (y == 1) return 1; //没有更新成功 350 | QDateTime current_date_time = QDateTime::currentDateTime(); 351 | string borrow_date = (current_date_time.toString("yyyy-MM-dd hh:mm:ss")).toStdString(); 352 | string final_date = (current_date_time.addDays(30).toString("yyyy-MM-dd hh:mm:ss")).toStdString(); 353 | query = "insert into borrow values('" + user_id + "','" + book_id + "','" + 354 | borrow_date.substr(0,10) + "','" + final_date.substr(0,10) + "');"; 355 | y = mysql_query(&sql, query.c_str()); 356 | if (y == 1) { 357 | query = "update book set stock=stock+1 where book_id = '" + book_id + "';"; 358 | mysql_query(&sql, query.c_str()); 359 | return 2; //没有更新书的stock成功 360 | } 361 | else return 3; //借阅成功 362 | } 363 | } 364 | int returnbook(string & user_id,string & book_id, MYSQL &sql) { //user manager 365 | 366 | string query; 367 | 368 | query = "delete from borrow where user_id='" + user_id + "'and book_id = '" + book_id + "';"; 369 | int y = mysql_query(&sql, query.c_str()); 370 | if (y == 0) 371 | { 372 | query = "update book set stock=stock+1 where book_id = '" + book_id + "';"; 373 | y = mysql_query(&sql, query.c_str()); 374 | return y == 0; 375 | } 376 | else return y == 0; 377 | 378 | } 379 | bool deleteuser(User & _user, MYSQL &sql) { //manager 380 | string query; 381 | query = "delete from user where id = '" + _user.id + "';"; 382 | int r = mysql_query(&sql, query.c_str()); 383 | return r == 0; 384 | } 385 | bool deletebook(string& book_id, MYSQL& sql) { //manager 386 | MYSQL_RES *res_ptr; 387 | MYSQL_ROW result_row; 388 | int y; 389 | string query = "select * from borrow where book_id ='" + book_id + "';"; 390 | y = mysql_query(&sql, query.c_str()); 391 | res_ptr = mysql_store_result(&sql); 392 | result_row = mysql_fetch_row(res_ptr); 393 | //row = mysql_num_rows(res_ptr); 394 | if (result_row == NULL) { 395 | query = "delete from book where book_id = '" + book_id + "';"; 396 | int x = mysql_query(&sql, query.c_str()); 397 | return x == 0; 398 | } 399 | else return false; 400 | } 401 | 402 | bool SelectBorrow(Borrow& q, MYSQL& sql) { 403 | string query; 404 | MYSQL_RES *res_ptr; 405 | MYSQL_ROW result_row; 406 | int row; 407 | query = "select borrow_date,return_date from borrow where user_id='" + q.user_id + "'and book_id='" + q.book_id + "';"; 408 | mysql_query(&sql, query.c_str()); 409 | res_ptr = mysql_store_result(&sql); 410 | row = mysql_num_rows(res_ptr); 411 | if (row == NULL) return 0; 412 | else { 413 | result_row = mysql_fetch_row(res_ptr); 414 | q.borrow_date = result_row[0]; 415 | q.return_date = result_row[1]; 416 | return 1; 417 | } 418 | } 419 | 420 | void AddFile(string& info, vector& book, MYSQL& sql) 421 | { 422 | Book temp; 423 | int n = 0, j = 0; 424 | string str = info; 425 | for (int i = 0; i < str.size(); i++) 426 | { 427 | if (str[i] != '\n'&& str[i] != ' ') 428 | n++; 429 | else if (str[i] == ' '){ 430 | if (n == 0){ 431 | i = -1; 432 | str.erase(n, n + 1); 433 | continue; 434 | } 435 | if (j == 0){ 436 | temp.book_id = str.substr(0, n); 437 | str.erase(0, n + 1); 438 | i = -1; 439 | } 440 | else if (j == 1){ 441 | temp.name = str.substr(0, n); 442 | str.erase(0, n + 1); 443 | i = -1; 444 | } 445 | else if (j == 2){ 446 | temp.price = atof(str.substr(0, n).c_str()); 447 | str.erase(0, n + 1); 448 | i = -1; 449 | } 450 | else if (j == 3){ 451 | temp.num = atoi(str.substr(0, n).c_str()); 452 | temp.stock = temp.num; 453 | str.erase(0, n + 1); 454 | i = -1; 455 | } 456 | else if (j == 4){ 457 | temp.type = str.substr(0, n); 458 | str.erase(0, n + 1); 459 | i = -1; 460 | } 461 | else if (j == 5) 462 | { 463 | temp.publisher = str.substr(0, n); 464 | str.erase(0, n + 1); 465 | i = -1; 466 | } 467 | else if (j == 6){ 468 | temp.publish_date = str.substr(0, n); 469 | str.erase(0, n + 1); 470 | i = -1; 471 | } 472 | else if (j == 7){ 473 | temp.author = str.substr(0, n); 474 | str.erase(0, n + 1); 475 | i = -1; 476 | book.push_back(temp); 477 | } 478 | n = 0; 479 | j++; 480 | if (j>7) j = 0; 481 | } 482 | else{ 483 | if (j == 7 && n != 0) //\n只是分隔符 484 | { 485 | temp.author = str.substr(0, n); 486 | str.erase(0, n + 1); 487 | i = -1; 488 | n = 0; 489 | j = 0; 490 | book.push_back(temp); 491 | } 492 | else //数量不够 493 | { 494 | if (j == 0 && n == 0){ 495 | i = -1; 496 | str.erase(n, n + 1); 497 | 498 | } 499 | else{ 500 | return ; 501 | } 502 | } 503 | } 504 | } 505 | } 506 | }; 507 | 508 | #endif // !_controller_H_ 509 | -------------------------------------------------------------------------------- /Library/debug/Library.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/debug/Library.exe -------------------------------------------------------------------------------- /Library/debug/Library.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/debug/Library.ilk -------------------------------------------------------------------------------- /Library/debug/Library.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/debug/Library.pdb -------------------------------------------------------------------------------- /Library/debug/libmysql.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/debug/libmysql.dll -------------------------------------------------------------------------------- /Library/library.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/library.cpp -------------------------------------------------------------------------------- /Library/library.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/library.h -------------------------------------------------------------------------------- /Library/library.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/library.jpg -------------------------------------------------------------------------------- /Library/log_ctl.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOG_CTL_H_ 2 | #define _LOG_CTL_H 3 | 4 | /*使用说明: MYSQL sql; 5 | log_ctl log("localhost", "root", "310611", "library"); 6 | if (log.log(sql)){ 7 | printf("连接成功!"); 8 | }*/ 9 | 10 | #include 11 | #include 12 | using namespace std; 13 | 14 | class log_ctl { 15 | public: 16 | log_ctl(string host, string username, string password, string db) { 17 | this->host = host; 18 | this->username = username; 19 | this->password = password; 20 | this->db = db; 21 | } 22 | bool log(MYSQL& sql) { 23 | mysql_init(&sql); 24 | if (mysql_real_connect(&sql, host.c_str(), username.c_str(), password.c_str(), 25 | db.c_str(), 0, NULL, CLIENT_FOUND_ROWS)) { 26 | mysql_query(&sql, "set names 'GBK'"); //将mysql设置成为可以处理中文的模式 27 | string tem = db; 28 | string query = "use " + tem; 29 | mysql_query(&sql, query.c_str()); 30 | return true; 31 | } 32 | else 33 | return false; 34 | } 35 | private: 36 | string host; 37 | string username; 38 | string password; 39 | string db; 40 | }; 41 | 42 | 43 | #endif // !_LOG_CTL_H_ 44 | -------------------------------------------------------------------------------- /Library/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/main.cpp -------------------------------------------------------------------------------- /Library/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | MainWindow::MainWindow(QWidget *parent) 4 | : QMainWindow(parent) 5 | { 6 | } 7 | 8 | MainWindow::~MainWindow() 9 | { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /Library/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | class MainWindow : public QMainWindow 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | MainWindow(QWidget *parent = 0); 12 | ~MainWindow(); 13 | }; 14 | 15 | #endif // MAINWINDOW_H 16 | -------------------------------------------------------------------------------- /Library/picture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/picture.jpg -------------------------------------------------------------------------------- /Library/title.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/title.jpg -------------------------------------------------------------------------------- /Library/x64/Debug/Library.log: -------------------------------------------------------------------------------- 1 |  Moc'ing library.h... 2 | moc_library.cpp 3 | d:\qt\library\controller.h(420): warning C4100: “sql”: 未引用的形参 4 | library.cpp 5 | d:\qt\library\controller.h(420): warning C4100: “sql”: 未引用的形参 6 | library.cpp(266): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 7 | library.cpp(333): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 8 | library.cpp(335): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 9 | library.cpp(387): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 10 | library.cpp(389): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 11 | library.cpp(361): warning C4100: “num”: 未引用的形参 12 | library.cpp(376): warning C4189: “n”: 局部变量已初始化但不引用 13 | library.cpp(432): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 14 | library.cpp(516): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 15 | library.cpp(553): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 16 | library.cpp(677): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 17 | library.cpp(777): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 18 | library.cpp(890): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 19 | library.cpp(1160): warning C4267: “初始化”: 从“size_t”转换到“int”,可能丢失数据 20 | library.cpp(1318): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 21 | main.cpp 22 | d:\qt\library\controller.h(420): warning C4100: “sql”: 未引用的形参 23 | 正在生成代码... 24 | Library.vcxproj -> D:\QT\Library\debug\Library.exe 25 | -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/Library.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 2 | Debug|x64|D:\QT\Library\| 3 | -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/custombuild.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/custombuild.command.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/custombuild.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/custombuild.read.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/custombuild.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/custombuild.write.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/Library.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/Library.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Library/x64/Debug/library.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/library.obj -------------------------------------------------------------------------------- /Library/x64/Debug/main.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/main.obj -------------------------------------------------------------------------------- /Library/x64/Debug/moc_library.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/moc_library.obj -------------------------------------------------------------------------------- /Library/x64/Debug/vc140.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uyouii/LibraryManage/98bbbf6332d3dcadef6f1b27d11b1709041187d6/Library/x64/Debug/vc140.pdb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 图书管理系统 2 | - 一个GUI用QT实现的图书管理系统 3 | - 支持用户、游客及管理员登陆 4 | - 支持图书的查询(模糊查询)、添加、修改、删除等操作,支持文本文件批量添加图书 5 | - 数据库调用MySql实现 6 | --------------------------------------------------------------------------------