def classadd(school): schoolname=school.getSchoolname() schoolid=school.getSchoolid() province=school.getProvince() city=school.getCity() starttime=school.getStarttime() request_params=[] values_params=[] if schoolname!='': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) if schoolid!='': request_params.append('schoolId') values_params.append(SQLTool.formatstring(schoolid)) if province!='': request_params.append('province') values_params.append(SQLTool.formatstring(province)) if city!='': request_params.append('city') values_params.append(SQLTool.formatstring(city)) if starttime!='': request_params.append('starttime') values_params.append(SQLTool.formatstring(starttime)) table=localconfig.schooltable DBhelp=SQLTool.DBmanager() DBhelp.connectdb() tempresult=DBhelp.inserttableinfo_byparams(table=table, select_params=request_params,insert_values= [tuple(values_params)]) DBhelp.closedb() return tempresult
def classupdate(schoolname='',schoolid='',province='',city='',starttime=''): request_params=[] values_params=[] wset_params=[] wand_params=[] if schoolname!='': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) if schoolid!='': request_params.append('schoolId') values_params.append(SQLTool.formatstring(schoolid)) if province!='': request_params.append('province') values_params.append(SQLTool.formatstring(province)) if city!='': request_params.append('city') values_params.append(SQLTool.formatstring(city)) if starttime!='': request_params.append('starttime') values_params.append(SQLTool.formatstring(starttime)) table=localconfig.schooltable DBhelp=SQLTool.DBmanager() DBhelp.connectdb() tempresult=DBhelp.updatetableinfo_byparams([table],request_params,values_params,wset_params,wand_params) DBhelp.closedb() return tempresult
def classshow(schoolname='',schoolid='',gradeid='',classid='',classname='',page='0'): validresult=False request_params=[] values_params=[] if schoolname!='': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) if gradeid!='': request_params.append('t_classes.gradeId') values_params.append(SQLTool.formatstring(gradeid)) if classid!='': request_params.append('t_classes.classId') values_params.append(SQLTool.formatstring(classid)) if classname!='': request_params.append('t_class_name.className') values_params.append(SQLTool.formatstring(classname)) if schoolid!='': request_params.append('t_classes.schoolId') values_params.append(SQLTool.formatstring(schoolid)) request_params.append('t_school.schoolId') values_params.append('t_classes.schoolId') request_params.append('t_classes.classId') values_params.append('t_class_name.classId') DBhelp=SQLTool.DBmanager() DBhelp.connectdb() table=localconfig.schooltable result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.classtable,localconfig.classnametable], ['schoolName','t_classes.schoolId','t_classes.gradeId','cId','t_class_name.className','t_classes.classId'], request_params, values_params) if count == 0: pagecount = 0; elif count %limitpage> 0: # pagecount = math.ceil(count / limitpage) pagecount=int((count+limitpage-1)/limitpage) else: pagecount = count / limitpage # print pagecount if pagecount>0: limit=' limit '+str(int(page)*limitpage)+','+str(limitpage) result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.classtable,localconfig.classnametable], ['schoolName','t_classes.schoolId','t_classes.gradeId','cId','t_class_name.className','t_classes.classId'], request_params, values_params,limit,order='schoolId desc') DBhelp.closedb() classes=[] if count>0: validresult=True for temp in result : aclass=Class.Class(schoolname=temp['schoolName'],schoolid=temp['schoolId'],gradeid=temp['gradeId'],cid=temp['cId'],classname=temp['className'],classid=temp['classId']) classes.append(aclass) return classes,count,pagecount return [],0,pagecount
def haveclassshow(schoolid='',classid='',teacherid='',page='0'): validresult=False request_params=[] values_params=[] if schoolid!='': request_params.append('schoolId') values_params.append(SQLTool.formatstring(schoolid)) if classid!='': request_params.append('t_classes.classId') values_params.append(SQLTool.formatstring(classid)) if teacherid!='': request_params.append('teacherId') values_params.append(SQLTool.formatstring(teacherid)) request_params.append('t_teach.teacherId') values_params.append('t_teachers.teacherId') DBhelp=SQLTool.DBmanager() DBhelp.connectdb() table=localconfig.teachertable result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.teachtable], ['t_teachers.teacherId','masterId','time','schoolId','teacherName','classId'], request_params, values_params) if count == 0: pagecount = 0; elif count %limitpage> 0: # pagecount = math.ceil(count / limitpage) pagecount=int((count+limitpage-1)/limitpage) else: pagecount = count / limitpage # print pagecount if pagecount>0: limit=' limit '+str(int(page)*limitpage)+','+str(limitpage) result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.teachtable], ['t_teachers.teacherId','masterId','time','schoolId','teacherName','classId'], request_params, values_params,limit,order='time desc') DBhelp.closedb() classes=[] if count>0: validresult=True for temp in result : aclass=takeclass.Takeclass(teacherid=temp['teacherId'],schoolid=temp['schoolId'],masterid=temp['masterId'],time=temp['time'],teachername=temp['teacherName'],classid=temp['classId']) classes.append(aclass) return classes,count,pagecount return [],0,pagecount
def loadteacher(path): data = xlstool.getdata(path, u'教师') teachdata = [] attenddata = [] logindata = [] for i in data: temp = list(i) teacherid = uuid.uuid1() teachdata.append( (temp[0], teacherid, temp[1], temp[2], temp[3], temp[4], '123456')) logindata.append( (temp[5], 'e10adc3949ba59abbe56e057f20f883e', teacherid)) sqlhelp = SQLTool.getObject() sqlhelp.connectdb() result = sqlhelp.inserttableinfo_byparams(config.Config.teachertable, [ 'schoolId', 'teacherId', 'teacherName', 'teacherPhone', 'offer', 'jobTitle', 'password' ], teachdata) if result: result = sqlhelp.inserttableinfo_byparams( config.Config.usertable, ['username', 'password', 'userId'], logindata) return result
def loadteacher(path): data = xlstool.getdata(path, u"教师") teachdata = [] attenddata = [] logindata = [] for i in data: temp = list(i) teacherid = uuid.uuid1() teachdata.append((temp[0], teacherid, temp[1], temp[2], temp[3], temp[4], "123456")) logindata.append((temp[5], "e10adc3949ba59abbe56e057f20f883e", teacherid)) sqlhelp = SQLTool.getObject() sqlhelp.connectdb() result = sqlhelp.inserttableinfo_byparams( config.Config.teachertable, ["schoolId", "teacherId", "teacherName", "teacherPhone", "offer", "jobTitle", "password"], teachdata, ) if result: result = sqlhelp.inserttableinfo_byparams( config.Config.usertable, ["username", "password", "userId"], logindata ) return result
def loadstudent(path): data=xlstool.getdata(path, u'学生') studentdata=[] studentattenddata=[] logindata=[] for i in data: temp=list(i) studentid=uuid.uuid1() studentdata.append((studentid,temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6],temp[7],temp[8],temp[9],temp[10],temp[14])) studentattenddata.append((studentid,temp[11],temp[13])) logindata.append((temp[12],'e10adc3949ba59abbe56e057f20f883e',studentid)) sqlhelp=SQLTool.getObject() sqlhelp.connectdb() result=sqlhelp.inserttableinfo_byparams(config.Config.studenttable, ['studentId','name','sex','birthday','address','familyPhone','mail','family','admissionTime','nation','placeOfOrigin','team','id'], studentdata) if result: result=sqlhelp.inserttableinfo_byparams(config.Config.student_attend_table, ['studentId','classId','time'], studentattenddata) if result: result=sqlhelp.inserttableinfo_byparams(config.Config.usertable, ['username','password','userId'], logindata) return result
def loadstudent(path): data = xlstool.getdata(path, u'学生') studentdata = [] studentattenddata = [] logindata = [] for i in data: temp = list(i) studentid = uuid.uuid1() studentdata.append( (studentid, temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6], temp[7], temp[8], temp[9], temp[10], temp[14])) studentattenddata.append((studentid, temp[11], temp[13])) logindata.append( (temp[12], 'e10adc3949ba59abbe56e057f20f883e', studentid)) sqlhelp = SQLTool.getObject() sqlhelp.connectdb() result = sqlhelp.inserttableinfo_byparams(config.Config.studenttable, [ 'studentId', 'name', 'sex', 'birthday', 'address', 'familyPhone', 'mail', 'family', 'admissionTime', 'nation', 'placeOfOrigin', 'team', 'id' ], studentdata) if result: result = sqlhelp.inserttableinfo_byparams( config.Config.student_attend_table, ['studentId', 'classId', 'time'], studentattenddata) if result: result = sqlhelp.inserttableinfo_byparams( config.Config.usertable, ['username', 'password', 'userId'], logindata) return result
def loadschool(path): data=xlstool.getdata(path, u'学校') sqlhelp=SQLTool.getObject() sqlhelp.connectdb() result=sqlhelp.inserttableinfo_byparams(config.Config.schooltable, ['province','city','schoolName','schoolTime'], data) return result
def loadschool(path): data = xlstool.getdata(path, u'学校') sqlhelp = SQLTool.getObject() sqlhelp.connectdb() result = sqlhelp.inserttableinfo_byparams( config.Config.schooltable, ['province', 'city', 'schoolName', 'schoolTime'], data) return result
def validuser(username, password): validresult = False password = webtool.md5(password) DBhelp = SQLTool.DBmanager() DBhelp.connectdb() result, content, count, col = DBhelp.searchtableinfo_byparams( [localconfig.usertable], ['userName', 'password', 'userid'], ['userName', 'password'], [SQLTool.formatstring(username), SQLTool.formatstring(password)]) DBhelp.closedb() role = '' userpower = '' if col > 0: validresult = True # role=result[0]['role'] # userpower=result[0]['userpower'] role = 'admin' userpower = 'admin' return validresult, username, role, userpower
def classupdate(schoolname='', schoolid='', province='', city='', starttime=''): request_params = [] values_params = [] wset_params = [] wand_params = [] if schoolname != '': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) if schoolid != '': request_params.append('schoolId') values_params.append(SQLTool.formatstring(schoolid)) if province != '': request_params.append('province') values_params.append(SQLTool.formatstring(province)) if city != '': request_params.append('city') values_params.append(SQLTool.formatstring(city)) if starttime != '': request_params.append('starttime') values_params.append(SQLTool.formatstring(starttime)) table = localconfig.schooltable DBhelp = SQLTool.DBmanager() DBhelp.connectdb() tempresult = DBhelp.updatetableinfo_byparams([table], request_params, values_params, wset_params, wand_params) DBhelp.closedb() return tempresult
def schooladd(school): schoolname=school.getSchoolname() schoolid=school.getSchoolid() province=school.getProvince() city=school.getCity() starttime=school.getStarttime() request_params=[] values_params=[] if schoolname!='': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) if schoolid!='': request_params.append('schoolId') values_params.append(SQLTool.formatstring(schoolid)) if province!='': request_params.append('province') values_params.append(SQLTool.formatstring(province)) if city!='': request_params.append('city') values_params.append(SQLTool.formatstring(city)) if starttime!='': request_params.append('starttime') values_params.append(SQLTool.formatstring(starttime)) table=localconfig.schooltable DBhelp=SQLTool.DBmanager() DBhelp.connectdb() tempresult=DBhelp.inserttableinfo_byparams(table=table, select_params=request_params,insert_values= [tuple(values_params)]) DBhelp.closedb() return tempresult
def loadclasstake(path): data=xlstool.getdata(path, u'上课表') classdata=[] for i in data: temp=list(i) classid=uuid.uuid1() print classid # temp.append('classid') classdata.append((temp[0],temp[1],temp[2],temp[3])) sqlhelp=SQLTool.getObject() sqlhelp.connectdb() result=sqlhelp.inserttableinfo_byparams(config.Config.teachtable, ['teacherId','classId','masterId','time'], classdata) return result
def loadclasstake(path): data = xlstool.getdata(path, u'上课表') classdata = [] for i in data: temp = list(i) classid = uuid.uuid1() print classid # temp.append('classid') classdata.append((temp[0], temp[1], temp[2], temp[3])) sqlhelp = SQLTool.getObject() sqlhelp.connectdb() result = sqlhelp.inserttableinfo_byparams( config.Config.teachtable, ['teacherId', 'classId', 'masterId', 'time'], classdata) return result
def schoolshow(schoolname='',schoolid='',province='',city='',starttime='',page='0'): validresult=False request_params=[] values_params=[] if schoolname!='': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) if schoolid!='': request_params.append('schoolId') values_params.append(SQLTool.formatstring(schoolid)) if province!='': request_params.append('province') values_params.append(SQLTool.formatstring(province)) if city!='': request_params.append('city') values_params.append(SQLTool.formatstring(city)) if starttime!='': request_params.append('starttime') values_params.append(SQLTool.formatstring(starttime)) DBhelp=SQLTool.DBmanager() DBhelp.connectdb() table=localconfig.schooltable result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['schoolName','schoolId','province','city'], request_params, values_params) if count == 0: pagecount = 0; elif count %limitpage> 0: # pagecount = math.ceil(count / limitpage) pagecount=int((count+limitpage-1)/limitpage) else: pagecount = count / limitpage # print pagecount if pagecount>0: limit=' limit '+str(int(page)*limitpage)+','+str(limitpage) result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['schoolName','schoolId','province','city'], request_params, values_params,limit,order='schoolId desc') DBhelp.closedb() schools=[] if count>0: validresult=True for temp in result : aschool=school.School(schoolname=temp['schoolName'],schoolid=temp['schoolId'],province=temp['province'],city=temp['city']) # ajob=school.Job(username=temp[0],jobid=temp[1],jobname=temp[2],priority=temp[3],jobstatus=temp[4],starttime=temp[5],jobaddress=temp[6],jobport=temp[7],result=temp[8],endtime=temp[9],createtime=temp[10],forcesearch=temp[11]) schools.append(aschool) return schools,count,pagecount return [],0,pagecount
def loadclass(path): data=xlstool.getdata(path, u'班级') classdata=[] classnamedata=[] for i in data: temp=list(i) classid=uuid.uuid1() print classid # temp.append('classid') classdata.append((temp[0],temp[1],temp[2],classid)) classnamedata.append((temp[3],classid)) sqlhelp=SQLTool.getObject() sqlhelp.connectdb() result=sqlhelp.inserttableinfo_byparams(config.Config.classtable, ['schoolId','gradeId','cid','classId'], classdata) if result: result=sqlhelp.inserttableinfo_byparams(config.Config.classnametable, ['className','classId'], classnamedata) return result
def loadclass(path): data = xlstool.getdata(path, u'班级') classdata = [] classnamedata = [] for i in data: temp = list(i) classid = uuid.uuid1() print classid # temp.append('classid') classdata.append((temp[0], temp[1], temp[2], classid)) classnamedata.append((temp[3], classid)) sqlhelp = SQLTool.getObject() sqlhelp.connectdb() result = sqlhelp.inserttableinfo_byparams( config.Config.classtable, ['schoolId', 'gradeId', 'cid', 'classId'], classdata) if result: result = sqlhelp.inserttableinfo_byparams(config.Config.classnametable, ['className', 'classId'], classnamedata) return result
def validuser(username,password): validresult=False password=webtool.md5(password) DBhelp=SQLTool.DBmanager() DBhelp.connectdb() result,content,count,col=DBhelp.searchtableinfo_byparams([localconfig.usertable], ['userName','password','userid'], ['userName','password'], [SQLTool.formatstring(username),SQLTool.formatstring(password)]) DBhelp.closedb() role='' userpower='' if col>0: validresult=True # role=result[0]['role'] # userpower=result[0]['userpower'] role='admin' userpower='admin' return validresult,username,role,userpower
def studentshow(studentid='', name='', sex='', birthday='', address='', familyPhone='', mail='', family='', admissionTime='', nation='', placeOfOrigin='', team='', classid='', page='0'): validresult = False request_params = [] values_params = [] if studentid != '': request_params.append('t_student.studentId') values_params.append(SQLTool.formatstring(studentid)) if name != '': request_params.append('name') values_params.append(SQLTool.formatstring(name)) if sex != '': request_params.append('sex') values_params.append(SQLTool.formatstring(sex)) if birthday != '': request_params.append('birthday') values_params.append(SQLTool.formatstring(birthday)) if address != '': request_params.append('address') values_params.append(SQLTool.formatstring(address)) if familyPhone != '': request_params.append('familyPhone') values_params.append(SQLTool.formatstring(familyPhone)) if mail != '': request_params.append('mail') values_params.append(SQLTool.formatstring(mail)) if family != '': request_params.append('family') values_params.append(SQLTool.formatstring(family)) if admissionTime != '': request_params.append('admissionTime') values_params.append(SQLTool.formatstring(admissionTime)) if nation != '': request_params.append('nation') values_params.append(SQLTool.formatstring(nation)) if placeOfOrigin != '': request_params.append('placeOfOrigin') values_params.append(SQLTool.formatstring(placeOfOrigin)) if team != '': request_params.append('team') values_params.append(SQLTool.formatstring(team)) if classid != '': request_params.append('t_students_attend_class.classId') values_params.append(SQLTool.formatstring(classid)) request_params.append('t_students_attend_class.studentId') values_params.append('t_student.studentId') DBhelp = SQLTool.DBmanager() DBhelp.connectdb() table = localconfig.studenttable result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.student_attend_table], [ 't_student.studentId', 'name', 'sex', 'birthday', 'address', 'familyPhone', 'mail', 'family', 'admissionTime', 'nation', 'placeOfOrigin', 'team', 't_students_attend_class.classId' ], request_params, values_params) if count == 0: pagecount = 0 elif count % limitpage > 0: # pagecount = math.ceil(count / limitpage) pagecount = int((count + limitpage - 1) / limitpage) else: pagecount = count / limitpage # print pagecount if pagecount > 0: limit = ' limit ' + str( int(page) * limitpage) + ',' + str(limitpage) result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.student_attend_table], [ 't_student.studentId', 'name', 'sex', 'birthday', 'address', 'familyPhone', 'mail', 'family', 'admissionTime', 'nation', 'placeOfOrigin', 'team', 't_students_attend_class.classId' ], request_params, values_params, limit, order=' time desc ,t_student.studentId desc') DBhelp.closedb() students = [] if count > 0: validresult = True for temp in result: astudent = student.Student(studentid=temp['studentId'], name=temp['name'], address=temp['address'], familyPhone=temp['familyPhone'], classid=temp['classId'], family=temp['family']) students.append(astudent) return students, count, pagecount return [], 0, pagecount
def teachershow(id='',evaluationobject='',evaluationscore='',type='',time='',week='',page='0'): validresult=False request_params=[] values_params=[] if id!='': request_params.append('studentId') values_params.append(SQLTool.formatstring(id)) if evaluationobject!='': request_params.append('teacherId') values_params.append(SQLTool.formatstring(evaluationobject)) if evaluationscore!='': request_params.append('evaluationScore') values_params.append(SQLTool.formatstring(evaluationscore)) if type!='': request_params.append('t_student_evaluation.type') values_params.append(SQLTool.formatstring(type)) if time!='': request_params.append('time') values_params.append(SQLTool.formatstring(time)) if week!='': request_params.append('week') values_params.append(SQLTool.formatstring(week)) request_params.append('contentEvaluationId') values_params.append('contentId') DBhelp=SQLTool.DBmanager() DBhelp.connectdb() table=localconfig.tevaluation_table extra=' and yn=0 union select studentId,teacherId,evaluationScore,t_teacher_evaluation.type,time,week,content from t_content_evaluation,t_teacher_evaluation,t_evaluation_template where contentEvaluationId=contentId and contentId=t_evaluation_template.templateId and yn=1' result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.cevaluation_table], ['studentId','teacherId','evaluationScore','t_teacher_evaluation.type','time','week','contentEvaluation'], request_params, values_params,extra=extra) if count == 0: pagecount = 0; elif count %limitpage> 0: # pagecount = math.ceil(count / limitpage) pagecount=int((count+limitpage-1)/limitpage) else: pagecount = count / limitpage # print pagecount if pagecount>0: limit=' limit '+str(int(page)*limitpage)+','+str(limitpage) result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.cevaluation_table], ['studentId','teacherId','evaluationScore','t_teacher_evaluation.type','time','week','contentEvaluation'], request_params, values_params,limit,extra=extra,order=' time desc') DBhelp.closedb() evaluations=[] if count>0: validresult=True for temp in result : aevaluation=evaluation.Evaluation(id=temp['studentId'],evaluationobject=temp['teacherId'],evaluationscore=temp['evaluationScore'],type=temp['type'],time=temp['time'],week=temp['week'],content=temp['contentEvaluation']) evaluations.append(aevaluation) return evaluations,count,pagecount return [],0,pagecount
def studentshow(studentid='',name='',sex='',birthday='',address='',familyPhone='',mail='',family='',admissionTime='',nation='',placeOfOrigin='',team='',classid='',page='0'): validresult=False request_params=[] values_params=[] if studentid!='': request_params.append('t_student.studentId') values_params.append(SQLTool.formatstring(studentid)) if name!='': request_params.append('name') values_params.append(SQLTool.formatstring(name)) if sex!='': request_params.append('sex') values_params.append(SQLTool.formatstring(sex)) if birthday!='': request_params.append('birthday') values_params.append(SQLTool.formatstring(birthday)) if address!='': request_params.append('address') values_params.append(SQLTool.formatstring(address)) if familyPhone!='': request_params.append('familyPhone') values_params.append(SQLTool.formatstring(familyPhone)) if mail!='': request_params.append('mail') values_params.append(SQLTool.formatstring(mail)) if family!='': request_params.append('family') values_params.append(SQLTool.formatstring(family)) if admissionTime!='': request_params.append('admissionTime') values_params.append(SQLTool.formatstring(admissionTime)) if nation!='': request_params.append('nation') values_params.append(SQLTool.formatstring(nation)) if placeOfOrigin!='': request_params.append('placeOfOrigin') values_params.append(SQLTool.formatstring(placeOfOrigin)) if team!='': request_params.append('team') values_params.append(SQLTool.formatstring(team)) if classid!='': request_params.append('t_students_attend_class.classId') values_params.append(SQLTool.formatstring(classid)) request_params.append('t_students_attend_class.studentId') values_params.append('t_student.studentId') DBhelp=SQLTool.DBmanager() DBhelp.connectdb() table=localconfig.studenttable result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.student_attend_table], ['t_student.studentId','name','sex','birthday','address','familyPhone','mail','family','admissionTime','nation','placeOfOrigin','team','t_students_attend_class.classId'], request_params, values_params) if count == 0: pagecount = 0; elif count %limitpage> 0: # pagecount = math.ceil(count / limitpage) pagecount=int((count+limitpage-1)/limitpage) else: pagecount = count / limitpage # print pagecount if pagecount>0: limit=' limit '+str(int(page)*limitpage)+','+str(limitpage) result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.student_attend_table], ['t_student.studentId','name','sex','birthday','address','familyPhone','mail','family','admissionTime','nation','placeOfOrigin','team','t_students_attend_class.classId'], request_params, values_params,limit,order=' time desc ,t_student.studentId desc') DBhelp.closedb() students=[] if count>0: validresult=True for temp in result : astudent=student.Student(studentid=temp['studentId'],name=temp['name'],address=temp['address'],familyPhone=temp['familyPhone'],classid=temp['classId'],family=temp['family']) students.append(astudent) return students,count,pagecount return [],0,pagecount
def familyshow(id='', evaluationobject='', evaluationscore='', type='', time='', week='', page='0'): validresult = False request_params = [] values_params = [] if id != '': request_params.append('studentId') values_params.append(SQLTool.formatstring(id)) if evaluationobject != '': request_params.append('teacherId') values_params.append(SQLTool.formatstring(evaluationobject)) if evaluationscore != '': request_params.append('evaluationScore') values_params.append(SQLTool.formatstring(evaluationscore)) if type != '': request_params.append('t_student_evaluation.type') values_params.append(SQLTool.formatstring(type)) if time != '': request_params.append('time') values_params.append(SQLTool.formatstring(time)) if week != '': request_params.append('week') values_params.append(SQLTool.formatstring(week)) request_params.append('contentEvaluationId') values_params.append('contentId') DBhelp = SQLTool.DBmanager() DBhelp.connectdb() table = localconfig.fevaluation_table extra = ' and yn=0 union select studentId,parentid,evaluationScore,t_family_evaluation.type,time,week,content from t_content_evaluation,t_family_evaluation,t_evaluation_template where contentEvaluationId=contentId and contentId=t_evaluation_template.templateId and yn=1' result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.cevaluation_table], [ 'studentId', 'parentid', 'evaluationScore', 't_family_evaluation.type', 'time', 'week', 'contentEvaluation' ], request_params, values_params, extra=extra) if count == 0: pagecount = 0 elif count % limitpage > 0: # pagecount = math.ceil(count / limitpage) pagecount = int((count + limitpage - 1) / limitpage) else: pagecount = count / limitpage # print pagecount if pagecount > 0: limit = ' limit ' + str( int(page) * limitpage) + ',' + str(limitpage) result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.cevaluation_table], [ 'studentId', 'parentid', 'evaluationScore', 't_family_evaluation.type', 'time', 'week', 'contentEvaluation' ], request_params, values_params, limit, extra=extra, order=' time desc') DBhelp.closedb() evaluations = [] if count > 0: validresult = True for temp in result: aevaluation = evaluation.Evaluation( id=temp['studentId'], evaluationobject=temp['parentid'], evaluationscore=temp['evaluationScore'], type=temp['type'], time=temp['time'], week=temp['week'], content=temp['contentEvaluation']) evaluations.append(aevaluation) return evaluations, count, pagecount return [], 0, pagecount
def haveclassshow(schoolid='', classid='', teacherid='', page='0'): validresult = False request_params = [] values_params = [] if schoolid != '': request_params.append('schoolId') values_params.append(SQLTool.formatstring(schoolid)) if classid != '': request_params.append('t_classes.classId') values_params.append(SQLTool.formatstring(classid)) if teacherid != '': request_params.append('teacherId') values_params.append(SQLTool.formatstring(teacherid)) request_params.append('t_teach.teacherId') values_params.append('t_teachers.teacherId') DBhelp = SQLTool.DBmanager() DBhelp.connectdb() table = localconfig.teachertable result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.teachtable], [ 't_teachers.teacherId', 'masterId', 'time', 'schoolId', 'teacherName', 'classId' ], request_params, values_params) if count == 0: pagecount = 0 elif count % limitpage > 0: # pagecount = math.ceil(count / limitpage) pagecount = int((count + limitpage - 1) / limitpage) else: pagecount = count / limitpage # print pagecount if pagecount > 0: limit = ' limit ' + str( int(page) * limitpage) + ',' + str(limitpage) result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.teachtable], [ 't_teachers.teacherId', 'masterId', 'time', 'schoolId', 'teacherName', 'classId' ], request_params, values_params, limit, order='time desc') DBhelp.closedb() classes = [] if count > 0: validresult = True for temp in result: aclass = takeclass.Takeclass(teacherid=temp['teacherId'], schoolid=temp['schoolId'], masterid=temp['masterId'], time=temp['time'], teachername=temp['teacherName'], classid=temp['classId']) classes.append(aclass) return classes, count, pagecount return [], 0, pagecount
def teachershow(schoolid='', teacherid='', name='', phone='', offer='', job='', schoolname='', page='0'): validresult = False request_params = [] values_params = [] if schoolid != '': request_params.append('t_teachers.schoolId') values_params.append(SQLTool.formatstring(schoolid)) if teacherid != '': request_params.append('teacherId') values_params.append(SQLTool.formatstring(teacherid)) if name != '': request_params.append('teacherName') values_params.append(SQLTool.formatstring(name)) if phone != '': request_params.append('teacherPhone') values_params.append(SQLTool.formatstring(phone)) if offer != '': request_params.append('offer') values_params.append(SQLTool.formatstring(offer)) if job != '': request_params.append('jobTitle') values_params.append(SQLTool.formatstring(job)) if schoolname != '': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) request_params.append('t_school.schoolId') values_params.append('t_teachers.schoolId') DBhelp = SQLTool.DBmanager() DBhelp.connectdb() table = localconfig.teachertable result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.schooltable], [ 't_teachers.schoolId', 'teacherId', 'teacherName', 'teacherPhone', 'offer', 'jobTitle', 'schoolName' ], request_params, values_params) if count == 0: pagecount = 0 elif count % limitpage > 0: # pagecount = math.ceil(count / limitpage) pagecount = int((count + limitpage - 1) / limitpage) else: pagecount = count / limitpage # print pagecount if pagecount > 0: limit = ' limit ' + str( int(page) * limitpage) + ',' + str(limitpage) result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.schooltable], [ 't_teachers.schoolId', 'teacherId', 'teacherName', 'teacherPhone', 'offer', 'jobTitle', 'schoolName' ], request_params, values_params, limit, order=' teacherId desc') DBhelp.closedb() teachers = [] if count > 0: validresult = True for temp in result: ateacher = teacher.Teacher(schoolid=temp['schoolId'], teacherid=temp['teacherId'], name=temp['teacherName'], phone=temp['teacherPhone'], offer=temp['offer'], job=temp['jobTitle'], schoolname=temp['schoolName']) teachers.append(ateacher) return teachers, count, pagecount return [], 0, pagecount
def classshow(schoolname='', schoolid='', gradeid='', classid='', classname='', page='0'): validresult = False request_params = [] values_params = [] if schoolname != '': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) if gradeid != '': request_params.append('t_classes.gradeId') values_params.append(SQLTool.formatstring(gradeid)) if classid != '': request_params.append('t_classes.classId') values_params.append(SQLTool.formatstring(classid)) if classname != '': request_params.append('t_class_name.className') values_params.append(SQLTool.formatstring(classname)) if schoolid != '': request_params.append('t_classes.schoolId') values_params.append(SQLTool.formatstring(schoolid)) request_params.append('t_school.schoolId') values_params.append('t_classes.schoolId') request_params.append('t_classes.classId') values_params.append('t_class_name.classId') DBhelp = SQLTool.DBmanager() DBhelp.connectdb() table = localconfig.schooltable result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.classtable, localconfig.classnametable], [ 'schoolName', 't_classes.schoolId', 't_classes.gradeId', 'cId', 't_class_name.className', 't_classes.classId' ], request_params, values_params) if count == 0: pagecount = 0 elif count % limitpage > 0: # pagecount = math.ceil(count / limitpage) pagecount = int((count + limitpage - 1) / limitpage) else: pagecount = count / limitpage # print pagecount if pagecount > 0: limit = ' limit ' + str( int(page) * limitpage) + ',' + str(limitpage) result, content, count, col = DBhelp.searchtableinfo_byparams( [table, localconfig.classtable, localconfig.classnametable], [ 'schoolName', 't_classes.schoolId', 't_classes.gradeId', 'cId', 't_class_name.className', 't_classes.classId' ], request_params, values_params, limit, order='schoolId desc') DBhelp.closedb() classes = [] if count > 0: validresult = True for temp in result: aclass = Class.Class(schoolname=temp['schoolName'], schoolid=temp['schoolId'], gradeid=temp['gradeId'], cid=temp['cId'], classname=temp['className'], classid=temp['classId']) classes.append(aclass) return classes, count, pagecount return [], 0, pagecount
def teachershow(schoolid='',teacherid='',name='',phone='',offer='',job='',schoolname='',page='0'): validresult=False request_params=[] values_params=[] if schoolid!='': request_params.append('t_teachers.schoolId') values_params.append(SQLTool.formatstring(schoolid)) if teacherid!='': request_params.append('teacherId') values_params.append(SQLTool.formatstring(teacherid)) if name!='': request_params.append('teacherName') values_params.append(SQLTool.formatstring(name)) if phone!='': request_params.append('teacherPhone') values_params.append(SQLTool.formatstring(phone)) if offer!='': request_params.append('offer') values_params.append(SQLTool.formatstring(offer)) if job!='': request_params.append('jobTitle') values_params.append(SQLTool.formatstring(job)) if schoolname!='': request_params.append('schoolName') values_params.append(SQLTool.formatstring(schoolname)) request_params.append('t_school.schoolId') values_params.append('t_teachers.schoolId') DBhelp=SQLTool.DBmanager() DBhelp.connectdb() table=localconfig.teachertable result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.schooltable], ['t_teachers.schoolId','teacherId','teacherName','teacherPhone','offer','jobTitle','schoolName'], request_params, values_params) if count == 0: pagecount = 0; elif count %limitpage> 0: # pagecount = math.ceil(count / limitpage) pagecount=int((count+limitpage-1)/limitpage) else: pagecount = count / limitpage # print pagecount if pagecount>0: limit=' limit '+str(int(page)*limitpage)+','+str(limitpage) result,content,count,col=DBhelp.searchtableinfo_byparams([table,localconfig.schooltable], ['t_teachers.schoolId','teacherId','teacherName','teacherPhone','offer','jobTitle','schoolName'], request_params, values_params,limit,order=' teacherId desc') DBhelp.closedb() teachers=[] if count>0: validresult=True for temp in result : ateacher=teacher.Teacher(schoolid=temp['schoolId'],teacherid=temp['teacherId'],name=temp['teacherName'],phone=temp['teacherPhone'],offer=temp['offer'],job=temp['jobTitle'],schoolname=temp['schoolName']) teachers.append(ateacher) return teachers,count,pagecount return [],0,pagecount