Skip to content

Commit

Permalink
修改bug
Browse files Browse the repository at this point in the history
  • Loading branch information
penley277 committed Nov 20, 2019
1 parent 3c2adf8 commit 6f03df0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions list/BorrowInformList.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ def addInform(self, other):

if book.getBookCnt() == 0: # 如果书籍已经借空
return False
self.db.update_values('book', {'bookCnt': book.getBookCnt() - 1, 'borrowCnt': book.getBorrowCnt() + 1},
'%s%s%s' % ('where bookNum=\'', other.getBookNo(), '\''))

self.history.append(other.getBookNo())
self.db.insert_values('borrowInfo', [other.getNo(), other.getStuNo(), other.getBookNo(), other.getBorrowTime(),
other.getFinishTime()])

self.db.update_values('book', {'bookCnt': book.getBookCnt() - 1, 'borrowCnt': book.getBorrowCnt() + 1},
'%s%s%s' % ('where bookNum=\'', other.getBookNo(), '\''))
return True

def deleteInform(self, no):
Expand All @@ -44,9 +46,9 @@ def deleteInform(self, no):
select = self.db.select_items('borrowInfo', '*', '%s%s%s' % ('where infoId=\'', no, '\''))
book = self.bookList.getBookByNo(select[0][2])

self.db.delete_values('borrowInfo', '%s%s' % ('where infoId=', no))
self.db.update_values('book', {'bookCnt': book.getBookCnt() + 1, 'borrowCnt': book.getBorrowCnt() - 1},
'%s%s%s' % ('where bookNum=\'', book.getBookNo(), '\''))
self.db.delete_values('borrowInfo', '%s%s' % ('where infoId=', no))

def getInformByStudNo(self, no):
select = self.db.select_items('borrowInfo', '*', '%s%s%s' % ('where studNo=\'', no, '\''))
Expand Down
8 changes: 8 additions & 0 deletions list/StudentList.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ def addStu(self, stu):
stu.getMajor(), stu.getClassNum(),
stu.getPhoneNum(), stu.getPassWd()])

def removeBook(self, num):
"""
从数据库中删除学生
:param num: 删除学生的学号
:return:
"""
self.db.delete_values('student', '%s%s%s' % ('where studNum=\'', num, '\''))

def getStuByNo(self, no):
"""
使用学生的学号获取学生的信息
Expand Down

0 comments on commit 6f03df0

Please sign in to comment.