OSDN Git Service

Resultを定義
authortkskjri05 <t.kujirai@nagatake.co.jp>
Mon, 3 May 2021 04:55:20 +0000 (13:55 +0900)
committertkskjri05 <t.kujirai@nagatake.co.jp>
Mon, 3 May 2021 04:55:20 +0000 (13:55 +0900)
src/main/java/com/example/mapper/TodoListMapper.java

index e35fec4..7246d39 100644 (file)
@@ -4,12 +4,22 @@ import java.util.List;
 
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Result;
+import org.apache.ibatis.annotations.Results;
 import org.apache.ibatis.annotations.Select;
 
 import com.example.dto.TodoListDto;
 
 @Mapper
 public interface TodoListMapper {
+       @Results({
+               @Result(property = "headerId", column = "header_id"),
+               @Result(property = "id", column = "id"),
+               @Result(property = "name", column = "name"),
+               @Result(property = "done", column = "done"),
+               @Result(property = "created", column = "created"),
+               @Result(property = "updated", column = "updated")
+       })
        @Select({ "<script>",
                        " select",
                        "     header_id",
@@ -29,7 +39,7 @@ public interface TodoListMapper {
        
        @Select({ "<script>",
                " select",
-               "     max(id)",
+               "     max(id)",
                " from",
                "     todo_list ",
                " where",