fix: 当用户名没有被修改时, 忽略修改操作

This commit is contained in:
CrescentLeaf
2025-10-26 21:20:11 +08:00
parent b1e618e07c
commit ab96ef889d

View File

@@ -115,6 +115,7 @@ export default class User {
return this.bean.username return this.bean.username
} }
setUserName(userName: string) { setUserName(userName: string) {
if (this.getUserName() == userName) return
if (User.findAllBeansByCondition('username = ?', userName).length > 0) if (User.findAllBeansByCondition('username = ?', userName).length > 0)
throw new DataWrongError(`用户名 ${userName} 已存在`) throw new DataWrongError(`用户名 ${userName} 已存在`)
this.setAttr("username", userName) this.setAttr("username", userName)