Entityの型、インポートの変更

This commit is contained in:
s-sakiyama
2026-10-21 14:03:22 +09:00
parent 02eb671aab
commit 6b7c6d3abf
3 changed files with 84 additions and 86 deletions

View File

@@ -1,6 +1,6 @@
package com.example.demo.entity; package com.example.demo.entity;
import java.sql.Timestamp; import java.util.Date;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
@@ -23,7 +23,6 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class Book_collectionEntity { public class Book_collectionEntity {
//蔵書ID //蔵書ID
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -47,7 +46,7 @@ public class Book_collectionEntity {
private String pubLisher; private String pubLisher;
//特記事項 //特記事項
@Column(name = "note text", nullable = true) @Column(name = "note", nullable = true)
private String noteText; private String noteText;
//貸出フラグ -> charに変更する //貸出フラグ -> charに変更する
@@ -61,63 +60,62 @@ public class Book_collectionEntity {
//更新日 //更新日
@Column(name = "date_update", nullable = false) @Column(name = "date_update", nullable = false)
@LastModifiedDate @LastModifiedDate
private Timestamp dateUpdate; private Date dateUpdate;
// public static Book_collection convertFrom(Book_collection book_collection) { // public static Book_collection convertFrom(Book_collection book_collection) {
// // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。 // // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
// return new Book_collection Entity( // return new Book_collection Entity(
// book_colletion.getIdBook(), // book_colletion.getIdBook(),
// book_colletion.getisBn(), // book_colletion.getisBn(),
// book_colletion.getnmBook(), // book_colletion.getnmBook(),
// book_colletion..getknBook(), // book_colletion..getknBook(),
// book_colletion.getpublisher(), // book_colletion.getpublisher(),
// book_colletion.getnoteText(), // book_colletion.getnoteText(),
// book_colletion.getflgLending(), // book_colletion.getflgLending(),
// book_colletion.getidUpdate(), // book_colletion.getidUpdate(),
// book_colletion.getdateUupdate() // book_colletion.getdateUupdate()
// ); // );
// //
//} //}
//public static EmployeeEntity convertFrom(SearchConditionEmployee searchConditionEmployee) { //public static EmployeeEntity convertFrom(SearchConditionEmployee searchConditionEmployee) {
// EmployeeEntity employeeEntity = new EmployeeEntity(); // EmployeeEntity employeeEntity = new EmployeeEntity();
// //
// 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());
// employeeEntity.setflgLending(searchConditionEmployee.getflgLending()); // employeeEntity.setflgLending(searchConditionEmployee.getflgLending());
// employeeEntity.setidUpdate(searchConditionEmployee.getidUpdate()); // employeeEntity.setidUpdate(searchConditionEmployee.getidUpdate());
// employeeEntity.setdateUpdate(searchConditionEmployee.getdateUupdate()); // employeeEntity.setdateUpdate(searchConditionEmployee.getdateUupdate());
//
// //// public static List<book_collection> createbook_collectionList(List<EmployeeEntity> employeeEntityList) {
//// public static List<book_collection> createbook_collectionList(List<EmployeeEntity> employeeEntityList) { //// return employeeEntityList.stream().map(EmployeeEntity::createbook_collection).toList();
//// return employeeEntityList.stream().map(EmployeeEntity::createbook_collection).toList(); //// }
//// } //
// // List<book_collection> book_collectionList = new ArrayList<>();
// List<book_collection> book_collectionList = new ArrayList<>(); // for(book_collectionEntity book_collectionEntity:employeeEntityList){
// for(book_collectionEntity book_collectionEntity:employeeEntityList){ // book_collection employee = book_collectionEntity.createbook_collection(book_collectionEntity);
// book_collection employee = book_collectionEntity.createbook_collection(book_collectionEntity); // book_collectionList.add(employee);
// book_collectionList.add(employee); // }
// } // return employeeList;
// return employeeList; //
// //
// // public LoginUser createLoginUser() {
// public LoginUser createLoginUser() { // // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。
// // 値を既に持ったインスタンスの生成に、コンストラクタを使用するとこうなります。 // return new LoginUser(
// return new LoginUser( // getidBook(),
// getidBook(), // getisBn(),
// getisBn(), // getnmBook(),
// getnmBook(), // getknBook(),
// getknBook(), // getpublisher(),
// getpublisher(), // getnoteText(),
// getnoteText(), // getflgLending(),
// getflgLending(), // getidUpdate(),
// getidUpdate(), // getdateUpdate()
// getdateUpdate() // );
// ); // }
// }
} }

View File

@@ -1,6 +1,5 @@
package com.example.demo.entity; package com.example.demo.entity;
import java.security.Timestamp;
import java.util.Date; import java.util.Date;
import jakarta.persistence.Column; import jakarta.persistence.Column;
@@ -8,8 +7,9 @@ import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType; import jakarta.persistence.GenerationType;
import jakarta.persistence.Id; import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.hibernate.annotations.Audited.Table; //import org.hibernate.annotations.Audited.Table;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -97,5 +97,5 @@ public class Borrow_booksEntity {
* */ * */
@Column(name = "date_update", nullable = false) @Column(name = "date_update", nullable = false)
@LastModifiedDate @LastModifiedDate
private Timestamp dateUpdate; private Date dateUpdate;
} }

View File

@@ -1,6 +1,6 @@
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.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
@@ -81,7 +81,7 @@ public class EmployeeEntity {
*/ */
@Column(name = "date_update", nullable = false) @Column(name = "date_update", nullable = false)
@LastModifiedDate @LastModifiedDate
private Timestamp dateUpdate; private Date dateUpdate;
} }
// public static EmployeeEntity convertForm(Employee employee) { // public static EmployeeEntity convertForm(Employee employee) {