修改领域模型。
This commit is contained in:
@@ -4,7 +4,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -15,6 +14,7 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import static xyz.zhouxy.plusone.domain.ValidatableStringRecord.getValueOrNull;
|
||||
import xyz.zhouxy.plusone.jdbc.JdbcRepositorySupport;
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,8 @@ public class AccountRepositoryImpl extends JdbcRepositorySupport<Account, Long>
|
||||
|
||||
@Override
|
||||
public boolean existsUsername(Username username) {
|
||||
return queryExists("SELECT EXISTS (SELECT 1 FROM sys_account WHERE username = :username AND deleted = 0 LIMIT 1)",
|
||||
return queryExists(
|
||||
"SELECT EXISTS (SELECT 1 FROM sys_account WHERE username = :username AND deleted = 0 LIMIT 1)",
|
||||
"username", username.value());
|
||||
}
|
||||
|
||||
@@ -112,7 +113,8 @@ public class AccountRepositoryImpl extends JdbcRepositorySupport<Account, Long>
|
||||
|
||||
@Override
|
||||
public boolean existsMobilePhone(MobilePhone mobilePhone) {
|
||||
return queryExists("SELECT EXISTS (SELECT 1 FROM sys_account WHERE mobile_phone = :mobile_phone AND deleted = 0 LIMIT 1)",
|
||||
return queryExists(
|
||||
"SELECT EXISTS (SELECT 1 FROM sys_account WHERE mobile_phone = :mobile_phone AND deleted = 0 LIMIT 1)",
|
||||
"mobile_phone", mobilePhone.value());
|
||||
}
|
||||
|
||||
@@ -198,16 +200,14 @@ public class AccountRepositoryImpl extends JdbcRepositorySupport<Account, Long>
|
||||
AccountInfo accountInfo = entity.getAccountInfo();
|
||||
return new MapSqlParameterSource()
|
||||
.addValue("id", id)
|
||||
.addValue("email", Objects.nonNull(entity.getEmail()) ? entity.getEmail().value() : null)
|
||||
.addValue("mobilePhone",
|
||||
Objects.nonNull(entity.getMobilePhone()) ? entity.getMobilePhone().value() : null)
|
||||
.addValue("email", getValueOrNull(entity.getEmail()))
|
||||
.addValue("mobilePhone", getValueOrNull(entity.getMobilePhone()))
|
||||
.addValue("username", entity.getUsername().value())
|
||||
.addValue("password", entity.getPassword().value())
|
||||
.addValue("salt", entity.getPassword().getSalt())
|
||||
.addValue("avatar", accountInfo.getAvatar().toString())
|
||||
.addValue("sex", accountInfo.getSex().getValue())
|
||||
.addValue("nickname",
|
||||
Objects.nonNull(accountInfo.getNickname()) ? accountInfo.getNickname().value() : null)
|
||||
.addValue("nickname", getValueOrNull(accountInfo.getNickname()))
|
||||
.addValue("status", entity.getStatus().getValue())
|
||||
.addValue("createdBy", entity.getCreatedBy())
|
||||
.addValue("createTime", now)
|
||||
|
Reference in New Issue
Block a user