[EDIT] 収支IDでカテゴリエンティティを取得するメソッドを作成しました。
This commit is contained in:
@@ -11,4 +11,6 @@ public interface CategoryService {
|
|||||||
public CategoryModel findOne(Long categoryId);
|
public CategoryModel findOne(Long categoryId);
|
||||||
|
|
||||||
public CategoryModel findOneByCategoryName(String categoryName);
|
public CategoryModel findOneByCategoryName(String categoryName);
|
||||||
|
|
||||||
|
public CategoryModel findByTransactionId(Long transactionId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,4 +48,9 @@ public class CategoryServiceImpl implements CategoryService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CategoryModel findByTransactionId(Long transactionId) {
|
||||||
|
return CategoryModel.convertFrom(categoryRepository.findByTransactionId(transactionId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,7 @@ public interface CategoryRepository extends JpaRepository<CategoryEntity, Long>
|
|||||||
@Query("select c from CategoryEntity c where c.categoryName = :categoryName")
|
@Query("select c from CategoryEntity c where c.categoryName = :categoryName")
|
||||||
public CategoryEntity findByCategoryName(@Param("categoryName") String categoryName);
|
public CategoryEntity findByCategoryName(@Param("categoryName") String categoryName);
|
||||||
|
|
||||||
|
@Query("select c from CategoryEntity c inner join TransactionEntity t on c.categoryId = t.categoryEntity.categoryId where t.transactionId = :transactionId")
|
||||||
|
public CategoryEntity findByTransactionId(Long transactionId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user