Update pom.xml for MyBatis Plus integration and downgrade Spring Boot version; refactor validation imports from Jakarta to Javax; modify mappers to extend BaseMapper for CRUD operations; clean up unused MyBatis-Flex mappers; adjust application.yml for MyBatis Plus configuration.

This commit is contained in:
zyh
2025-08-26 15:37:52 +08:00
parent bd0a9e6dd7
commit 833159d1f1
31 changed files with 204 additions and 104 deletions

View File

@@ -28,7 +28,7 @@ public class UserService {
* 根据ID获取用户账户
*/
public Mono<AccountResponse> getById(Long id) {
return Mono.fromCallable(() -> userAccountMapper.findById(id))
return Mono.fromCallable(() -> userAccountMapper.selectById(id))
.subscribeOn(Schedulers.boundedElastic())
.filter(Objects::nonNull)
.map(this::toAccountResponse);

View File

@@ -68,7 +68,7 @@ public class AccountService {
}
public Mono<AccountResponse> get(Long id) {
return Mono.fromCallable(() -> mapper.findById(id))
return Mono.fromCallable(() -> mapper.selectById(id))
.subscribeOn(Schedulers.boundedElastic())
.map(this::toResp);
}
@@ -76,7 +76,7 @@ public class AccountService {
@Transactional
public Mono<AccountResponse> update(Long id, AccountUpdateRequest req) {
return Mono.fromCallable(() -> {
UserAccount db = mapper.findById(id);
UserAccount db = mapper.selectById(id);
if (db == null) return null;
// 验证用户名唯一性(如果要更新用户名)
@@ -120,8 +120,8 @@ public class AccountService {
}
}
mapper.update(patch);
return mapper.findById(id);
mapper.updateById(patch);
return mapper.selectById(id);
})
.subscribeOn(Schedulers.boundedElastic())
.map(this::toResp);

View File

@@ -59,7 +59,7 @@ public class LinkGenerationService {
}
// 获取操作者账户信息
UserAccount operator = userAccountMapper.findById(operatorId);
UserAccount operator = userAccountMapper.selectById(operatorId);
if (operator == null) {
throw new IllegalArgumentException("操作者账户不存在");
}
@@ -127,7 +127,7 @@ public class LinkGenerationService {
UserAccount patch = new UserAccount();
patch.setId(operator.getId());
patch.setPointsBalance(after);
userAccountMapper.update(patch);
userAccountMapper.updateById(patch);
}
GenerateResult result = new GenerateResult();