fix: 修复RoleRepository查询方法
- 重命名findByRoleCodeAndDeletedFalse为findByRoleCodeAndDeleted - 移除@Query注解,使用Spring Data JPA标准方法命名 - 修复RoleService中的调用 历史遗留问题: - SchemaVerificationTest仍有其他问题(可能与测试配置有关) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.mosquito.project.permission;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -26,6 +24,5 @@ public interface RoleRepository extends JpaRepository<SysRole, Long> {
|
||||
/**
|
||||
* 根据角色代码查询(排除已删除)
|
||||
*/
|
||||
@Query("SELECT r FROM SysRole r WHERE r.roleCode = :roleCode AND r.deleted = 0")
|
||||
Optional<SysRole> findByRoleCodeAndDeletedFalse(@Param("roleCode") String roleCode);
|
||||
Optional<SysRole> findByRoleCodeAndDeleted(String roleCode, Integer deleted);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RoleService {
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Optional<SysRole> findByRoleCode(String roleCode) {
|
||||
return roleRepository.findByRoleCodeAndDeletedFalse(roleCode);
|
||||
return roleRepository.findByRoleCodeAndDeleted(roleCode, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user