修复问题

This commit is contained in:
BBIT-Kai
2026-05-25 14:53:53 +08:00
parent 33bffccc46
commit b63b98b35d
@@ -20,7 +20,6 @@ import org.jetbrains.exposed.v1.core.eq
import org.jetbrains.exposed.v1.core.inList
import org.jetbrains.exposed.v1.core.isNull
import org.jetbrains.exposed.v1.core.like
import org.jetbrains.exposed.v1.jdbc.Query
import org.jetbrains.exposed.v1.jdbc.deleteWhere
import org.jetbrains.exposed.v1.jdbc.insert
import org.jetbrains.exposed.v1.jdbc.insertIgnore
@@ -59,10 +58,10 @@ object UserDao {
}
fun findByUsername(username: String): ResultRow? =
activeUsers().where { SysUserTable.username eq username }.singleOrNull()
SysUserTable.selectAll().where { activeWhere() and (SysUserTable.username eq username) }.singleOrNull()
fun requireActive(id: Uuid): ResultRow =
activeUsers().where { SysUserTable.id eq id }.singleOrNull()
SysUserTable.selectAll().where { activeWhere() and (SysUserTable.id eq id) }.singleOrNull()
?: throw BizException(
ErrorCode.USER_NOT_FOUND.code,
ErrorCode.USER_NOT_FOUND.message,
@@ -179,11 +178,10 @@ object UserDao {
}
}
private fun activeUsers(): Query =
SysUserTable.selectAll().where { SysUserTable.deletedAt.isNull() }
private fun activeWhere(): Op<Boolean> = SysUserTable.deletedAt.isNull()
private fun buildWhere(username: String?, nickname: String?, status: String?, orgId: Uuid?): Op<Boolean> {
var where: Op<Boolean> = SysUserTable.deletedAt.isNull()
var where: Op<Boolean> = activeWhere()
if (!username.isNullOrBlank()) {
where = where and (SysUserTable.username like "%$username%")
}