Compare commits
9 Commits
ef84f8ff26
...
53485523b0
| Author | SHA1 | Date | |
|---|---|---|---|
| 53485523b0 | |||
| 6b0fcad592 | |||
| 077b53243a | |||
| d8b29c784b | |||
|
|
2659bfae11 | ||
|
|
65e5ab418d | ||
| 5fb1c2fe52 | |||
| afcea0517d | |||
|
|
0aac7742c2 |
@@ -74,6 +74,11 @@
|
|||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.example</groupId>
|
||||||
|
<artifactId>HelloSpring</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.example.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class LendingListController {
|
||||||
|
|
||||||
|
// @GetMapping("/lendingList")
|
||||||
|
// public String show(Model model) {
|
||||||
|
// List<X> x = xservice.getX();
|
||||||
|
// model.addAttribute("Y", x);
|
||||||
|
// return "Y";
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// HttpSession session;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// public SelectListController(HttpSession session) {
|
||||||
|
// this.session=session;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping("/lendingList")
|
||||||
|
// public String lendList() {
|
||||||
|
// return "lendingList";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping(value = lendingList, method = RequestMethod.POST)
|
||||||
|
// public String select( , Model model) {
|
||||||
|
// model.addAttribute(
|
||||||
|
// );
|
||||||
|
// return lendingList;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.example.demo.entity;
|
package com.example.demo.entity;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -9,10 +9,13 @@ import jakarta.persistence.GenerationType;
|
|||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
import org.springframework.data.annotation.LastModifiedDate;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
//テーブル名
|
||||||
@Table(name = "book_collection")
|
@Table(name = "book_collection")
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
@@ -28,28 +31,28 @@ public class Book_collectionEntity {
|
|||||||
private Integer idBook;
|
private Integer idBook;
|
||||||
|
|
||||||
//ISBN
|
//ISBN
|
||||||
@Column(name = "isbn", nullable = false)
|
@Column(name = "isbn", nullable = false, length = 13)
|
||||||
private String isBn;
|
private String isBn;
|
||||||
|
|
||||||
//書籍名
|
//書籍名
|
||||||
@Column(name = "nm_book", nullable = false)
|
@Column(name = "nm_book", nullable = false, length = 50)
|
||||||
private String nmBook;
|
private String nmBook;
|
||||||
|
|
||||||
//書籍名よみ
|
//書籍名よみ
|
||||||
@Column(name = "kn_book", nullable = true)
|
@Column(name = "kn_book", nullable = true, length = 100)
|
||||||
private String knBook;
|
private String knBook;
|
||||||
|
|
||||||
//出版社
|
//出版社
|
||||||
@Column(name = "publisher", nullable = true)
|
@Column(name = "publisher", nullable = true, length = 50)
|
||||||
private String pubLisher;
|
private String pubLisher;
|
||||||
|
|
||||||
//特記事項
|
//特記事項
|
||||||
@Column(name = "note text", nullable = true)
|
@Column(name = "note text", nullable = true)
|
||||||
private String noteText;
|
private String noteText;
|
||||||
|
|
||||||
//貸出フラグ
|
//貸出フラグ -> charに変更する
|
||||||
@Column(name = "flg_lending", length = 1, nullable = false)
|
@Column(name = "flg_lending", nullable = false, columnDefinition = "default 0")
|
||||||
private String flgLending;
|
private Character flgLending;
|
||||||
|
|
||||||
//更新者
|
//更新者
|
||||||
@Column(name = "id_update", nullable = false)
|
@Column(name = "id_update", nullable = false)
|
||||||
@@ -57,7 +60,8 @@ public class Book_collectionEntity {
|
|||||||
|
|
||||||
//更新日
|
//更新日
|
||||||
@Column(name = "date_update", nullable = false)
|
@Column(name = "date_update", nullable = false)
|
||||||
private Date dateUpdate;
|
@LastModifiedDate
|
||||||
|
private Timestamp dateUpdate;
|
||||||
|
|
||||||
// public static Book_collection convertFrom(Book_collection book_collection) {
|
// public static Book_collection convertFrom(Book_collection book_collection) {
|
||||||
// // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
// // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
|
||||||
@@ -80,7 +84,7 @@ public class Book_collectionEntity {
|
|||||||
// employeeEntity.setIdBook(searchConditionEmployee.getIdBook());
|
// employeeEntity.setIdBook(searchConditionEmployee.getIdBook());
|
||||||
// employeeEntity.setisBn(searchConditionEmployee.getisBn());
|
// employeeEntity.setisBn(searchConditionEmployee.getisBn());
|
||||||
// employeeEntity.setnmBook(searchConditionEmployee.getnmBook());
|
// employeeEntity.setnmBook(searchConditionEmployee.getnmBook());
|
||||||
|
|
||||||
// employeeEntity.setknBook(searchConditionEmployee.knBook());
|
// employeeEntity.setknBook(searchConditionEmployee.knBook());
|
||||||
// employeeEntity.setpublisher(searchConditionEmployee.getpublisher());
|
// employeeEntity.setpublisher(searchConditionEmployee.getpublisher());
|
||||||
// employeeEntity.setnoteText(searchConditionEmployee.getnoteText());
|
// employeeEntity.setnoteText(searchConditionEmployee.getnoteText());
|
||||||
|
|||||||
@@ -1,5 +1,101 @@
|
|||||||
package com.example.demo.entity;
|
package com.example.demo.entity;
|
||||||
|
|
||||||
|
import java.security.Timestamp;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Audited.Table;
|
||||||
|
import org.springframework.data.annotation.LastModifiedDate;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "borrow_books")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
|
||||||
public class Borrow_booksEntity {
|
public class Borrow_booksEntity {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 申請ID
|
||||||
|
* */
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_request", nullable = false)
|
||||||
|
private Integer idRequest;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 申請者ID
|
||||||
|
* */
|
||||||
|
@Column(name = "id_applicant", nullable = false)
|
||||||
|
private Integer idApplicant;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 蔵書ID
|
||||||
|
* */
|
||||||
|
@Column(name = "id_book", nullable = false)
|
||||||
|
private Integer idBook;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 申請日
|
||||||
|
* */
|
||||||
|
@Column(name = "date_request", nullable = false)
|
||||||
|
private Date dateRequest;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ステータス
|
||||||
|
* */
|
||||||
|
@Column(name = "status", nullable = false, columnDefinition = "default 1")
|
||||||
|
private Character status;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 承認者
|
||||||
|
* */
|
||||||
|
@Column(name = "id_approval", nullable = true)
|
||||||
|
private Integer idApproval;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 承認日
|
||||||
|
* */
|
||||||
|
@Column(name = "date_approval", nullable = true)
|
||||||
|
private Date dateApproval;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 貸出日
|
||||||
|
* */
|
||||||
|
@Column(name = "date_borrow", nullable = false)
|
||||||
|
private Date dateBorrow;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 返却予定日
|
||||||
|
* */
|
||||||
|
@Column(name = "date_scheduled_return", nullable = false)
|
||||||
|
private Date dateScheduledReturn;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 返却日
|
||||||
|
* */
|
||||||
|
@Column(name = "date_return", nullable = true)
|
||||||
|
private Date dateReturn;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 更新者
|
||||||
|
* */
|
||||||
|
@Column(name = "id_update", nullable = false)
|
||||||
|
private Integer idUpdate;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 更新日
|
||||||
|
* */
|
||||||
|
@Column(name = "date_update", nullable = false)
|
||||||
|
@LastModifiedDate
|
||||||
|
private Timestamp dateUpdate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,141 @@
|
|||||||
package com.example.demo.entity;
|
package com.example.demo.entity;
|
||||||
|
|
||||||
public class EmployeeEntity {
|
import java.security.Timestamp;
|
||||||
|
|
||||||
|
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 org.springframework.data.annotation.LastModifiedDate;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmployeeテーブルのEntity
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "employee")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
|
||||||
|
public class EmployeeEntity {
|
||||||
|
/**
|
||||||
|
* 社員ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id_employee", nullable = false)
|
||||||
|
private Integer idEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員名
|
||||||
|
*/
|
||||||
|
@Column(name = "nm_employee", nullable = false, length = 50)
|
||||||
|
private String nmEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社員よみ
|
||||||
|
*/
|
||||||
|
@Column(name = "kn_employee", nullable = false, length = 100)
|
||||||
|
private String knEmployee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メールアドレス
|
||||||
|
*/
|
||||||
|
@Column(name = "mail_address", nullable = false, length = 256)
|
||||||
|
private String MailAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* パスワード
|
||||||
|
*/
|
||||||
|
@Column(name = "password", nullable = false, length = 256)
|
||||||
|
private String Password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理者フラグ
|
||||||
|
*/
|
||||||
|
@Column(name = "flg_admin", nullable = false)
|
||||||
|
private Character FlgAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退職者フラグ
|
||||||
|
*/
|
||||||
|
@Column(name = "flg_retirement", nullable = false)
|
||||||
|
private Character FlgRetirement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新者
|
||||||
|
*/
|
||||||
|
@Column(name = "id_update", nullable = false)
|
||||||
|
private Integer idUpdate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新日
|
||||||
|
*/
|
||||||
|
@Column(name = "date_update", nullable = false)
|
||||||
|
@LastModifiedDate
|
||||||
|
private Timestamp dateUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static EmployeeEntity convertForm(Employee employee) {
|
||||||
|
// return new EmployeeEntity(
|
||||||
|
// employee.getIdEmployee(),
|
||||||
|
// employee.getnmEmployee(),
|
||||||
|
// employee.getknEmployee(),
|
||||||
|
// employee.getMailAddress(),
|
||||||
|
// employee.getPassword(),
|
||||||
|
// employee.getFlgAdmin(),
|
||||||
|
// employee.getFlgRetirement(),
|
||||||
|
// employee.getIdUpdate(),
|
||||||
|
// employee.getDateUpdate());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static EmployeeEntity convertFrom(SearchConditionEmployee searchConditionEmployee) {
|
||||||
|
// EmployeeEntity employeeEntity = new EmployeeEntity();
|
||||||
|
//
|
||||||
|
// employeeEntity.setIdEmployee(searchConditionEmployee.getIdEmployee());
|
||||||
|
// employeeEntity.setNmEmployee(searchConditionEmployee.getNmEmployee());
|
||||||
|
// employeeEntity.setKnEmployee(searchConditionEmployee.getKnEmployee());
|
||||||
|
// employeeEntity.setMailAddress(searchConditionEmployee.getMailAddress());
|
||||||
|
//
|
||||||
|
// return employeeEntity;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static Employee createEmployee(EmployeeEntity employeeEntity) {
|
||||||
|
// return new Employee(
|
||||||
|
// employeeEntity.getIdEmployee(),
|
||||||
|
// employeeEntity.getNmEmployee(),
|
||||||
|
// employeeEntity.getKnEmployee(),
|
||||||
|
// employeeEntity.getMailAddress(),
|
||||||
|
// employeeEntity.getPassword(),
|
||||||
|
// employeeEntity.getFlgAdmin(),
|
||||||
|
// employeeEntity.getFlgRetirement(),
|
||||||
|
// employeeEntity.getIdUpdate(),
|
||||||
|
// employeeEntity.getDateUpdate());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static List<Employee> createEmployeeList(List<EmployeeEntity> employeeEntityList) {
|
||||||
|
// return employeeEntityList.stream().map(EmployeeEntity::createEmployee).toList();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public LoginUser createLoginUser() {
|
||||||
|
// getIdEmployee(),
|
||||||
|
// getNmEmployee(),
|
||||||
|
// getKnEmployee(),
|
||||||
|
// getMailAddress(),
|
||||||
|
// getPassword(),
|
||||||
|
// getFlgAdmin(),
|
||||||
|
// getFlgRetirement(),
|
||||||
|
// getIdUpdate(),
|
||||||
|
// getDateUpdate());
|
||||||
|
//}
|
||||||
|
//}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example.demo.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.demo.entity.Book_collectionEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Book_CollectionRepository extends JpaRepository<Book_collectionEntity, Integer> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example.demo.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.demo.entity.Borrow_booksEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Borrow_BooksRepository extends JpaRepository<Borrow_booksEntity, Integer> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example.demo.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.example.demo.entity.EmployeeEntity;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Integer> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.entity.EmployeeEntity;
|
||||||
|
import com.example.demo.repository.Book_CollectionRepository;
|
||||||
|
import com.example.demo.repository.Borrow_BooksRepository;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class LendingListService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Book_CollectionRepository collection;
|
||||||
|
@Autowired
|
||||||
|
private Borrow_BooksRepository borrow;
|
||||||
|
@Autowired
|
||||||
|
private EmployeeEntity employee;
|
||||||
|
|
||||||
|
public List<table> getcollectionWithborrow(){
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
5
team1/src/main/java/com/example/demo/service/S.java
Normal file
5
team1/src/main/java/com/example/demo/service/S.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
public class S {
|
||||||
|
|
||||||
|
}
|
||||||
45
team1/src/main/resources/templates/lendingList.html
Normal file
45
team1/src/main/resources/templates/lendingList.html
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||||
|
<title>貸出中書籍一覧</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
<div class="rightSection">
|
||||||
|
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||||
|
</div>
|
||||||
|
<a href="menu">メニューに戻る</a>
|
||||||
|
<h1><span>検索結果</span></h1>
|
||||||
|
</h1>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 100px;">申請ID</th>
|
||||||
|
<th style="width: 100px;">申請者名</th>
|
||||||
|
<th style="width: 100px;">書籍名</th>
|
||||||
|
<th style="width: 100px;">申請日</th>
|
||||||
|
<th style="width: 100px;">貸出日</th>
|
||||||
|
<th style="width: 100px;">返却予定日</th>
|
||||||
|
<th style="width: 100px;">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="">
|
||||||
|
<td th:text="${.idRequest}"></td>
|
||||||
|
<td th:text="${.}"></td>
|
||||||
|
<td th:text="${.}"></td>
|
||||||
|
<td th:text="${.dateRequest}"></td>
|
||||||
|
<td th:text="${.dateBorrow}"></td>
|
||||||
|
<td th:text="${.dateScheduledReturn}"></td>
|
||||||
|
<td>
|
||||||
|
<form action="" method="post" style="display: inline;">
|
||||||
|
<input name="" th:value="${}" type="hidden">
|
||||||
|
<input type="submit" value="返却">
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tbody>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user