[EDIT] EntityからModelへの変換メソッドを作成しました。
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package com.example.demo.app.domain.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.example.demo.app.infra.entity.CategoryEntity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -11,4 +15,16 @@ public class CategoryModel {
|
||||
private String categoryName;
|
||||
private Integer transactionType;
|
||||
|
||||
|
||||
public static CategoryModel convertFrom(CategoryEntity categoryEntity) {
|
||||
return new CategoryModel(
|
||||
categoryEntity.getCategoryId(),
|
||||
categoryEntity.getCategoryName(),
|
||||
categoryEntity.getTransactionType());
|
||||
}
|
||||
|
||||
public static List<CategoryModel> convertFrom(List<CategoryEntity> categoryEntityList) {
|
||||
return categoryEntityList.stream().map(CategoryModel::convertFrom).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user