文章目录
- 前言
- 项目介绍
- 技术介绍
- 功能介绍
- 核心代码
- 数据库参考
- 系统效果图
前言
文章底部名片,获取项目的完整演示视频,免费解答技术疑问
项目介绍
随着科学技术水平的逐年发展,构建一个高效、便捷的图书借阅系统。解决传统图书馆借阅过程中存在的问题,如人工查询繁琐、借阅效率低等。系统具有良好的用户界面和操作体验,方便用户快速找到所需图书并进行借阅操作。系统有助于图书馆管理者了解图书借阅情况,优化资源配置。图书借阅系统的设计将有助于提高图书馆服务质量,满足用户日益增长的阅读需求。
图书借阅系统主要包括了前端net技术,后端vue框架技术的开发,数据库的建立和后台管理员的管理,并且采用 net语言进行开发,使用SQLServer数据库存储相关的数据。从而实现了图书借阅管理的相关功能,包含用户登陆,查看用户、图书分类、图书信息、图书借阅、图书续借、图书归还、系统管理、个人中心等功能,其操作简单,界面友好,运行比较稳定,于是适用于大部分用户。
技术介绍
开发软件:VS 2017 (版本2017以上即可,不能低于2017)
数据库:SqlServer2008r2(数据库版本无限制,都可以导入)
开发模式:mvc
浏览器:谷歌浏览器
功能介绍
图书借阅系统可以将功能划分为用户的使用功能和管理员功能。
(1)用户关键功能包含用户注册登录,图书借阅、图书续借、图书归还、我的收藏等有关信息,并进行详细操作
图书借阅系统分两大部分,即管理员管理和用户管理。系统按照用户的实际需求开发而来,贴近生活。从管理员出拿到分配好的账号密码可以进入系统,使用相关的系统应用。管理员总体负责整体系统的运行维护,统筹协调。
系统整体模块设计:系统分为管理员和用户两大用户角色,系统管理员有最大的权限,整体功能展示如图4-1所示。
图4-1 系统整体功能图
核心代码
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Newtonsoft.Json;
using Xiezn.Core.Business.Services;
using Xiezn.Core.Common.Helpers;
using Xiezn.Core.Models.ViewModel;namespace Xiezn.Core.Controllers
{/// <summary>/// 公共接口/// </summary>[Route("[action]")]public class CommonController : Controller{private readonly IHostingEnvironment _hostingEnvironment;private readonly string _savePath;private readonly CommonService _bll;private readonly ConfigService _configBLL;/// <summary>/// 构造函数/// </summary>public CommonController(IHostingEnvironment hostingEnvironment){_hostingEnvironment = hostingEnvironment;_savePath = _hostingEnvironment.WebRootPath + Path.DirectorySeparatorChar + ConfigHelper.GetConfig("SchemaName") + Path.DirectorySeparatorChar + "upload" + Path.DirectorySeparatorChar;_bll = new CommonService();_configBLL = new ConfigService();}/// <summary>/// 获取某表的某个字段列表接口/// </summary>/// <param name="tableName">表名</param>/// <param name="columnName">列名</param>/// <returns></returns>[HttpGet("{tableName}/{columnName}")]public JsonResult Option(string tableName, string columnName){try{int level = Convert.ToInt32(HttpContext.Request.Query["level"]);string parent = HttpContext.Request.Query["parent"];string conditionColumn = HttpContext.Request.Query["conditionColumn"];string conditionValue = HttpContext.Request.Query["conditionValue"];if (!string.IsNullOrEmpty(conditionColumn) && !string.IsNullOrEmpty(conditionValue)){return Json(new { Code = 0, Data = _bll.Common(tableName, columnName, "", 0, "option", 0, 0, " AND " + conditionColumn + " = '" + conditionValue + "' ") });}if (level == 0){return Json(new { Code = 0, Data = _bll.Common(tableName, columnName, parent, level) });}else{return Json(new { Code = 0, Data = _bll.Common(tableName, columnName) });}}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 根据option字段值获取某表的单行记录接口/// </summary>/// <param name="tableName">表名</param>/// <param name="columnName">列名</param>/// <param name="columnValue">列值</param>/// <returns></returns>[HttpGet("{tableName}/{columnName}")]public JsonResult Follow(string tableName, string columnName, string columnValue){try{return Json(new { Code = 0, Data = _bll.Common(tableName, columnName, columnValue, 0, "follow") });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 根据主键id修改table表的sfsh状态接口/// </summary>/// <param name="tableName">表名</param>/// <param name="id">主键id</param>/// <param name="sfsh">当前审核状态(是/否)</param>/// <returns></returns>[HttpPost("{tableName}")][Authorize(Roles = "Admin,Client")]public JsonResult Sh(string tableName, int id, string sfsh){try{if (_bll.Common(tableName, id.ToString(), sfsh, 0, "sh") > 0){return Json(new { Code = 0, Msg = "更新成功!" });}return Json(new { Code = -1, Msg = "更新失败!" });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 获取需要提醒的记录数接口/// </summary>/// <param name="tableName">表名</param>/// <param name="columnName">列名</param>/// <param name="type">类型(1表示数字比较提醒,2表示日期比较提醒)</param>/// <param name="remindStart">remindStart小于等于columnName满足条件提醒,当比较日期时,该值表示天数</param>/// <param name="remindEnd">columnName小于等于remindEnd 满足条件提醒,当比较日期时,该值表示天数</param>/// <returns></returns>[HttpGet("{tableName}/{columnName}/{type}")]public JsonResult Remind(string tableName, string columnName, int type, int remindStart, int remindEnd){try{return Json(new { Code = 0, Count = _bll.Common(tableName, columnName, "", type, "remind", remindStart, remindEnd) });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 计算规则接口/// </summary>/// <param name="tableName">表名</param>/// <param name="columnName">列名</param>/// <returns></returns>[HttpGet("{tableName}/{columnName}")]public JsonResult Cal(string tableName, string columnName){try{return Json(new { Code = 0, Data = _bll.Common(tableName, columnName, "", 0, "cal") });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 人脸比较/// </summary>/// <param name="face1">图片1名称</param>/// <param name="face2">图片2名称</param>/// <returns></returns>[HttpGet]public JsonResult MatchFace(string face1, string face2){try{BaiduAiHelper.clientId = _configBLL.GetValueByName("APIKey");BaiduAiHelper.clientSecret = _configBLL.GetValueByName("SecretKey");BaiduAiHelper.GetAccessToken();List<FaceMatchViewModel> matchInfo = new List<FaceMatchViewModel>{new FaceMatchViewModel { image = FuncHelper.ImageToBase64(_savePath + face1) },new FaceMatchViewModel { image = FuncHelper.ImageToBase64(_savePath + face2) }};string result = BaiduAiHelper.FaceMatch(JsonConvert.SerializeObject(matchInfo));dynamic resObj = JsonConvert.DeserializeObject(result);if (resObj.error_code == 0){return Json(new { Code = 0, Score = resObj.result.score, Msg = "匹配成功!" });}else{return Json(new { Code = -1, Score = 0, Msg = "匹配失败!" });}}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 定位接口(根据经纬度坐标获取到省市县(区)信息)/// </summary>/// <param name="lat">经度</param>/// <param name="lng">纬度</param>/// <returns></returns>[HttpGet]public JsonResult Location(double lat, double lng){try{AddressViewModel addressViewModel = BaiduAiHelper.GetAddress(_configBLL.GetValueByName("baidu_ditu_ak"), lng, lat);if (addressViewModel == null){return Json(new { Code = -1, Msg = "位置信息获取失败!" });}else{return Json(new { Code = 0, Data = addressViewModel });}}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 类别统计接口/// </summary>/// <param name="tableName">表名</param>/// <param name="columnName">列名</param>/// <returns></returns>[HttpGet("{tableName}/{columnName}")]public JsonResult Group(string tableName, string columnName){try{return Json(new { Code = 0, Data = _bll.Common(tableName, columnName, "", 0, "group") });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 按值统计接口/// </summary>/// <param name="tableName">表名</param>/// <param name="xColumnName">列名</param>/// <param name="yColumnName">列名</param>/// <returns></returns>[HttpGet("{tableName}/{xColumnName}/{yColumnName}")]public JsonResult Value(string tableName, string xColumnName, string yColumnName){try{return Json(new { Code = 0, Data = _bll.Common(tableName, xColumnName, yColumnName, 0, "value") });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 按时间统计类型接口/// </summary>/// <param name="tableName">表名</param>/// <param name="xColumnName">列名</param>/// <param name="yColumnName">列名</param>/// <param name="timeStatType">类型</param>/// <returns></returns>[HttpGet("{tableName}/{xColumnName}/{yColumnName}/{timeStatType}")]public JsonResult Value(string tableName, string xColumnName, string yColumnName, string timeStatType){try{return Json(new { Code = 0, Data = _bll.StatDate(tableName, xColumnName, yColumnName, timeStatType) });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}/// <summary>/// 数据备份/// </summary>/// <returns></returns>[HttpGet]public IActionResult Mysqldump(){string filepath = _savePath + "mysql.dmp";// Linuxstring cmd = "/bin/bash";string strInput = "/usr/bin/mysqldump -h127.0.0.1 -uroot -P3306 -p123456 net2h303777 > " + filepath;// Windows// string cmd = "cmd.exe";// string strInput = "D:\\mysqldump -h127.0.0.1 -uroot -P3306 -p123456 net2h303777 > " + filepath;Process p = new Process();p.StartInfo.FileName = cmd;p.StartInfo.UseShellExecute = false;p.StartInfo.RedirectStandardInput = true;p.StartInfo.RedirectStandardOutput = true;p.StartInfo.RedirectStandardError = true;p.StartInfo.CreateNoWindow = true;p.Start();p.StandardInput.WriteLine(strInput);p.StandardInput.AutoFlush = true;p.StandardInput.Close();string strOuput = p.StandardOutput.ReadToEnd();p.WaitForExit();p.Close();var stream = System.IO.File.OpenRead(filepath);return File(stream, "application/octet-stream", "mysql.dmp");}/// md5加密接口[HttpGet("{encryption}")]public IActionResult Encrypt(string encryption){try{string text = HttpContext.Request.Query["text"];string data = FuncHelper.MD5(text);return Json(new { Code = 0,Data = data });}catch (Exception ex){return Json(new { Code = 500, Msg = ex.Message });}}}
}
数据库参考
--
-- Table structure for table `aboutus`
--DROP TABLE IF EXISTS `aboutus`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `aboutus` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`title` varchar(200) NOT NULL COMMENT '标题',`subtitle` varchar(200) DEFAULT NULL COMMENT '副标题',`content` longtext NOT NULL COMMENT '内容',`picture1` longtext COMMENT '图片1',`picture2` longtext COMMENT '图片2',`picture3` longtext COMMENT '图片3',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='关于我们';
/*!40101 SET character_set_client = @saved_cs_client */;--
-- Dumping data for table `aboutus`
--LOCK TABLES `aboutus` WRITE;
/*!40000 ALTER TABLE `aboutus` DISABLE KEYS */;
INSERT INTO `aboutus` VALUES (1,'2024-03-11 11:44:04','关于我们','ABOUT US','当你设想门外是寒冷可怕的世界时,你还应该开门出去看看,是否真的如此。如果你有信心,你对前途就不犹豫了。如果你有勇气,你就不怕前途是否有困难或危险了每个人心中都应有两盏灯,一盏是希望的灯,一盏是勇气的灯。有了这两盏灯,我们就不怕海上的黑暗和风涛的险恶了。人的一生很像是在雾中行走。远远望去,只是迷蒙一片,辨不出方向和吉凶。可是,当你鼓起勇气,放下恐惧和怀疑,一步一步向前走去的时候,你就会发现,每走一步,你都能把下一步路看得清楚一点。“往前走,别站在远远的地方观望!”你就可以找到你的方向。','upload/aboutus_picture1.jpg','upload/aboutus_picture2.jpg','upload/aboutus_picture3.jpg');
/*!40000 ALTER TABLE `aboutus` ENABLE KEYS */;
UNLOCK TABLES;--
-- Table structure for table `config`
--DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`name` varchar(100) NOT NULL COMMENT '配置参数名称',`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',`url` varchar(500) DEFAULT NULL COMMENT 'url',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*!40101 SET character_set_client = @saved_cs_client */;--
-- Dumping data for table `config`
--LOCK TABLES `config` WRITE;
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
INSERT INTO `config` VALUES (1,'picture1','upload/picture1.jpg',NULL),(2,'picture2','upload/picture2.jpg',NULL),(3,'picture3','upload/picture3.jpg',NULL);
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES;--
-- Table structure for table `discusstushuxinxi`
--DROP TABLE IF EXISTS `discusstushuxinxi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `discusstushuxinxi` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`refid` bigint(20) NOT NULL COMMENT '关联表id',`userid` bigint(20) NOT NULL COMMENT '用户id',`avatarurl` longtext COMMENT '头像',`nickname` varchar(200) DEFAULT NULL COMMENT '用户名',`content` longtext NOT NULL COMMENT '评论内容',`reply` longtext COMMENT '回复内容',PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='图书信息评论表';
/*!40101 SET character_set_client = @saved_cs_client */;--
-- Dumping data for table `discusstushuxinxi`
--LOCK TABLES `discusstushuxinxi` WRITE;
/*!40000 ALTER TABLE `discusstushuxinxi` DISABLE KEYS */;
/*!40000 ALTER TABLE `discusstushuxinxi` ENABLE KEYS */;
UNLOCK TABLES;--
-- Table structure for table `news`
--DROP TABLE IF EXISTS `news`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `news` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`title` varchar(200) NOT NULL COMMENT '标题',`introduction` longtext COMMENT '简介',`typename` varchar(200) DEFAULT NULL COMMENT '分类名称',`name` varchar(200) DEFAULT NULL COMMENT '发布人',`headportrait` longtext COMMENT '头像',`clicknum` int(11) DEFAULT '0' COMMENT '点击次数',`clicktime` datetime DEFAULT NULL COMMENT '最近点击时间',`thumbsupnum` int(11) DEFAULT '0' COMMENT '赞',`crazilynum` int(11) DEFAULT '0' COMMENT '踩',`storeupnum` int(11) DEFAULT '0' COMMENT '收藏数',`picture` longtext NOT NULL COMMENT '图片',`content` longtext NOT NULL COMMENT '内容',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=utf8 COMMENT='通知公告';
/*!40101 SET character_set_client = @saved_cs_client */;
系统效果图