forked from xiaozhangup/PictureLogin-Velocity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c4ce1c
commit 2d35302
Showing
7 changed files
with
92 additions
and
136 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package me.xiaozhangup.picturelogin | ||
|
||
enum class MailType( | ||
val display: String | ||
) { | ||
MAIL("包裹"), | ||
NOTE("信封"), | ||
RICH("邮件") | ||
} |
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
54 changes: 0 additions & 54 deletions
54
src/main/kotlin/me/xiaozhangup/picturelogin/data/table/TableMail.kt
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
src/main/kotlin/me/xiaozhangup/picturelogin/data/table/TableMailbox.kt
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,56 @@ | ||
package me.xiaozhangup.picturelogin.data.table | ||
|
||
import me.xiaozhangup.picturelogin.MailType | ||
import me.xiaozhangup.picturelogin.data.DatabaseManager | ||
import me.xiaozhangup.picturelogin.data.DatabaseManager.dataSource | ||
import taboolib.module.database.* | ||
import java.util.* | ||
|
||
class TableMailbox : SQLTable { | ||
|
||
override val table: Table<Host<SQL>, SQL> = Table("mailbox", DatabaseManager.host) { | ||
add("uuid") { | ||
type(ColumnTypeSQL.VARCHAR, 36) { | ||
options(ColumnOptionSQL.KEY) | ||
} | ||
} | ||
|
||
add("type") { | ||
type(ColumnTypeSQL.TINYTEXT) | ||
} | ||
|
||
add("title") { | ||
type(ColumnTypeSQL.TINYTEXT) | ||
} | ||
|
||
add("sender") { | ||
type(ColumnTypeSQL.VARCHAR, 36) | ||
} | ||
|
||
add("receiver") { | ||
type(ColumnTypeSQL.VARCHAR, 36) | ||
} | ||
|
||
add("context") { | ||
type(ColumnTypeSQL.TEXT) | ||
} | ||
} | ||
|
||
fun bySender(sender: UUID, type: MailType? = null): Int { | ||
return table.select(dataSource) { | ||
where { | ||
"sender" eq sender.toString() | ||
if (type != null) "type" eq type.name | ||
} | ||
}.map { }.size | ||
} | ||
|
||
fun byReceiver(receiver: UUID, type: MailType? = null): Int { | ||
return table.select(dataSource) { | ||
where { | ||
"receiver" eq receiver.toString() | ||
if (type != null) "type" eq type.name | ||
} | ||
}.map { }.size | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
src/main/kotlin/me/xiaozhangup/picturelogin/data/table/TableNote.kt
This file was deleted.
Oops, something went wrong.