[edit] !!!!✖エラー発生中のためプル✖!!!!(図書一覧表示)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class BookController {
|
||||
@PostMapping("/book")
|
||||
public String book() {
|
||||
@GetMapping("/book")
|
||||
public String book(Model model) {
|
||||
model.addAttribute("book",bookService.findAll());
|
||||
return "book";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
108
src/main/java/com/example/demo/entity/Book.java
Normal file
108
src/main/java/com/example/demo/entity/Book.java
Normal file
@@ -0,0 +1,108 @@
|
||||
package com.example.demo.entity;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Entity // このクラスがDBのテーブルに対応することを表す
|
||||
@Data
|
||||
@Table(name = "book")
|
||||
public class Book {
|
||||
//貸出処理で使用する図書ID
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "book_Id", nullable = false)
|
||||
private int bookId;
|
||||
|
||||
// 図書管理ID(BK-1など)
|
||||
@Column(name = "book_manage_id", nullable = true)
|
||||
private String bookManageId;
|
||||
|
||||
// タイトル
|
||||
@Column(name = "title", nullable = false)
|
||||
private String title;
|
||||
|
||||
//ISBN
|
||||
@Column(name = "isbn", nullable = false)
|
||||
private String isbn;
|
||||
|
||||
// 著者名
|
||||
@Column(name = "author", nullable = false)
|
||||
private String author;
|
||||
|
||||
// 出版社
|
||||
@Column(name = "publisher", nullable = true)
|
||||
private String publisher;
|
||||
|
||||
// 出版日
|
||||
@Column(name = "publication_date", nullable = true)
|
||||
private Date publicationDate;
|
||||
|
||||
// サブカテゴリーID
|
||||
@Column(name = "subcategory_id", nullable = false)
|
||||
private Integer subcategoryId;
|
||||
|
||||
// // カテゴリー名
|
||||
// @Column(name = "category_name", nullable = false)
|
||||
// private String categoryName;
|
||||
//
|
||||
// // サブカテゴリー名
|
||||
// @Column(name = "subcategory_name", nullable = false)
|
||||
// private String subcategoryName;
|
||||
|
||||
// 保管場所ID
|
||||
@Column(name = "location_id", nullable = false)
|
||||
private Integer locationId;
|
||||
|
||||
// // 保管場所
|
||||
// @Column(name = "location_name", nullable = false)
|
||||
// private String locationName;
|
||||
|
||||
// // 貸出状態
|
||||
// @Column(name = "book_Id", nullable = false)
|
||||
// private int bookStatus;
|
||||
|
||||
// 本の状態
|
||||
@Column(name = "condition_s", nullable = false)
|
||||
private int condition;
|
||||
|
||||
// 登録日
|
||||
@Column(name = "created_at", nullable = false)
|
||||
private Date createdAt;
|
||||
|
||||
// 更新日
|
||||
@Column(name = "updated_at", nullable = false)
|
||||
private Date updatedAt;
|
||||
|
||||
//削除フラグ
|
||||
@Column(name = "is_deleted", nullable = false)
|
||||
private Integer isDeleted;
|
||||
|
||||
// 寄贈者社員ID
|
||||
@Column(name = "donor_id", nullable = true)
|
||||
private String donorId;
|
||||
|
||||
// // 寄贈者社員名
|
||||
// @Column(name = "donor_name", nullable = true)
|
||||
// private String donorName;
|
||||
|
||||
// //返却予定日
|
||||
// @Column(name = "return_date", nullable = false)
|
||||
// private Date returnDate;
|
||||
|
||||
//備考
|
||||
@Column(name = "description", nullable = true)
|
||||
private String description;
|
||||
|
||||
//申請承認フラグ
|
||||
@Column(name = "book_approval", nullable = false)
|
||||
private Integer bookApproval;
|
||||
|
||||
}
|
||||
5
src/main/java/com/example/demo/form/BookForm.java
Normal file
5
src/main/java/com/example/demo/form/BookForm.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.example.demo.form;
|
||||
|
||||
public class BookForm {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.example.demo.repository;
|
||||
|
||||
import java.awt.print.Book;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface BookRepository extends JpaRepository<Book, Integer>{
|
||||
|
||||
}
|
||||
11
src/main/java/com/example/demo/service/BookService.java
Normal file
11
src/main/java/com/example/demo/service/BookService.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.example.demo.entity.Book;
|
||||
|
||||
public interface BookService {
|
||||
String booklist(Book book);
|
||||
|
||||
List<Book> findAll();
|
||||
}
|
||||
33
src/main/java/com/example/demo/service/BookServiceImpl.java
Normal file
33
src/main/java/com/example/demo/service/BookServiceImpl.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
import java.awt.print.Book;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.entity.Book;
|
||||
import com.example.demo.repository.BookRepository;
|
||||
|
||||
@Service
|
||||
public class BookServiceImpl implements BookService{
|
||||
|
||||
@Autowired
|
||||
private BookRepository bookRepository;
|
||||
|
||||
@Override
|
||||
public String booklist(Book book) {
|
||||
Book booklist = new Book();
|
||||
booklist.set
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Book> findAll() {
|
||||
// TODO 自動生成されたメソッド・スタブ
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,18 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>社内図書一覧</title>
|
||||
<meta charset="UTF-8">
|
||||
<title>社内図書一覧</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form method="post" action="bookLend">
|
||||
<form method="get" action="bookLend">
|
||||
|
||||
|
||||
<button type="submit" class="btn-login">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><polyline points="10 17 15 12 10 7"/><line x1="15" y1="12" x2="3" y2="12"/></svg>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" />
|
||||
<polyline points="10 17 15 12 10 7" />
|
||||
<line x1="15" y1="12" x2="3" y2="12" />
|
||||
</svg>
|
||||
貸出
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user