xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡(jiǎn)介

小型圖書(shū)管理系統(tǒng) 用的是SSH框架寫(xiě)的 基于Struts2+Spring+Hibernate+Mysql架構(gòu)

資源截圖

代碼片段和文件信息

package?com.hpit.action;

import?java.io.IOException;
import?java.util.HashMap;
import?java.util.List;
import?java.util.Map;

import?org.apache.struts2.ServletActionContext;

import?com.alibaba.fastjson.JSON;
import?com.hpit.bean.Book;
import?com.hpit.bean.BookType;
import?com.hpit.service.BookService;
import?com.hpit.service.BookTypeService;
import?com.hpit.util.PageBean;
import?com.opensymphony.xwork2.ActionSupport;
import?com.opensymphony.xwork2.ModelDriven;

/**
?*?@author?作者:12845
?*?@version?創(chuàng)建時(shí)間:2017年12月14日
?*?說(shuō)明:
?*/
public?class?BookAction?extends?ActionSupport?implements?ModelDriven{
private?static?final?long?serialVersionUID?=?1L;
private?Book?book?=?new?Book();
@Override
public?Book?getModel()?{
return?book;
}
private?BookTypeService?bookTypeService;
public?void?setBookTypeService(BookTypeService?bookTypeService)?{
this.bookTypeService?=?bookTypeService;
}
private?BookService?bookService;
public?void?setBookService(BookService?bookService)?{
this.bookService?=?bookService;
}

//條件
private?Integer?type;
private?String?bookName;
private?Integer?pageNo;

public?Integer?getType()?{
return?type;
}
public?void?setType(Integer?type)?{
this.type?=?type;
}
public?String?getBookName()?{
return?bookName;
}
public?void?setBookName(String?bookName)?{
this.bookName?=?bookName;
}
public?Integer?getPageNo()?{
return?pageNo;
}
public?void?setPageNo(Integer?pageNo)?{
this.pageNo?=?pageNo;
}


public?String?getBookByPage()?{
/*System.out.println(“type????“+this.getType());
System.out.println(“bookName????“+this.getBookName());
System.out.println(“pageNo????“+this.getPageNo());*/

Mapject>?map?=?new?HashMapject>();
StringBuffer?sb?=?new?StringBuffer();
sb.append(“from?Book??where?1=1?“);
if?(this.getType()!=null&&this.getType()!=-1)?{
sb.append(“?and?bookType.id=:type?“);
map.put(“type“?this.getType());
}
if?(this.getBookName()!=null&&!this.getBookName().trim().equals(““))?{
sb.append(“?and?name?like:bookName?“);
map.put(“bookName“?“%“+this.getBookName()+“%“);
}
String?row_hql=“select?count(*)?“+sb.toString();
String?list_hql=sb.toString();

Integer?pageSize=3;
PageBean?pb?=?bookService.getBookByPage(row_hql?list_hql?this.getPageNo()?pageSize?map);
ServletActionContext.getRequest().getSession().setAttribute(“pb“?pb);

List?bList?=?bookTypeService.getBookTypeList();
ServletActionContext.getRequest().getSession().setAttribute(“typeList“?bList);
return?“success“;
}

public?void?typelist()?throws?IOException?{
ServletActionContext.getResponse().setContentType(“allication/json;charset=UTF-8“);
List?bList?=?bookTypeService.getBookTypeList();
String?jsonStr=JSON.toJSONString(bList);
ServletActionContext.getResponse().getWriter().println(jsonStr);
}

//提示成功信息
private?Mapject>?m

評(píng)論

共有 條評(píng)論