學生信息管理是學生管理不可缺少的部分,它的內容對於班級的教師和學生都非常重要,所以高校學生信息管理系統應該能夠為用戶提供足夠的信息和信息的查詢手段,但長時間以來對於學生信息的收集管理多是人工操作,工作繁瑣,重復,占用了很長時間。
隨著科技的發展,計算機技術日漸成熟,計算機已經普及到社會的各個領域並發揮著不可替代的作用。為方便學生信息管理,使用計算機對學生信息進行管理,具有手工管理無法比擬的優點如:僅需一次信息采集即可多次使用並且檢索迅速、查找方便、可靠性高、存儲量大、保密性好、成本低等因此,開發學生信息管理系統具有非常高的價值。
本系統主要實現了個人中心,學生管理,學籍信息管理,干部信息管理,違紀信息管理,獎金類型管理,獎金信息管理,獎金申請管理,課程表管理,考勤信息管理,請假信息管理,校園卡信息管理,校園卡信息,充值信息管理,自消費信息管理 等功能
計算機畢業設計Python+django的高校學生信息管理系統(源碼+系統+mysql數據庫+Lw文檔)
開發語言:Python
python框架:django
軟件版本:python3.7/python3.8
數據庫:mysql 5.7或更高版本
數據庫工具:Navicat11
開發軟件:PyCharm/vs code
前端框架:vue.js
可開發框架:ssm/Springboot/vue/python/PHP/小程序/安卓均可開發
#coding:utf-8
__author__ = "ila"
from django.http import JsonResponse
from django.apps import apps
from django.db.models.aggregates import Count,Sum
from .models import jiangjinshenqing
from util.codes import *
from util.auth import Auth
import util.message as mes
def jiangjinshenqing_register(request):
if request.method in ["POST", "GET"]:
msg = {
'code': normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
error = jiangjinshenqing.createbyreq(jiangjinshenqing, jiangjinshenqing, req_dict)
if error != None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def jiangjinshenqing_login(request):
if request.method in ["POST", "GET"]:
msg = {
'code': normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
datas = jiangjinshenqing.getbyparams(jiangjinshenqing, jiangjinshenqing, req_dict)
if not datas:
msg['code'] = password_error_code
msg['msg'] = mes.password_error_code
return JsonResponse(msg)
req_dict['id'] = datas[0].get('id')
return Auth.authenticate(Auth, jiangjinshenqing, req_dict)
def jiangjinshenqing_logout(request):
if request.method in ["POST", "GET"]:
msg = {
"msg": "登出成功",
"code": 0
}
return JsonResponse(msg)
def jiangjinshenqing_resetPass(request):
''' '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code}
req_dict = request.session.get("req_dict")
error = jiangjinshenqing.updatebyparams(jiangjinshenqing,jiangjinshenqing, req_dict)
if error != None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def jiangjinshenqing_session(request):
''' '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code,"msg": mes.normal_code, "data": {
}}
req_dict={
"id":request.session.get('params').get("id")}
msg['data'] = jiangjinshenqing.getbyparams(jiangjinshenqing, jiangjinshenqing, req_dict)[0]
return JsonResponse(msg)
def jiangjinshenqing_page(request):
''' '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data":{
"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
req_dict = request.session.get("req_dict")
#獲取全部列名
columns= jiangjinshenqing.getallcolumn( jiangjinshenqing, jiangjinshenqing)
#當前登錄用戶所在表
tablename = request.session.get("tablename")
#當列屬性authTable有值(某個用戶表)[該列的列名必須和該用戶表的登陸字段名一致],則對應的表有個隱藏屬性authTable為”是”,那麼該用戶查看該表信息時,只能查看自己的
try:
__authTables__=jiangjinshenqing.__authTables__
except:
__authTables__=None
if __authTables__!=None and __authTables__!={
}:
for authColumn,authTable in __authTables__.items():
if authTable==tablename:
params = request.session.get("params")
req_dict[authColumn]=params.get(authColumn)
break
#authColumn=list(__authTables__.keys())[0]
#authTable=__authTables__.get(authColumn)
# if authTable==tablename:
#params = request.session.get("params")
#req_dict[authColumn]=params.get(authColumn)
'''__authSeparate__此屬性為真,params添加userid,後台只查詢個人數據'''
try:
__authSeparate__=jiangjinshenqing.__authSeparate__
except:
__authSeparate__=None
if __authSeparate__=="是":
tablename=request.session.get("tablename")
if tablename!="users" and 'userid' in columns:
try:
req_dict['userid']=request.session.get("params").get("id")
except:
pass
#當項目屬性hasMessage為”是”,生成系統自動生成留言板的表messages,同時該表的表屬性hasMessage也被設置為”是”,字段包括userid(用戶id),username(用戶名),content(留言內容),reply(回復)
#接口page需要區分權限,普通用戶查看自己的留言和回復記錄,管理員查看所有的留言和回復記錄
try:
__hasMessage__=jiangjinshenqing.__hasMessage__
except:
__hasMessage__=None
if __hasMessage__=="是":
tablename=request.session.get("tablename")
if tablename!="users":
req_dict["userid"]=request.session.get("params").get("id")
# 判斷當前表的表屬性isAdmin,為真則是管理員表
# 當表屬性isAdmin=”是”,刷出來的用戶表也是管理員,即page和list可以查看所有人的考試記錄(同時應用於其他表)
__isAdmin__ = None
allModels = apps.get_app_config('main').get_models()
for m in allModels:
if m.__tablename__==tablename:
try:
__isAdmin__ = m.__isAdmin__
except:
__isAdmin__ = None
break
# 當前表也是有管理員權限的表
if __isAdmin__ == "是" and req_dict.get("userid"):
del req_dict["userid"]
else:
#非管理員權限的表,判斷當前表字段名是否有userid
if tablename!="users" and "userid" in jiangjinshenqing.getallcolumn(jiangjinshenqing,jiangjinshenqing):
req_dict["userid"] = request.session.get("params").get("id")
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
msg['data']['pageSize'] =jiangjinshenqing.page(jiangjinshenqing, jiangjinshenqing, req_dict)
return JsonResponse(msg)
def jiangjinshenqing_autoSort(request):
''' .智能推薦功能(表屬性:[intelRecom(是/否)],新增clicktime[前端不顯示該字段]字段(調用info/detail接口的時候更新),按clicktime排序查詢) 主要信息列表(如商品列表,新聞列表)中使用,顯示最近點擊的或最新添加的5條記錄就行 '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data":{
"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
req_dict = request.session.get("req_dict")
req_dict['sort']='clicktime'
req_dict['order']='desc'
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
msg['data']['pageSize'] = jiangjinshenqing.page(jiangjinshenqing,jiangjinshenqing, req_dict)
return JsonResponse(msg)
def jiangjinshenqing_list(request):
''' 前台分頁 '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data":{
"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
req_dict = request.session.get("req_dict")
#獲取全部列名
columns= jiangjinshenqing.getallcolumn( jiangjinshenqing, jiangjinshenqing)
#表屬性[foreEndList]前台list:和後台默認的list列表頁相似,只是擺在前台,否:指沒有此頁,是:表示有此頁(不需要登陸即可查看),前要登:表示有此頁且需要登陸後才能查看
try:
__foreEndList__=jiangjinshenqing.__foreEndList__
except:
__foreEndList__=None
if __foreEndList__=="是":
tablename=request.session.get("tablename")
if tablename!="users" and 'userid' in columns:
try:
req_dict['userid']=request.session.get("params").get("id")
except:
pass
tablename = request.session.get("tablename")
if tablename == "users" and req_dict.get("userid") != None:#判斷是否存在userid列名
del req_dict["userid"]
else:
__isAdmin__ = None
allModels = apps.get_app_config('main').get_models()
for m in allModels:
if m.__tablename__==tablename:
try:
__isAdmin__ = m.__isAdmin__
except:
__isAdmin__ = None
break
if __isAdmin__ == "是" and req_dict.get("userid"):
del req_dict["userid"]
else:
#非管理員權限的表,判斷當前表字段名是否有userid
if "userid" in columns:
try:
# 本接口可以匿名訪問,所以try判斷是否為匿名
req_dict['userid']=request.session.get("params").get("id")
except:
pass
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
msg['data']['pageSize'] = jiangjinshenqing.page(jiangjinshenqing, jiangjinshenqing, req_dict)
return JsonResponse(msg)
def jiangjinshenqing_save(request):
''' 後台新增 '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data": {
}}
req_dict = request.session.get("req_dict")
error= jiangjinshenqing.createbyreq(jiangjinshenqing,jiangjinshenqing, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def jiangjinshenqing_add(request):
''' 前台新增 '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data": {
}}
req_dict = request.session.get("req_dict")
#獲取全部列名
columns= jiangjinshenqing.getallcolumn( jiangjinshenqing, jiangjinshenqing)
try:
__authSeparate__=jiangjinshenqing.__authSeparate__
except:
__authSeparate__=None
if __authSeparate__=="是":
tablename=request.session.get("tablename")
if tablename!="users" and 'userid' in columns:
try:
req_dict['userid']=request.session.get("params").get("id")
except:
pass
try:
__foreEndListAuth__=jiangjinshenqing.__foreEndListAuth__
except:
__foreEndListAuth__=None
if __foreEndListAuth__ and __foreEndListAuth__!="否":
tablename=request.session.get("tablename")
if tablename!="users":
req_dict['userid']=request.session.get("params").get("id")
error= jiangjinshenqing.createbyreq(jiangjinshenqing,jiangjinshenqing, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def jiangjinshenqing_thumbsup(request,id_):
''' 點贊:表屬性thumbsUp[是/否],刷表新增thumbsupnum贊和crazilynum踩字段, '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data": {
}}
req_dict = request.session.get("req_dict")
id_=int(id_)
type_=int(req_dict.get("type",0))
rets=jiangjinshenqing.getbyid(jiangjinshenqing,jiangjinshenqing,id_)
update_dict={
"id":id_,
}
if type_==1:#贊
update_dict["thumbsupnum"]=int(rets[0].get('thumbsupnum'))+1
elif type_==2:#踩
update_dict["crazilynum"]=int(rets[0].get('crazilynum'))+1
error = jiangjinshenqing.updatebyparams(jiangjinshenqing,jiangjinshenqing, update_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def jiangjinshenqing_info(request,id_):
''' '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data": {
}}
data = jiangjinshenqing.getbyid(jiangjinshenqing,jiangjinshenqing, int(id_))
if len(data)>0:
msg['data']=data[0]
#浏覽點擊次數
try:
__browseClick__= jiangjinshenqing.__browseClick__
except:
__browseClick__=None
if __browseClick__=="是" and "clicknum" in jiangjinshenqing.getallcolumn(jiangjinshenqing,jiangjinshenqing):
try:
clicknum=int(data[0].get("clicknum",0))+1
except:
clicknum=0+1
click_dict={
"id":int(id_),"clicknum":clicknum}
ret=jiangjinshenqing.updatebyparams(jiangjinshenqing,jiangjinshenqing,click_dict)
if ret!=None:
msg['code'] = crud_error_code
msg['msg'] = ret
return JsonResponse(msg)
def jiangjinshenqing_detail(request,id_):
''' '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data": {
}}
data =jiangjinshenqing.getbyid(jiangjinshenqing,jiangjinshenqing, int(id_))
if len(data)>0:
msg['data']=data[0]
#浏覽點擊次數
try:
__browseClick__= jiangjinshenqing.__browseClick__
except:
__browseClick__=None
if __browseClick__=="是" and "clicknum" in jiangjinshenqing.getallcolumn(jiangjinshenqing,jiangjinshenqing):
try:
clicknum=int(data[0].get("clicknum",0))+1
except:
clicknum=0+1
click_dict={
"id":int(id_),"clicknum":clicknum}
#click_dict={"id":int(id_),"clicknum":str(int(data[0].get("clicknum",0))+1)}
ret=jiangjinshenqing.updatebyparams(jiangjinshenqing,jiangjinshenqing,click_dict)
if ret!=None:
msg['code'] = crud_error_code
msg['msg'] = ret
return JsonResponse(msg)
def jiangjinshenqing_update(request):
''' '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data": {
}}
req_dict = request.session.get("req_dict")
if req_dict.get("mima") and req_dict.get("password"):
if "mima" not in jiangjinshenqing.getallcolumn(jiangjinshenqing,jiangjinshenqing) :
del req_dict["mima"]
if "password" not in jiangjinshenqing.getallcolumn(jiangjinshenqing,jiangjinshenqing) :
del req_dict["password"]
try:
del req_dict["clicknum"]
except:
pass
error = jiangjinshenqing.updatebyparams(jiangjinshenqing, jiangjinshenqing, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def jiangjinshenqing_delete(request):
''' 批量刪除 '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code, "data": {
}}
req_dict = request.session.get("req_dict")
error=jiangjinshenqing.deletes(jiangjinshenqing,
jiangjinshenqing,
req_dict.get("ids")
)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)
def jiangjinshenqing_vote(request,id_):
''' 浏覽點擊次數(表屬性[browseClick:是/否],點擊字段(clicknum),調用info/detail接口的時候後端自動+1)、投票功能(表屬性[vote:是/否],投票字段(votenum),調用vote接口後端votenum+1) 統計商品或新聞的點擊次數;提供新聞的投票功能 '''
if request.method in ["POST", "GET"]:
msg = {
"code": normal_code, "msg": mes.normal_code}
data= jiangjinshenqing.getbyid(jiangjinshenqing, jiangjinshenqing, int(id_))
for i in data:
votenum=i.get('votenum')
if votenum!=None:
params={
"id":int(id_),"votenum":votenum+1}
error=jiangjinshenqing.updatebyparams(jiangjinshenqing,jiangjinshenqing,params)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = error
return JsonResponse(msg)