Compare commits
8 Commits
076fdd1b04
...
5660393145
Author | SHA1 | Date |
---|---|---|
zhangping | 5660393145 | |
zhangping | eb3af529e4 | |
zhangping | 196cca220a | |
zhangping | 8600412cb1 | |
zhangping | 0f60624493 | |
zhangping | 42669786dd | |
zhangping | f6398c942e | |
zhangping | be13576c42 |
|
@ -1,6 +1,6 @@
|
|||
package com.c202101080126.task1.controller;
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Book;
|
||||
import com.c202101080126.task1.service.BookService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -16,29 +16,10 @@ public class BookController {
|
|||
|
||||
|
||||
|
||||
@RequestMapping("booklist")
|
||||
public String booklist(Model model,String title)
|
||||
{
|
||||
if(title!=null&&!title.equals("")){
|
||||
model.addAttribute("books",bookService.searchBooksbyTitle(title));
|
||||
}
|
||||
else {
|
||||
model.addAttribute("books", bookService.getBooks());
|
||||
}
|
||||
|
||||
return "booklist.html";
|
||||
}
|
||||
|
||||
@RequestMapping("commentlist1")
|
||||
public String commentlist(Model model)
|
||||
{
|
||||
model.addAttribute("books", bookService.getBooks());
|
||||
return "commentlist.html";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("addbook")
|
||||
public String addbook(Books book)
|
||||
public String addbook(Book book)
|
||||
{
|
||||
System.out.println(book);
|
||||
bookService.addBook(book);
|
||||
|
@ -51,6 +32,20 @@ public class BookController {
|
|||
{
|
||||
return "addbook.html";
|
||||
}
|
||||
@RequestMapping("booklist")
|
||||
public String booklist(Model model,String title)
|
||||
{
|
||||
|
||||
if(title!=null&&!title.equals("")){
|
||||
|
||||
model.addAttribute("books", bookService.searchBookbyTitle(title));
|
||||
}
|
||||
else
|
||||
{
|
||||
model.addAttribute("books", bookService.getBooks());
|
||||
}
|
||||
return "booklist.html";
|
||||
}
|
||||
|
||||
@RequestMapping("deletebook")
|
||||
public String deleteBook(int id)
|
||||
|
@ -58,19 +53,26 @@ public class BookController {
|
|||
bookService.deleteBook(id);
|
||||
return "redirect:booklist";
|
||||
}
|
||||
// 更新
|
||||
@RequestMapping("updatebook")
|
||||
public String updatebook(Books book, Model model)
|
||||
public String updatebook(Book book, Model model)
|
||||
{
|
||||
//todo 传到一个新的页面更新
|
||||
|
||||
model.addAttribute("book",book);
|
||||
return "updatebook.html";
|
||||
}
|
||||
@RequestMapping("updatebookcommit")
|
||||
public String updatebookcommit(Books book)
|
||||
public String updatebookcommit(Book book)
|
||||
{
|
||||
bookService.updateBook(book);
|
||||
return "redirect:booklist";
|
||||
}
|
||||
|
||||
@RequestMapping("commentlist")
|
||||
public String commentlist(Model model) {
|
||||
model.addAttribute("books", bookService.getBooks());
|
||||
return "commentlist.html";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.c202101080126.task1.controller;
|
|||
|
||||
|
||||
import org.springframework.ui.Model;
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Book;
|
||||
import com.c202101080126.task1.model.BorrowRecords;
|
||||
import com.c202101080126.task1.model.Users;
|
||||
import com.c202101080126.task1.model.User;
|
||||
import com.c202101080126.task1.service.BookService;
|
||||
import com.c202101080126.task1.service.IBorrowRecordsService;
|
||||
import com.c202101080126.task1.service.UserService;
|
||||
|
@ -32,66 +32,55 @@ public class BorrowRecordsController {
|
|||
BookService bookService;
|
||||
@Autowired
|
||||
UserService userService;
|
||||
// 查询所有书籍借阅
|
||||
|
||||
@RequestMapping("borrowlist")
|
||||
public String borrowlist(Model model, String title){
|
||||
if(title!=null&&!title.equals("")){
|
||||
int bookid=bookService.getBookByTitle(title).getId();
|
||||
model.addAttribute("borrowRecords",borrowRecordsService.searchBorrowByBookId(bookid));
|
||||
}else{
|
||||
model.addAttribute("borrowRecords",borrowRecordsService.getBorrowRecords());
|
||||
public String borrowlist(Model model, String title) {
|
||||
if (title != null && !title.equals("")) {
|
||||
int bookid = bookService.getBookByTitle(title).getId();
|
||||
model.addAttribute("borrowrecords", borrowRecordsService.searchBorrowRecordsbyId(bookid));
|
||||
} else {
|
||||
model.addAttribute("borrowrecords", borrowRecordsService.getBorrowRecords());
|
||||
}
|
||||
return "bookborrow.html";
|
||||
return "borrowlist.html";
|
||||
}
|
||||
|
||||
//增加书籍借阅
|
||||
@RequestMapping("addborrowpage")
|
||||
public String addborrowpage(Model model){
|
||||
List<Books> books=bookService.getBooks();
|
||||
List<Users> users=userService.getAllUsers();
|
||||
model.addAttribute("users",users);
|
||||
model.addAttribute("books",books);
|
||||
@RequestMapping("addborrowrecord")
|
||||
public String addborrowrecord(Model model) {
|
||||
return "addborrow.html";
|
||||
}
|
||||
|
||||
@RequestMapping("addborrow")
|
||||
public String addborrow(int userid, int bookid, LocalDate borrowDate, LocalDate returnDate){
|
||||
BorrowRecords borrowRecords=new BorrowRecords();
|
||||
borrowRecords.setUserid(userid);
|
||||
borrowRecords.setBookid(bookid);
|
||||
borrowRecords.setBorrowDate(borrowDate);
|
||||
borrowRecords.setReturnDate(returnDate);
|
||||
borrowRecords.setStatus("借阅中");
|
||||
borrowRecordsService.addBorrow(borrowRecords);
|
||||
return "redirect:borrowlist";
|
||||
public String addborrow(BorrowRecords borrowRecords) {
|
||||
borrowRecordsService.addBorrowRecords(borrowRecords);
|
||||
return "redirect:/borrowlist";
|
||||
}
|
||||
|
||||
@RequestMapping("deleteborrow")
|
||||
public String deleteborrow(int id){
|
||||
borrowRecordsService.deleteborrow(id);
|
||||
return "redirect:borrowlist";
|
||||
public String deleteborrow(int id) {
|
||||
borrowRecordsService.deleteBorrowRecords(id);
|
||||
return "redirect:/borrowlist";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("updateborrow")
|
||||
public String updateborrowpage(Model model, BorrowRecords borrowRecords){
|
||||
model.addAttribute("borrowRecord",borrowRecords);
|
||||
public String updateborrow(BorrowRecords borrowRecords, Model model) {
|
||||
model.addAttribute("borrow", borrowRecords);
|
||||
//borrowRecordsService.updateBorrowRecords(borrowRecords);
|
||||
return "updateborrow.html";
|
||||
}
|
||||
|
||||
@RequestMapping("updateborrowcommit")
|
||||
public String updateborrow(int id,int userid, int bookid, LocalDate borrowDate, LocalDate returnDate, String status) {
|
||||
System.out.println("1111" + borrowDate);
|
||||
public String updateborrowcommit(int id, int userid, int bookid, LocalDate borrowDate, LocalDate backDate) {
|
||||
BorrowRecords borrowRecords = new BorrowRecords();
|
||||
borrowRecords.setId(id);
|
||||
borrowRecords.setUserid(userid);
|
||||
borrowRecords.setBookid(bookid);
|
||||
borrowRecords.setBorrowDate(borrowDate);
|
||||
borrowRecords.setReturnDate(returnDate);
|
||||
borrowRecords.setStatus(status);
|
||||
System.out.println(borrowRecords.getBorrowDate());
|
||||
|
||||
borrowRecordsService.updateborrow(borrowRecords);
|
||||
return "redirect:borrowlist";
|
||||
borrowRecords.setBackDate(backDate);
|
||||
borrowRecordsService.updateBorrowRecords(borrowRecords);
|
||||
return "redirect:/borrowlist";
|
||||
}
|
||||
|
||||
// @RequestMapping("addborrow")
|
||||
// public String addborrow(int bookid,int userid) {
|
||||
// borrowRecordsService.addBorrowRecord(bookid,userid);
|
||||
// return "redirect:/borrowlist";
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
package com.c202101080126.task1.controller;
|
||||
|
||||
import com.c202101080126.task1.service.LoginService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
|
||||
@RequestMapping("login")
|
||||
public String login()
|
||||
{
|
||||
return "login.html";
|
||||
}
|
||||
|
||||
@RequestMapping("register")
|
||||
public String register()
|
||||
{
|
||||
return "register.html";
|
||||
}
|
||||
|
||||
@RequestMapping("registercommit")
|
||||
public String registercommit(String username,String password)
|
||||
{
|
||||
loginService.register(username,password);
|
||||
return "login.html";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,7 +3,6 @@ package com.c202101080126.task1.controller;
|
|||
import com.c202101080126.task1.model.Reviews;
|
||||
import com.c202101080126.task1.service.IReviewsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
|
@ -16,11 +15,20 @@ import org.springframework.stereotype.Controller;
|
|||
* @since 2024-09-14
|
||||
*/
|
||||
@Controller
|
||||
|
||||
public class ReviewsController {
|
||||
@Autowired
|
||||
IReviewsService reviewsService;
|
||||
|
||||
@RequestMapping("addcommentpage")
|
||||
public String addcommentpage() {
|
||||
|
||||
return "addcomment.html";
|
||||
}
|
||||
|
||||
@RequestMapping("addcomment")
|
||||
public String addcomment(Reviews reviews) {
|
||||
reviewsService.addreview(reviews);
|
||||
return "redirect:/booklist";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,69 +1,41 @@
|
|||
package com.c202101080126.task1.controller;
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Reviews;
|
||||
import org.springframework.ui.Model;
|
||||
import com.c202101080126.task1.service.BookService;
|
||||
import com.c202101080126.task1.service.IReviewsService;
|
||||
import com.c202101080126.task1.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhangping
|
||||
* @since 2024-09-14
|
||||
*/
|
||||
@Controller
|
||||
|
||||
public class UserController {
|
||||
public class UserController
|
||||
{
|
||||
@Autowired
|
||||
UserService userService;
|
||||
@Autowired
|
||||
IReviewsService reviewsService;
|
||||
@Autowired
|
||||
BookService bookService;
|
||||
//获取所有用户的书籍评价
|
||||
@RequestMapping("commentlist")
|
||||
public String commentlist(Model model,String title)
|
||||
private UserService userService;
|
||||
|
||||
@RequestMapping("login")
|
||||
public String login()
|
||||
{
|
||||
if(title!=null&&!title.equals("")) {
|
||||
model.addAttribute("users", reviewsService.searchBooksbyTitle(title));
|
||||
}else{
|
||||
model.addAttribute("users", userService.getAllUsers());
|
||||
return "login.html";
|
||||
}
|
||||
return "bookcommentlist.html";
|
||||
}
|
||||
|
||||
//添加书籍评价页面
|
||||
@RequestMapping("addcommentpage")
|
||||
public String addcommentpage(Model model,int id)
|
||||
@RequestMapping("register")
|
||||
public String register()
|
||||
{
|
||||
Reviews review=new Reviews();
|
||||
review.setUserid(id);
|
||||
List<Books> books=bookService.getBooks();
|
||||
model.addAttribute("review",review);
|
||||
model.addAttribute("books",books);
|
||||
return "addcomment.html";
|
||||
return "register.html";
|
||||
}
|
||||
|
||||
@RequestMapping("addcomment")
|
||||
public String addcomment(String id,String bookid,String comment)
|
||||
@RequestMapping("logincommit")
|
||||
public String logincommit(String username,String password)
|
||||
{
|
||||
System.out.println(id+" "+bookid+" "+comment);
|
||||
Reviews review=new Reviews();
|
||||
review.setUserid(Integer.parseInt(id));
|
||||
review.setBookid(Integer.parseInt(bookid));
|
||||
review.setComment(comment);
|
||||
reviewsService.addreview(review);
|
||||
return "redirect:/commentlist";
|
||||
String result=userService.getPassword(username);
|
||||
System.out.println("result"+result);
|
||||
System.out.println("password"+password);
|
||||
if(result.equals(password))
|
||||
return "book.html";
|
||||
else
|
||||
return "loginfail.html";
|
||||
}
|
||||
@RequestMapping("registercommit")
|
||||
public String registercommit(String username,String password)
|
||||
{
|
||||
userService.register(username,password);
|
||||
return "login.html";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.c202101080126.task1.dao;
|
||||
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Book;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
|
@ -9,14 +9,13 @@ import java.util.List;
|
|||
|
||||
@Mapper
|
||||
public interface BookMapper {
|
||||
public List<Books> getBooks();
|
||||
public List<Books> getBooks1();
|
||||
public Books getBookByBookId(int id);
|
||||
|
||||
public int addBook(Books book);
|
||||
public List<Book> getBooks();
|
||||
public List<Book> getBooks1();
|
||||
public Book getBookByBookId(int id);
|
||||
public int addBook(Book book);
|
||||
public int deleteBook(int id);
|
||||
public int updateBook(Books book);
|
||||
public List<Books> searchBooksbyTitle(String title);
|
||||
public Books getBookByTitle(String title);
|
||||
public int updateBook(Book book);
|
||||
public List<Book> searchBookbyTitle(String title);
|
||||
public Book getBookByTitle(String title);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface BorrowRecordsMapper extends BaseMapper<BorrowRecords> {
|
||||
|
||||
public List<BorrowRecords> getBorrowRecords();
|
||||
|
||||
public List<BorrowRecords> searchBorrowByBookId(int bookid);
|
||||
public int addBorrowRecords(BorrowRecords borrowRecords);
|
||||
|
||||
public int addBorrow(BorrowRecords borrowRecords);
|
||||
public List<BorrowRecords> searchBorrowRecordsbyId(int bookid);
|
||||
|
||||
public int deleteborrow(int id);
|
||||
|
||||
public int updateborrow(BorrowRecords borrowRecords);
|
||||
public int deleteBorrowRecords(int id);
|
||||
|
||||
public int updateBorrowRecords(BorrowRecords borrowRecords);
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package com.c202101080126.task1.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface LoginMapper {
|
||||
public void register(String username, String password);
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package com.c202101080126.task1.dao;
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Book;
|
||||
import com.c202101080126.task1.model.Reviews;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,14 +14,16 @@ import java.util.List;
|
|||
* @author zhangping
|
||||
* @since 2024-09-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReviewsMapper extends BaseMapper<Reviews> {
|
||||
public int addreview(Reviews reviews);
|
||||
|
||||
public List<Reviews> getReviewsByBookId(int id);
|
||||
public List<Reviews> getCommentByUserId(int id);
|
||||
@Mapper
|
||||
public interface ReviewsMapper {
|
||||
|
||||
|
||||
public List<Reviews> getreviews();
|
||||
|
||||
public List<Books> searchBooksbyTitle(String title);
|
||||
public int addreview(Reviews reviews);
|
||||
public List<Reviews> getCommentByBookId(int id);
|
||||
public List<Reviews> getCommentByUserId(int id);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
package com.c202101080126.task1.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.c202101080126.task1.model.Users;
|
||||
import com.c202101080126.task1.model.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhangping
|
||||
* @since 2024-09-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
public void register(String username,String password);
|
||||
public String getPassword(String username);
|
||||
|
||||
public List<Users> getAllUsers();
|
||||
public Users getUserById(int id);
|
||||
public User getUserById(int userid);
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package com.c202101080126.task1.model;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class Books {
|
||||
private int id;
|
||||
private String title;
|
||||
private String author;
|
||||
private String isbn;
|
||||
private String publisher;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate published_date;
|
||||
private List<Reviews> reviewlist;
|
||||
}
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -19,7 +18,7 @@ import lombok.Setter;
|
|||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("borrow_records202101080126")
|
||||
@TableName("borrow_records202101080124")
|
||||
public class BorrowRecords implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -31,12 +30,9 @@ public class BorrowRecords implements Serializable {
|
|||
|
||||
private Integer bookid;
|
||||
|
||||
private LocalDate borrowDate;;
|
||||
|
||||
private LocalDate returnDate;
|
||||
private String status;
|
||||
private Books book;
|
||||
private Users user;
|
||||
|
||||
private LocalDate borrowDate;
|
||||
|
||||
private LocalDate backDate;
|
||||
private User user;
|
||||
private Book book;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,5 @@ public class Reviews implements Serializable {
|
|||
private Integer bookid;
|
||||
|
||||
private String comment;
|
||||
|
||||
private Books book;
|
||||
|
||||
|
||||
private Book book;
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package com.c202101080126.task1.model;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class Users {
|
||||
|
||||
private String username;
|
||||
private String classname;
|
||||
private int id;
|
||||
private List<Reviews> reviewlist;
|
||||
private List<BorrowRecords> borrowlist;
|
||||
}
|
|
@ -1,20 +1,17 @@
|
|||
package com.c202101080126.task1.service;
|
||||
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Book;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BookService {
|
||||
public List<Books> getBooks();
|
||||
|
||||
public int addBook(Books book);
|
||||
public List<Book> getBooks();
|
||||
public int addBook(Book book);
|
||||
|
||||
public int deleteBook(int id);
|
||||
public int updateBook(Book book);
|
||||
|
||||
public int updateBook(Books book);
|
||||
public List<Book> searchBookbyTitle(String title);
|
||||
public Book getBookByTitle(String title);
|
||||
|
||||
|
||||
public Books getBookByTitle(String title);
|
||||
public List<Books> searchBooksbyTitle(String title);
|
||||
}
|
||||
|
|
|
@ -14,15 +14,10 @@ import java.util.List;
|
|||
* @since 2024-09-14
|
||||
*/
|
||||
public interface IBorrowRecordsService {
|
||||
|
||||
public List<BorrowRecords> getBorrowRecords();
|
||||
|
||||
public List<BorrowRecords> searchBorrowByBookId(int bookid);
|
||||
|
||||
public int addBorrow(BorrowRecords borrowRecords);
|
||||
|
||||
public int deleteborrow(int id);
|
||||
|
||||
public int updateborrow(BorrowRecords borrowRecords);
|
||||
public List<BorrowRecords> searchBorrowRecordsbyId(int bookid);
|
||||
public int addBorrowRecords(BorrowRecords borrowRecords);
|
||||
public int deleteBorrowRecords(int id);
|
||||
public int updateBorrowRecords(BorrowRecords borrowRecords);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package com.c202101080126.task1.service;
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Reviews;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
|
@ -16,9 +12,6 @@ import java.util.List;
|
|||
* @since 2024-09-14
|
||||
*/
|
||||
public interface IReviewsService {
|
||||
|
||||
public int addreview(Reviews reviews);
|
||||
public List<Reviews> getreviews();
|
||||
|
||||
public List<Books> searchBooksbyTitle(String title);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.c202101080126.task1.service.Impl;
|
||||
|
||||
|
||||
import com.c202101080126.task1.dao.BookMapper;
|
||||
import com.c202101080126.task1.dao.LoginMapper;
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Book;
|
||||
import com.c202101080126.task1.service.BookService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -16,13 +13,21 @@ public class BookServiceImpl implements BookService {
|
|||
@Autowired
|
||||
private BookMapper bookMapper;
|
||||
@Override
|
||||
public List<Books> getBooks() {
|
||||
public List<Book> getBooks() {
|
||||
return bookMapper.getBooks1();
|
||||
}
|
||||
@Override
|
||||
public List<Book> searchBookbyTitle(String title) {
|
||||
return bookMapper.searchBookbyTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addBook(Books book) {
|
||||
public Book getBookByTitle(String title) {
|
||||
return bookMapper.getBookByTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addBook(Book book) {
|
||||
return bookMapper.addBook(book);
|
||||
}
|
||||
|
||||
|
@ -32,18 +37,9 @@ public class BookServiceImpl implements BookService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int updateBook(Books book) {
|
||||
public int updateBook(Book book) {
|
||||
return bookMapper.updateBook(book);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Books getBookByTitle(String title) {
|
||||
return bookMapper.getBookByTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Books> searchBooksbyTitle(String title) {
|
||||
return bookMapper.searchBooksbyTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package com.c202101080126.task1.service.Impl;
|
||||
|
||||
import com.c202101080126.task1.dao.BookMapper;
|
||||
import com.c202101080126.task1.dao.UserMapper;
|
||||
import com.c202101080126.task1.model.Book;
|
||||
import com.c202101080126.task1.model.BorrowRecords;
|
||||
import com.c202101080126.task1.dao.BorrowRecordsMapper;
|
||||
import com.c202101080126.task1.model.User;
|
||||
import com.c202101080126.task1.service.IBorrowRecordsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -19,31 +24,56 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class BorrowRecordsServiceImpl implements IBorrowRecordsService {
|
||||
|
||||
@Autowired
|
||||
BorrowRecordsMapper borrowRecordsMapper;
|
||||
@Autowired
|
||||
BookMapper bookMapper;
|
||||
@Autowired
|
||||
UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public List<BorrowRecords> getBorrowRecords() {
|
||||
return borrowRecordsMapper.getBorrowRecords();
|
||||
List<BorrowRecords> borrowRecords =borrowRecordsMapper.getBorrowRecords();
|
||||
|
||||
for(BorrowRecords borrow:borrowRecords){
|
||||
int userid = borrow.getUserid();
|
||||
int bookid = borrow.getBookid();
|
||||
User user = userMapper.getUserById(userid);
|
||||
Book book = bookMapper.getBookByBookId(bookid);
|
||||
borrow.setUser(user);
|
||||
borrow.setBook(book);
|
||||
System.out.println("aaaaaa"+book);
|
||||
}
|
||||
System.out.println(borrowRecords.toString());
|
||||
return borrowRecords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BorrowRecords> searchBorrowByBookId(int bookid) {
|
||||
return borrowRecordsMapper.searchBorrowByBookId(bookid);
|
||||
public List<BorrowRecords> searchBorrowRecordsbyId(int bookid) {
|
||||
List<BorrowRecords> borrowRecords = borrowRecordsMapper.searchBorrowRecordsbyId(bookid);
|
||||
for(BorrowRecords borrow:borrowRecords){
|
||||
int userid = borrow.getUserid();
|
||||
int bookid1 = borrow.getBookid();
|
||||
User user = userMapper.getUserById(userid);
|
||||
Book book = bookMapper.getBookByBookId(bookid1);
|
||||
borrow.setUser(user);
|
||||
borrow.setBook(book);
|
||||
}
|
||||
return borrowRecords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addBorrow(BorrowRecords borrowRecords) {
|
||||
return borrowRecordsMapper.addBorrow(borrowRecords);
|
||||
public int addBorrowRecords(BorrowRecords borrowRecords) {
|
||||
return borrowRecordsMapper.addBorrowRecords(borrowRecords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteborrow(int id) {
|
||||
return borrowRecordsMapper.deleteborrow(id);
|
||||
public int deleteBorrowRecords(int id) {
|
||||
return borrowRecordsMapper.deleteBorrowRecords(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateborrow(BorrowRecords borrowRecords) {
|
||||
return borrowRecordsMapper.updateborrow(borrowRecords);
|
||||
public int updateBorrowRecords(BorrowRecords borrowRecords) {
|
||||
return borrowRecordsMapper.updateBorrowRecords(borrowRecords);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package com.c202101080126.task1.service.Impl;
|
||||
|
||||
import com.c202101080126.task1.dao.LoginMapper;
|
||||
import com.c202101080126.task1.service.LoginService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
@Autowired
|
||||
private LoginMapper loginMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void register(String username, String password) {
|
||||
|
||||
loginMapper.register(username, password);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,16 +1,12 @@
|
|||
package com.c202101080126.task1.service.Impl;
|
||||
|
||||
import com.c202101080126.task1.model.Books;
|
||||
import com.c202101080126.task1.model.Reviews;
|
||||
import com.c202101080126.task1.dao.ReviewsMapper;
|
||||
import com.c202101080126.task1.service.IReviewsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
|
@ -21,26 +17,11 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class ReviewsServiceImpl implements IReviewsService {
|
||||
|
||||
@Autowired
|
||||
ReviewsMapper reviewsMapper;
|
||||
|
||||
@Override
|
||||
public List<Reviews> getreviews() {
|
||||
return reviewsMapper.getreviews();
|
||||
public int addreview(Reviews reviews) {
|
||||
return reviewsMapper.addreview(reviews);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Books> searchBooksbyTitle(String title) {
|
||||
return reviewsMapper.searchBooksbyTitle(title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int addreview(Reviews review) {
|
||||
return reviewsMapper.addreview(review);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,34 @@
|
|||
package com.c202101080126.task1.service.Impl;
|
||||
|
||||
import com.c202101080126.task1.dao.UserMapper;
|
||||
import com.c202101080126.task1.model.Users;
|
||||
import com.c202101080126.task1.model.User;
|
||||
import com.c202101080126.task1.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhangping
|
||||
* @since 2024-09-14
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
UserMapper userMapper;
|
||||
@Override
|
||||
public List<Users> getAllUsers() {
|
||||
return userMapper.getAllUsers();
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public void register(String username, String password) {
|
||||
userMapper.register(username,password);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPassword(String username)
|
||||
{
|
||||
return userMapper.getPassword(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> getAllUsers() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package com.c202101080126.task1.service;
|
||||
|
||||
|
||||
public interface LoginService {
|
||||
public void register(String username,String password);
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +1,12 @@
|
|||
package com.c202101080126.task1.service;
|
||||
|
||||
import com.c202101080126.task1.model.Users;
|
||||
import com.c202101080126.task1.model.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zhangping
|
||||
* @since 2024-09-14
|
||||
*/
|
||||
public interface UserService
|
||||
{
|
||||
public interface UserService {
|
||||
public void register(String username,String password);
|
||||
public String getPassword(String username);
|
||||
public List<User> getAllUsers();
|
||||
|
||||
List<Users> getAllUsers();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.BookMapper">
|
||||
<select id="getBooks" resultType="com.c202101080126.task1.model.Books">
|
||||
<select id="getBooks" resultType="com.c202101080126.task1.model.Book">
|
||||
select * from books202101080126
|
||||
</select>
|
||||
|
||||
<insert id="addBook" parameterType="com.c202101080126.task1.model.Books">
|
||||
<insert id="addBook" parameterType="com.c202101080126.task1.model.Book">
|
||||
insert into books202101080126(title,author,isbn,publisher,published_date) values(#{title},#{author},#{isbn},#{publisher},#{published_date})
|
||||
</insert>
|
||||
|
||||
|
@ -13,27 +13,32 @@
|
|||
delete from books202101080126 where id=#{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateBook" parameterType="com.c202101080126.task1.model.Books">
|
||||
<update id="updateBook" parameterType="com.c202101080126.task1.model.Book">
|
||||
update books202101080126 set title=#{title},author=#{author},isbn=#{isbn},publisher=#{publisher},published_date=#{published_date} where id=#{id}
|
||||
</update>
|
||||
|
||||
<select id="searchBooksbyTitle" parameterType="String" resultType="com.c202101080126.task1.model.Books">
|
||||
select * from books202101080126 where title like "%"#{title}"%"
|
||||
<select id="searchBookbyTitle" resultMap="book">
|
||||
select * from books202101080126 where title like '%${title}%'
|
||||
</select>
|
||||
|
||||
<select id="getBooks1" resultMap="book" >
|
||||
<select id="getBookByTitle" resultType="com.c202101080126.task1.model.Book">
|
||||
select * from books202101080126 where title=#{title}
|
||||
</select>
|
||||
|
||||
<select id="getBooks1" resultMap="book">
|
||||
select * from books202101080126
|
||||
</select>
|
||||
<resultMap id="book" type="com.c202101080126.task1.model.Books">
|
||||
<id property="id" column="id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="author" column="author"/>
|
||||
<result property="isbn" column="isbn"/>
|
||||
<result property="publisher" column="publisher"/>
|
||||
<result property="published_date" column="published_date"/>
|
||||
|
||||
<resultMap id="book" type="com.c202101080126.task1.model.Book">
|
||||
<id column="id" property="id"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="author" property="author"/>
|
||||
<result column="isbn" property="isbn"/>
|
||||
<result column="publisher" property="publisher"/>
|
||||
<result column="published_date" property="published_date"/>
|
||||
<collection property="reviewlist"
|
||||
column="id"
|
||||
select="com.c202101080126.task1.dao.ReviewsMapper.getReviewsByBookId"
|
||||
select="com.c202101080126.task1.dao.ReviewsMapper.getCommentByBookId"
|
||||
ofType="com.c202101080126.task1.model.Reviews">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
@ -41,29 +46,4 @@
|
|||
<select id="getBookByBookId" resultMap="book">
|
||||
select * from books202101080126 where id=#{id}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- property 实体类字段名字 column数据库字段名字-->
|
||||
<!-- <resultMap id="PersonMap1" type="com.zp.spring.springboot.model.Person">-->
|
||||
<!-- <id property="id" column="id"/>-->
|
||||
<!-- <result property="name" column="name"/>-->
|
||||
<!-- <result property="age" column="age"/>-->
|
||||
<!-- <association property="idCard"-->
|
||||
<!-- column="idcardid"-->
|
||||
<!-- select="com.zp.spring.springboot.dao.IdcardMapper.getIdcard"-->
|
||||
<!-- javaType="com.zp.spring.springboot.model.IdCard">-->
|
||||
|
||||
<!-- </association>-->
|
||||
|
||||
<!-- <collection property="orderList"-->
|
||||
<!-- column="id"-->
|
||||
<!-- select="com.zp.spring.springboot.dao.OrderMapper.getOrderByUserId"-->
|
||||
<!-- ofType="com.zp.spring.springboot.model.Order">-->
|
||||
|
||||
<!-- </collection>-->
|
||||
|
||||
<!-- </resultMap>-->
|
||||
<!-- </select>-->
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -2,58 +2,24 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.BorrowRecordsMapper">
|
||||
|
||||
<!-- <select id="getBorrowRecordsByUserId" resultMap="bookBorrow">-->
|
||||
<!-- select * from borrow_records202101080112 where userid=#{id}-->
|
||||
<!-- </select>-->
|
||||
<!-- <resultMap id="bookBorrow" type="com._202101080112.task1.model.BorrowRecords">-->
|
||||
<!-- <id column="id" property="id"/>-->
|
||||
<!-- <result column="userid" property="userid"/>-->
|
||||
<!-- <result column="bookid" property="bookid"/>-->
|
||||
<!-- <result column="borrow_date" property="borrowDate"/>-->
|
||||
<!-- <result column="return_date" property="returnDate"/>-->
|
||||
<!-- <association property="book"-->
|
||||
<!-- column="bookid"-->
|
||||
<!-- select="com._202101080112.task1.dao.BookMapper.getBookByBookId"-->
|
||||
<!-- javaType="com._202101080112.task1.model.Books">-->
|
||||
<!-- </association>-->
|
||||
<!-- </resultMap>-->
|
||||
|
||||
<select id="getBorrowRecords" resultMap="bookBorrow">
|
||||
select * from borrow_records202101080112
|
||||
</select>
|
||||
<resultMap id="bookBorrow" type="com.c202101080126.task1.model.BorrowRecords">
|
||||
<id column="id" property="id"/>
|
||||
<result column="userid" property="userid"/>
|
||||
<result column="bookid" property="bookid"/>
|
||||
<result column="borrow_date" property="borrowDate"/>
|
||||
<result column="return_date" property="returnDate"/>
|
||||
<association property="book"
|
||||
column="bookid"
|
||||
select="com._202101080112.task1.dao.BookMapper.getBookByBookId"
|
||||
javaType="com.c202101080126.task1.model.Books">
|
||||
</association>
|
||||
<association property="user"
|
||||
column="userid"
|
||||
select="com._202101080112.task1.dao.UserMapper.getUserById"
|
||||
javaType="com.c202101080126.task1.model.Users">
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="searchBorrowByBookId" resultMap="bookBorrow">
|
||||
select * from borrow_records202101080126 where bookid=#{id}
|
||||
<select id="getBorrowRecords" resultType="com.c202101080126.task1.model.BorrowRecords">
|
||||
select * from borrow_records202101080126
|
||||
</select>
|
||||
|
||||
<insert id="addBorrow" parameterType="com.c202101080126.task1.model.BorrowRecords">
|
||||
insert into borrow_records202101080126(userid,bookid,borrow_date,return_date,status) values(#{userid},#{bookid},#{borrowDate},#{returnDate},#{status})
|
||||
<insert id="addBorrowRecords" parameterType="com.c202101080126.task1.model.BorrowRecords">
|
||||
insert into borrow_records202101080126(bookid,userid,borrow_date,back_date) values(#{bookid},#{userid},#{borrowDate},#{backDate})
|
||||
</insert>
|
||||
<delete id="deleteborrow" parameterType="int">
|
||||
|
||||
<select id="searchBorrowRecordsbyId" resultType="com.c202101080126.task1.model.BorrowRecords">
|
||||
select * from borrow_records202101080126 where bookid=#{bookid}
|
||||
</select>
|
||||
|
||||
<delete id="deleteBorrowRecords" parameterType="Integer">
|
||||
delete from borrow_records202101080126 where id=#{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateborrow" parameterType="com.c202101080126.task1.model.BorrowRecords">
|
||||
update borrow_records202101080126 set borrow_date=#{borrowDate},return_date=#{returnDate},status=#{status} where id=#{id}
|
||||
<update id="updateBorrowRecords" parameterType="com.c202101080126.task1.model.BorrowRecords">
|
||||
update borrow_records202101080126 set bookid=#{bookid},userid=#{userid},borrow_date=#{borrowDate},back_date=#{backDate} where id=#{id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.LoginMapper">
|
||||
<insert id="register" parameterType="com.c202101080126.task1.model.Users">
|
||||
insert into users202101080126(username,password) values(#{username},#{password})
|
||||
</insert>
|
||||
</mapper>
|
|
@ -15,7 +15,7 @@
|
|||
<association property="book"
|
||||
column="bookid"
|
||||
select="com.c202101080126.task1.dao.BookMapper.getBookByBookId"
|
||||
javaType="com.c202101080126.task1.model.Books">
|
||||
javaType="com.c202101080126.task1.model.Book">
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
|
@ -34,9 +34,18 @@
|
|||
<select id="searchBooksbyTitle" resultMap="reviews">
|
||||
select * from reviews202101080126 where title like '%${title}%'
|
||||
</select>
|
||||
<select id="getCommentByBookId" resultType="com.c202101080126.task1.model.Reviews">
|
||||
select * from reviews202101080126 where bookid=#{bookid}
|
||||
</select>
|
||||
|
||||
<insert id="addreview" parameterType="com.c202101080126.task1.model.Reviews">
|
||||
insert into reviews202101080126(userid,bookid,comment) values(#{userid},#{bookid},#{comment})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
<!-- ofType="com.zp.spring.springboot.model.Order">-->
|
||||
|
||||
<!-- </collection>-->
|
||||
|
||||
<!-- </resultMap>-->
|
||||
<!-- </select>-->
|
|
@ -1,25 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.UserMapper">
|
||||
|
||||
<select id="getAllUsers" resultMap="usercomment">
|
||||
select * from users202101080126
|
||||
<insert id="register" parameterType="com.c202101080126.task1.model.User">
|
||||
insert into users202101080126(username,password) values(#{username},#{password})
|
||||
</insert>
|
||||
<select id="getPassword" parameterType="String" resultType="String">
|
||||
select password from users202101080126 where username=#{username}
|
||||
</select>
|
||||
<resultMap id="usercomment" type="com.c202101080126.task1.model.Users">
|
||||
<id column="id" property="id"/>
|
||||
<result column="username" property="username"/>
|
||||
<collection property="reviewlist"
|
||||
column="id"
|
||||
select="com.c202101080126.task1.dao.ReviewsMapper.getCommentByUserId"
|
||||
ofType="com.c202101080126.task1.model.Reviews">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getUserById" resultType="com.c202101080126.task1.model.Users">
|
||||
<select id="getUserById" parameterType="int" resultType="com.c202101080126.task1.model.User">
|
||||
select * from users202101080126 where id=#{id}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
|
@ -1,21 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>添加书籍评价页面</h1>
|
||||
|
||||
<form th:action="@{/addcomment}" method="post">
|
||||
<input type="id" name="id" th:value="${review.userid}" hidden="hidden"><br/></input>
|
||||
<!-- 下拉框显示所有书籍-->
|
||||
<select name="bookid">
|
||||
<option th:each="book:${books}" th:value="${book.id}" th:text="${book.title}"></option>
|
||||
</select>
|
||||
<input type="text" name="comment" placeholder="请输入评价"><br/></input>
|
||||
<input type="submit" value="增加书籍评价"></input>
|
||||
<h1>增加书本页面</h1>
|
||||
<form th:action="@{/addbook}" method="post">
|
||||
<input type="text" name="title" placeholder="书名"><br/>
|
||||
<input type="text" name="author" placeholder="作者"><br/>
|
||||
<input type="text" name="isbn" placeholder="ISBN号"><br/>
|
||||
<input type="text" name="publisher" placeholder="出版社">
|
||||
<input type="date" name="published_date" placeholder="出版日期"><br/>
|
||||
<input type="submit" value="增加书本"></input>
|
||||
</input>
|
||||
</form>
|
||||
<a th:href="@{/booklist}">增加书本</a>
|
||||
</body>
|
||||
</html>
|
|
@ -1,27 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>添加书本借阅页面</h1>
|
||||
|
||||
<h1>增加书本借阅页面</h1>
|
||||
<form th:action="@{/addborrow}" method="post">
|
||||
|
||||
<select name="userid">
|
||||
<option th:each="user:${users}" th:value="${user.id}" th:text="${user.username}"></option>
|
||||
</select><br/>
|
||||
|
||||
<select name="bookid">
|
||||
<option th:each="book:${books}" th:value="${book.id}" th:text="${book.title}"></option>
|
||||
</select><br/>
|
||||
|
||||
<input type="date" name="borrowDate" placeholder="借阅时间"><br>
|
||||
|
||||
<input type="date" name="returnDate" placeholder="归还时间"><br></br></input>
|
||||
<input type="int" name="userid" placeholder="用户id"><br/>
|
||||
<input type="int" name="bookid" placeholder="书籍id"><br/>
|
||||
<input type="date" name="borrowDate" placeholder="借阅时间"><br/></input>
|
||||
<input type="date" name="backDate" placeholder="归还时间"><br/></input>
|
||||
<input type="submit" value="增加书本借阅"></input>
|
||||
</input>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>添加书籍评价页面</h1>
|
||||
|
||||
<h1>增加书本评价页面</h1>
|
||||
<form th:action="@{/addcomment}" method="post">
|
||||
<input type="id" name="id" th:value="${review.userid}" hidden="hidden"><br/></input>
|
||||
|
||||
<select name="bookid">
|
||||
<option th:each="book:${books}" th:value="${book.id}" th:text="${book.title}"></option>
|
||||
</select>
|
||||
<input type="text" name="comment" placeholder="评价"><br/></input>
|
||||
<input type="text" name="userid" placeholder="用户id"><br/>
|
||||
<input type="int" name="bookid" placeholder="书籍id"><br/>
|
||||
<input type="text" name="comment" placeholder="评论"><br/>
|
||||
<input type="submit" value="增加书本评价"></input>
|
||||
</input>
|
||||
</form>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>书本管理页面</h1>
|
||||
<a th:href="@{/booklist}">查询书本</a>
|
||||
<a th:href="@{/addbookpage}">增加书本</a>
|
||||
<a th:href="@{/booklist}">查询书本</a>
|
||||
</body>
|
||||
</html>
|
|
@ -1,45 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>书本借阅页面</h1>
|
||||
|
||||
<form th:action="@{/borrowlist}" method="post">
|
||||
<input type="text" name="title" placeholder="书名">
|
||||
<input type="submit" value="搜索书本借阅"></input>
|
||||
</input>
|
||||
</form>
|
||||
<a th:href="@{/addborrowpage}">增加借阅书籍</a>
|
||||
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td>借阅人</td>
|
||||
<td>书名</td>
|
||||
<td>借阅时间</td>
|
||||
<td>归还时间</td>
|
||||
<td>状态</td>
|
||||
<td>删除</td>
|
||||
<td>更新</td>
|
||||
</tr>
|
||||
<tr th:each="borrow:${borrowRecords}">
|
||||
<td th:text="${borrow.id}"></td>
|
||||
<td th:text="${borrow.user.username}"></td>
|
||||
<td th:text="${borrow.book.title}"></td>
|
||||
<td th:text="${borrow.borrowDate}"></td>
|
||||
<td th:text="${borrow.returnDate}"></td>
|
||||
<td th:text="${borrow.status}"></td>
|
||||
<td>
|
||||
<a th:href="@{/deleteborrow(id=${borrow.id})}">删除</a>
|
||||
</td>
|
||||
<td>
|
||||
<a th:href="@{/updateborrow(id=${borrow.id},userid=${borrow.user.id},bookid=${borrow.book.id},borrowDate=${borrow.borrowDate},returnDate=${borrow.returnDate})}">更新</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,46 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>书本评价页面</h1>
|
||||
|
||||
<form th:action="@{/booklist}" method="post">
|
||||
<input type="text" name="title" placeholder="书名">
|
||||
<input type="submit" value="搜索书本评价"></input>
|
||||
</input>
|
||||
</form>
|
||||
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td>用户名</td>
|
||||
<td>书本评价</td>
|
||||
<td>增加书本评价</td>
|
||||
</tr>
|
||||
<tr th:each="user:${users}">
|
||||
<td th:text="${user.id}"></td>
|
||||
<td th:text="${user.username}"></td>
|
||||
<div th:if="${user.reviewlist}!=null">
|
||||
<td>
|
||||
<ul th:each="review:${user.reviewlist}">
|
||||
<li>
|
||||
<div th:text="${review.book.title}"></div>
|
||||
<div th:text="${review.comment}"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
</div>
|
||||
|
||||
<td>
|
||||
<a th:href="@{/addcommentpage(id=${user.id})}">增加书本评价</a>
|
||||
</td>
|
||||
<!-- <td>-->
|
||||
<!-- <a th:href="@{/updatebook(id=${book.id},title=${book.title},author=${book.author},isbn=${book.isbn},publisher=${book.publisher},published_date=${book.published_date})}">更新</a>-->
|
||||
<!-- </td>-->
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -5,26 +5,28 @@
|
|||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>图书管理页面</h1>
|
||||
|
||||
<h1>书本管理页面</h1>
|
||||
<form th:action="@{/booklist}" method="post">
|
||||
<input type="text" name="title" placeholder="请输入书名">
|
||||
<input type="submit" value="搜索书籍"></input>
|
||||
<input type="text" name="title" placeholder="书名">
|
||||
<input type="submit" value="搜索书本"></input>
|
||||
</input>
|
||||
</form>
|
||||
|
||||
<a th:href="@{/addbookpage}">添加书籍</a>
|
||||
<a th:href="@{/addbookpage}">增加书本</a>
|
||||
<a th:href="@{/addcommentpage}">增加书本评价</a>
|
||||
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td>书名</td>
|
||||
<td>作者</td>
|
||||
<td>isbn号</td>
|
||||
<td>ISBN号</td>
|
||||
<td>出版社</td>
|
||||
<td>出版时间</td>
|
||||
<td>评价</td>
|
||||
<td>删除书本</td>
|
||||
<td>更新书本</td>
|
||||
<td>出版日期</td>
|
||||
<td>评论</td>
|
||||
<td>删除操作</td>
|
||||
<td>更新操作</td>
|
||||
|
||||
</tr>
|
||||
<tr th:each="book:${books}">
|
||||
<td th:text="${book.id}"></td>
|
||||
|
@ -33,6 +35,8 @@
|
|||
<td th:text="${book.isbn}"></td>
|
||||
<td th:text="${book.publisher}"></td>
|
||||
<td th:text="${book.published_date}"></td>
|
||||
|
||||
|
||||
<div th:if="${book.reviewlist}!=null">
|
||||
<td>
|
||||
<ul th:each="review:${book.reviewlist}">
|
||||
|
@ -41,15 +45,15 @@
|
|||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
</div>
|
||||
|
||||
<td>
|
||||
<a th:href="@{/deletebook(id=${book.id})}">删除</a>
|
||||
</td>
|
||||
<td>
|
||||
<a th:href="@{/updatebook(id=${book.id},title=${book.title},author=${book.author},isbn=${book.isbn},publisher=${book.publisher},published_date=${book.published_date})}">更新</a>
|
||||
<a th:href="@{/updatebook(id=${book.id},title=${book.title},author=${book.author},
|
||||
isbn=${book.isbn},publisher=${book.publisher},published_date=${book.published_date})}">更新</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,16 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>登录页面</h1>
|
||||
<a th:href="@{/register}">没有账号?点击注册</a>
|
||||
<h1>登陆页面</h1>
|
||||
<a href="register">注册</a>
|
||||
<form th:action="@{/logincommit}" method="post">
|
||||
<input type="text" name="username" placeholder="请输入用户名"><br>
|
||||
<input type="password" name="password" placeholder="请输入密码"><br>
|
||||
<input type="submit" value="登录"></input>
|
||||
<input type="text" name="username" placeholder="用户名"><br/>
|
||||
<input type="text" name="password" placeholder="密码"><br/>
|
||||
<input type="submit" value="登陆"></input>
|
||||
</input>
|
||||
</form>
|
||||
</body>
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>登录失败</h1>
|
||||
<h1>登陆失败</h1>
|
||||
</body>
|
||||
</html>
|
|
@ -6,11 +6,12 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>注册页面</h1>
|
||||
<form th:action="@{/registercommit}" method="post">
|
||||
<input type="text" name="username" placeholder="请输入用户名"><br>
|
||||
<input type="password" name="password" placeholder="请输入密码"><br>
|
||||
<a href="register">注册</a>
|
||||
<form th:action="@{/registercommit}" method="post">
|
||||
<input type="text" name="username" placeholder="用户名"><br/>
|
||||
<input type="text" name="password" placeholder="密码"><br/>
|
||||
<input type="submit" value="注册"></input>
|
||||
</input>
|
||||
</form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>书本评价页面</h1>
|
||||
<a th:href="@{/book/reviewpage}">增加书本评价</a>
|
||||
<form th:action="@{/reviewlist}" method="post">
|
||||
<input type="text" name="title" placeholder="请输入评价">
|
||||
<input type="submit" value="搜索书本评价">
|
||||
</form>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td>id</td>
|
||||
|
||||
</tr>
|
||||
<tr th:each="review:${reviews}">
|
||||
<td th:text="${review.id}"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -5,16 +5,15 @@
|
|||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>更新书籍页面</h1>
|
||||
|
||||
<h1>更新书本页面</h1>
|
||||
<form th:action="@{/updatebookcommit}" method="post">
|
||||
<input type="id" name="id" th:value="${book.id}" hidden="hidden"><br/>
|
||||
<input type="text" name="title" placeholder="书名" th:value="${book.title}"><br/></input>
|
||||
<input type="text" name="author" placeholder="作者" th:value="${book.author}"><br/></input>
|
||||
<input type="text" name="isbn" placeholder="isbn号" th:value="${book.isbn}"><br/></input>
|
||||
<input type="text" name="publisher" placeholder="出版社" th:value="${book.publisher}"><br/></input>
|
||||
<input type="date" name="published_date" placeholder="出版时间" th:value="${book.published_date}"><br/></input>
|
||||
<input type="submit" value="更新书籍"></input>
|
||||
<input type="text" name="title" placeholder="书名" th:value="${book.title}"><br/>
|
||||
<input type="text" name="author" placeholder="年龄" th:value="${book.author}"><br/>
|
||||
<input type="text" name="isbn" placeholder="ISBN号" th:value="${book.isbn}"><br/>
|
||||
<input type="text" name="publisher" placeholder="出版社" th:value="${book.publisher}"><br/>
|
||||
<input type="date" name="published_date" placeholder="出版日期" th:value="${book.published_date}"><br/></input>
|
||||
<input type="submit" value="更新书本"></input>
|
||||
</input>
|
||||
</form>
|
||||
</body>
|
||||
|
|
|
@ -5,16 +5,15 @@
|
|||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>更新书籍借阅页面</h1>
|
||||
|
||||
<h1>更新书本借阅页面</h1>
|
||||
<form th:action="@{/updateborrowcommit}" method="post">
|
||||
<input type="id" name="id" th:value="${borrowRecord.id}" hidden="hidden">
|
||||
<input type="id" name="userid" th:value="${borrowRecord.userid}" hidden="hidden">
|
||||
<input type="id" name="bookid" th:value="${borrowRecord.bookid}" hidden="hidden">
|
||||
<input type="date" name="borrowDate" placeholder="借阅时间" th:value="${borrowRecord.borrowDate}"><br/>
|
||||
<input type="date" name="returnDate" placeholder="返还时间" th:value="${borrowRecord.returnDate}"><br/></input>
|
||||
<input type="text" name="status" placeholder="状态" th:value="${borrowRecord.status}"><br/></input>
|
||||
<input type="submit" value="更新借阅信息"></input>
|
||||
<input type="id" name="id" th:value="${borrow.id}" hidden="hidden"><br/>
|
||||
<input type="int" name="userid" placeholder="用户id" th:value="${borrow.userid}"><br/>
|
||||
<input type="int" name="bookid" placeholder="书籍id" th:value="${borrow.bookid}"><br/>
|
||||
<input type="date" name="borrowDate" placeholder="借阅时间" th:value="${borrow.borrowDate}"><br/></input>
|
||||
<input type="date" name="backDate" placeholder="归还时间" th:value="${borrow.backDate}"><br/></input>
|
||||
|
||||
<input type="submit" value="更新书本"></input>
|
||||
</input>
|
||||
</form>
|
||||
</body>
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.BookMapper">
|
||||
<select id="getBooks" resultType="com.c202101080126.task1.model.Books">
|
||||
select * from books202101080126
|
||||
</select>
|
||||
|
||||
<insert id="addBook" parameterType="com.c202101080126.task1.model.Books">
|
||||
insert into books202101080126(title,author,isbn,publisher,published_date) values(#{title},#{author},#{isbn},#{publisher},#{published_date})
|
||||
</insert>
|
||||
|
||||
<update id="updatebook" parameterType="com.c202101080126.task1.model.Books">
|
||||
update books202101080126 set title=#{title},author=#{author},isbn=#{isbn},publisher=#{publisher},published_date=#{published_date} where id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletebook" parameterType="int">
|
||||
delete from books202101080126 where id=#{id}
|
||||
</delete>
|
||||
|
||||
<select id="searchBooksbyTitle" resultMap="book">
|
||||
select * from books202101080126 where title like '%${title}%'
|
||||
</select>
|
||||
|
||||
<select id="getBookByTitle" resultType="com.c202101080126.task1.model.Books">
|
||||
select * from books202101080126 where title=#{title}
|
||||
</select>
|
||||
|
||||
<select id="getBooks1" resultMap="book">
|
||||
select * from books202101080126
|
||||
</select>
|
||||
<resultMap id="book" type="com.c202101080126.task1.model.Books">
|
||||
<id column="id" property="id"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="author" property="author"/>
|
||||
<result column="isbn" property="isbn"/>
|
||||
<result column="publisher" property="publisher"/>
|
||||
<result column="published_date" property="published_date"/>
|
||||
<collection property="reviewlist"
|
||||
column="id"
|
||||
select="com.c202101080126.task1.dao.ReviewsMapper.getCommentByBookId"
|
||||
ofType="com.c202101080126.task1.model.Reviews">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getBookByBookId" resultMap="book">
|
||||
select * from books202101080126 where id=#{id}
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.BorrowRecordsMapper">
|
||||
|
||||
|
||||
<select id="getBorrowRecords" resultMap="bookBorrow">
|
||||
select * from borrow_records202101080126
|
||||
</select>
|
||||
<resultMap id="bookBorrow" type="com.c202101080126.task1.model.BorrowRecords">
|
||||
<id column="id" property="id"/>
|
||||
<result column="userid" property="userid"/>
|
||||
<result column="bookid" property="bookid"/>
|
||||
<result column="borrow_date" property="borrowDate"/>
|
||||
<result column="return_date" property="returnDate"/>
|
||||
<association property="book"
|
||||
column="bookid"
|
||||
select="com.c202101080126.task1.dao.BookMapper.getBookByBookId"
|
||||
javaType="com.c202101080126.task1.model.Books">
|
||||
</association>
|
||||
<association property="user"
|
||||
column="userid"
|
||||
select="com._202101080112.task1.dao.UserMapper.getUserById"
|
||||
javaType="com.c202101080126.task1.model.Users">
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="searchBorrowByBookId" resultMap="bookBorrow">
|
||||
select * from borrow_records202101080126 where bookid=#{id}
|
||||
</select>
|
||||
|
||||
<insert id="addBorrow" parameterType="com.c202101080126.task1.model.BorrowRecords">
|
||||
insert into borrow_records202101080126(userid,bookid,borrow_date,return_date,status) values(#{userid},#{bookid},#{borrowDate},#{returnDate},#{status})
|
||||
</insert>
|
||||
<delete id="deleteborrow" parameterType="int">
|
||||
delete from borrow_records202101080126 where id=#{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateborrow" parameterType="com.c202101080126.task1.model.BorrowRecords">
|
||||
update borrow_records202101080126 set borrow_date=#{borrowDate},return_date=#{returnDate},status=#{status} where id=#{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.LoginMapper">
|
||||
|
||||
<insert id="register" parameterType="com.c202101080126.task1.model.Users">
|
||||
insert into users202101080126(username,password) values(#{username},#{password})
|
||||
</insert>
|
||||
|
||||
<select id="getPassword" resultType="String">
|
||||
select password from users202101080126 where username=#{username}
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.ReviewsMapper">
|
||||
|
||||
<select id="getReviewsByBookId" resultType="com.c202101080126.task1.model.Reviews">
|
||||
select * from reviews202101080126 where bookid=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getCommentByUserId" resultMap="bookreview">
|
||||
select * from reviews20210108026 where userid=#{id}
|
||||
</select>
|
||||
<resultMap id="bookreview" type="com.c202101080126.task1.model.Reviews">
|
||||
<id column="id" property="id"/>
|
||||
<result column="bookid" property="bookid"/>
|
||||
<result column="review" property="comment"/>
|
||||
<association property="book"
|
||||
column="bookid"
|
||||
select="com.c202101080126.task1.dao.BookMapper.getBookByBookId"
|
||||
javaType="com.c202101080126.task1.model.Books">
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getreviews" resultMap="reviews">
|
||||
select * from reviews202101080126
|
||||
</select>
|
||||
<resultMap id="reviews" type="com.c202101080126.task1.model.Reviews">
|
||||
<id column="id" property="id"/>
|
||||
<result column="bookid" property="bookid"/>
|
||||
<result column="review" property="comment"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="searchBooksbyTitle" resultMap="reviews">
|
||||
select * from reviews202101080126 where title like '%${title}%'
|
||||
</select>
|
||||
|
||||
<insert id="addreview" parameterType="com.c202101080126.task1.model.Reviews">
|
||||
insert into reviews202101080126(userid,bookid,comment) values(#{userid},#{bookid},#{review})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.c202101080126.task1.dao.UserMapper">
|
||||
<select id="getAllUsers" resultMap="usercomment">
|
||||
select * from users202101080126
|
||||
</select>
|
||||
<resultMap id="usercomment" type="com.c202101080126.task1.model.Users">
|
||||
<id column="id" property="id"/>
|
||||
<result column="username" property="username"/>
|
||||
<collection property="reviewlist"
|
||||
column="id"
|
||||
select="com._202101080112.task1.dao.ReviewsMapper.getCommentByUserId"
|
||||
ofType="com.c202101080126.task1.model.Reviews">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getUserById" resultType="com.c202101080126.task1.model.Users">
|
||||
select * from users202101080126 where id=#{id}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue