-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from mgz0227/dev_2008
书架分组db操作显示,管理页面跳转分组操作功能实现
- Loading branch information
Showing
23 changed files
with
553 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* @author 2008 | ||
* @datetime 2024/7/26 10:58 | ||
* @className: booksUtils | ||
*/ | ||
import BookGroupsDao from '../../database/dao/BookGroupsDao' | ||
import BooksDao from '../../database/dao/BooksDao' | ||
import { BookGroups } from '../../database/entities/BookGroups' | ||
|
||
class bookGroupUtils{ | ||
|
||
async isTopGroup(id: number, isTop?: boolean): Promise<boolean> { | ||
return BookGroupsDao.isUpdateGroupTop(id, isTop) | ||
} | ||
|
||
async addGroup(books: BookGroups){ | ||
BookGroupsDao.insert(books) | ||
} | ||
// | ||
// async updateBookGroup(id:number|number[], group:number){ | ||
// //循环更新 | ||
// let booId:number[] = [] | ||
// if (typeof id === 'number'){ | ||
// booId.push(id) | ||
// } else { | ||
// booId = id | ||
// } | ||
// booId.forEach((item:number)=>{ | ||
// BooksDao.updateBookGroup(item,group) | ||
// }) | ||
// } | ||
|
||
async delGroupById(id:number){ | ||
//删除分组 | ||
BookGroupsDao.deleteBook(id) | ||
//同时更新书籍分组为未分组 | ||
BooksDao.queryBookByGroup(id, 3) | ||
} | ||
|
||
async moveBookByGroupId(oldGroup:number|number[], newGroup:number){ | ||
//同时更新书籍分组为未分组 | ||
let Ids:number[] = [] | ||
if (typeof oldGroup === 'number'){ | ||
Ids.push(oldGroup) | ||
} else { | ||
Ids = oldGroup | ||
} | ||
Ids.forEach((item:number)=>{ | ||
BooksDao.queryBookByGroup(item, newGroup) | ||
}) | ||
} | ||
|
||
async updateGroupShow(groupId:number|number[]){ | ||
let Ids:number[] = [] | ||
if (typeof groupId === 'number'){ | ||
Ids.push(groupId) | ||
} else { | ||
Ids = groupId | ||
} | ||
Ids.forEach((item:number)=>{ | ||
BookGroupsDao.updateGroupShow(item) | ||
}) | ||
} | ||
} | ||
let bookGroupUtil = new bookGroupUtils(); | ||
export default bookGroupUtil as bookGroupUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.