91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 19.91MB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-06
  • 語言: 數據庫
  • 標簽: SSH框架??

資源簡介

小型圖書管理系統 用的是SSH框架寫的 基于Struts2+Spring+Hibernate+Mysql架構

資源截圖

代碼片段和文件信息

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?創建時間:2017年12月14日
?*?說明:
?*/
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

評論

共有 條評論