AccountInfo 的构建使用 Builder 模式。
This commit is contained in:
@@ -176,10 +176,6 @@ public class AccountRepositoryImpl extends JdbcRepositorySupport<Account, Long>
|
||||
@Override
|
||||
protected final Account mapRow(ResultSet rs) throws SQLException {
|
||||
long accountId = rs.getLong("id");
|
||||
AccountInfo accountInfo = AccountInfo.of(
|
||||
rs.getString("nickname"),
|
||||
rs.getString("avatar"),
|
||||
Sex.of(rs.getInt("sex")));
|
||||
return new Account(
|
||||
accountId,
|
||||
rs.getString("username"),
|
||||
@@ -187,7 +183,11 @@ public class AccountRepositoryImpl extends JdbcRepositorySupport<Account, Long>
|
||||
rs.getString("mobile_phone"),
|
||||
Password.of(rs.getString("password"), rs.getString("salt")),
|
||||
AccountStatus.of(rs.getInt("status")),
|
||||
accountInfo,
|
||||
AccountInfo.builder()
|
||||
.nickname(rs.getString("nickname"))
|
||||
.avatar(rs.getString("avatar"))
|
||||
.sex(Sex.of(rs.getInt("sex")))
|
||||
.build(),
|
||||
this.accountRoleDAO.selectRoleIdsByAccountId(accountId),
|
||||
rs.getLong("created_by"),
|
||||
rs.getLong("updated_by"),
|
||||
|
Reference in New Issue
Block a user