貸出申請機能

This commit is contained in:
s-sakiyama
2026-10-22 15:15:03 +09:00
parent 307f8951b3
commit 16f4aacf23

View File

@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import com.example.demo.entity.Book_collectionEntity; import com.example.demo.entity.Book_collectionEntity;
import com.example.demo.entity.Borrow_booksEntity; import com.example.demo.entity.Borrow_booksEntity;
import com.example.demo.form.LendingForm;
import com.example.demo.form.ReturnForm; import com.example.demo.form.ReturnForm;
import com.example.demo.form.SearchConditionBookForm; import com.example.demo.form.SearchConditionBookForm;
import com.example.demo.model.LeadingListModel; import com.example.demo.model.LeadingListModel;
@@ -138,4 +139,20 @@ public class ReturnService {
} }
//書籍貸出申請機能
public void executeLending(LendingForm form, int idEmployee) {
var book_collection = book_CollectionRepository.findById(form.getId_book());//更新したい本のEntityを取得
book_collection.get().setFlgLending('1');//フラグだけ書き換え
book_CollectionRepository.save(book_collection.get());
Borrow_booksEntity borrow = new Borrow_booksEntity();//空の申請レコード
borrow.setIdApproval(idEmployee);//申請者ID
borrow.setIdBook(form.getId_book());//蔵書ID
borrow.setDateRequest(new Date());//申請日
borrow.setStatus('1');//ステータスを承認待ちに
borrow.setIdUpdate(idEmployee);//更新者ID
borrow.setDateUpdate(new Date());//更新日
borrowRepository.save(borrow);
}
} }