📄 bookshelfaction.java
字号:
package com.olr.control.space;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import com.olr.BO.SpaceBO;
import com.olr.beans.User;
import com.olr.control.common.PageAction;
import com.olr.util.Constants;
import com.olr.util.Pager;
public class BookshelfAction extends PageAction{
private SpaceBO spaceBO;
private int bookId;
private String bookname;
private String writer;
private String category;
private Date updateTime;
private String lastChapter;
private Integer chapterCount;
private User spaceOwner;
private int userId;
private Pager bookshelfPager;
//初始化分页数据
public String init(){
this.clearErrorsAndMessages();
String spaceOwnerName=(String) this.getSession("spaceOwnerName");
spaceOwner=this.getSpaceBO().getUser(spaceOwnerName);
userId=spaceOwner.getUserId();
super.pageSize=Constants.pageSize;
super.pageNo=Constants.pageNo;
super.pager=this.getSpaceBO().getBookshelfPager(userId, pageNo, pageSize);
bookshelfPager=super.pager;
//this.setSession("bookshelfPager", super.pager);
return "list";
}
//显示用户所有藏书
public String list() {
this.clearErrorsAndMessages();
super.pager=this.getSpaceBO().getBookshelfPager(userId, pageNo, pageSize);
bookshelfPager=super.pager;
//this.setSession("bookshelfPager", super.pager);
return "list";
}
//删除用户藏书
public String delete() {
Map m=this.getParameterMap();
Set bookIdSet=m.keySet();
if ( m.size()==0 )
{
this.addFieldError("deleteFormShelf", "没有书籍被选择!");
return "list";
}
this.getSpaceBO().deleteFormShelf(userId, bookIdSet);
return this.list();
}
//加入收藏
public String addToBookShelf(int userId,int bookId) {
this.getSpaceBO().addToShelf(userId, bookId);
return this.list();
}
public SpaceBO getSpaceBO() {
return spaceBO;
}
public void setSpaceBO(SpaceBO spaceBO) {
this.spaceBO = spaceBO;
}
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public String getBookname() {
return bookname;
}
public void setBookname(String bookname) {
this.bookname = bookname;
}
public String getWriter() {
return writer;
}
public void setWriter(String writer) {
this.writer = writer;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getLastChapter() {
return lastChapter;
}
public void setLastChapter(String lastChapter) {
this.lastChapter = lastChapter;
}
public Integer getChapterCount() {
return chapterCount;
}
public void setChapterCount(Integer chapterCount) {
this.chapterCount = chapterCount;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -