源码获取:俺的博客首页 "资源" 里下载!
项目介绍
基于SSM的图书借阅管理系统
角色:管理员、用户
用户功能:用户进入系统可以对主页,个人中心,借阅证件管理,挂失信息管理,图书信息管理,借书信息管理,归还信息管理,续借信息管理,图书挂失管理,催还信息管理等功能进行操作;
管理员功能包括主页,个人中心,用户管理,借阅证件管理,挂失信息管理,图书信息管理,图书分类管理,借书信息管理,归还信息管理,续借信息管理,图书挂失管理,催还信息管理等;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目;
6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis)
前端:JSP+CSS+JS+JQUERY+Layui
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
3. 将项目中db.xml配置文件中的数据库配置改为自己的配置,然后运行;
图书管理控制层:
@Controller
@RequestMapping("/book")
@RequiresRoles(value={"BookManager","SysManager","Manager"},logical=Logical.OR)
public class BookController {
@Autowired
private BookService bookService;//图书服务
@Autowired
private BookClassService bookClassService;//图书编目服务
/**
* @Title : intoBook
* @功能描述: TODO 进入图书信息录入的界面
* @开发者:陈强
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequiresPermissions(value={"book:toBook","iterm:all"},logical=Logical.OR)
@RequestMapping("/toBook")
public String intoBook(Model model)
{
List<BookClass> bookClassList=bookClassService.selectAllBkCatalog();
model.addAttribute("classList",bookClassList);
return "WEB-INF/bookJsp/book";
}
/**
* @Title : InsertBook
* @功能描述: TODO 保存图书信息
* @开发者:陈强
* @参数: @param book
* @参数: @param br
* @参数: @param datePress
* @参数: @param dateIn
* @参数: @param file
* @参数: @param request
* @参数: @param response
* @参数: @param model
* @参数: @return
* @参数: @throws ParseException
* @参数: @throws IllegalStateException
* @参数: @throws IOException
* @返回类型:String
* @throws :
*/
@SuppressWarnings("unused")
@RequestMapping(value="/insertBook",method={RequestMethod.POST,RequestMethod.GET})
@RequiresPermissions(value={"book:insertBook","iterm:all"},logical=Logical.OR)
public String InsertBook(@Validated Book book,BindingResult br,@RequestParam("DatePress")String datePress,
@RequestParam("DateIn")String dateIn,@RequestParam(value="file",required=false)MultipartFile file,
HttpServletRequest request,HttpServletResponse response,Model model) throws ParseException, IllegalStateException, IOException
{
book.setBkDatePress(DateExchangeUtil.StringToDate(datePress));
book.setBkDateIn(DateExchangeUtil.StringToDate(dateIn));
if(br.hasErrors())
{
List<ObjectError> errors=br.getAllErrors();
for(ObjectError error:errors)
{
model.addAttribute("message",error.getDefaultMessage());
}
return "error";
}
String path=request.getSession().getServletContext().getRealPath("upload")+"/book";
String fileName=file.getOriginalFilename();
String fileType=file.getContentType();
File targetFile = new File(path, fileName);
if(file==null)
{
book.setBkCover("upload/book/empty.jpg");
}
else
{
if(fileType.equals("image/jpeg") ||fileType.equals("image/pjpeg")||fileType.equals("image/gif"))
{
book.setBkCover("upload/book/"+fileName);
file.transferTo(targetFile);
}
else
{
book.setBkCover("upload/book/empty.jpg");
}
}
bookService.insertBook(book);
return "redirect:/book/toBook";
}
/**
* @Title : FindBookInfo
* @功能描述: TODO 图书信息展示
* @开发者:陈强
* @参数: @param parameter url传递的参数
* @参数: @param model
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping(value="/findBookInfo",method={RequestMethod.POST,RequestMethod.GET})
@RequiresPermissions(value={"book:findBookInfo","iterm:all"},logical=Logical.OR)
public String FindBookInfo(Parameter parameter,Model model)
{
int count=bookService.getCounts(parameter);
int start=parameter.getStart();
if(start<0)start=0;
if(start>count)start-=10;
int end=start+10;
parameter.setStart(start);
parameter.setEnd(end);
List<Book>bookList=this.bookService.selectBook(parameter);
model.addAttribute("BookList",bookList);
model.addAttribute("parameter", parameter);
return "WEB-INF/bookJsp/bookInfo";
}
/**
* @Title : DeleteBook
* @功能描述: TODO 删除图书
* @开发者:陈强
* @参数: @param parameter
* @参数: @param ra
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/deleteBook")
@RequiresPermissions(value={"book:deleteBook","iterm:all"},logical=Logical.OR)
public String DeleteBook(Parameter parameter ,RedirectAttributes ra)
{
bookService.deleteBookByID(parameter.getBkID());
ra.addAttribute("start", parameter.getStart());
return "redirect:/book/findBookInfo";
}
/**
* @Title : SearchBook
* @功能描述: TODO 查找图书
* @开发者:陈强
* @参数: @param parameter
* @参数: @param ra
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequiresPermissions(value={"book:searchBook","iterm:all"},logical=Logical.OR)
@RequestMapping(value="/searchBook",method={RequestMethod.POST,RequestMethod.GET})
public String SearchBook(Parameter parameter,RedirectAttributes ra)
{
System.out.println(parameter.getBkName());
ra.addAttribute("start", parameter.getStart());
ra.addAttribute("bkName", parameter.getBkName());
return "redirect:/book/findBookInfo";
}
/**
* @Title : EditBook
* @功能描述: TODO 跳转到图书信息编辑界面
* @开发者:陈强
* @参数: @param parameter
* @参数: @param model
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequiresPermissions(value={"book:editBook","iterm:all"},logical=Logical.OR)
@RequestMapping("/editBook")
public String EditBook(Parameter parameter,Model model)
{
List<Book> bookList=bookService.selectBook(parameter);
model.addAttribute("book", bookList.get(0));
List<BookClass> bookClassList=bookClassService.selectAllBkCatalog();
model.addAttribute("classList",bookClassList);
return "WEB-INF/bookJsp/bookEdit";
}
@SuppressWarnings("unused")
@RequiresPermissions(value={"book:updateBook","iterm:all"},logical=Logical.OR)
@RequestMapping(value="/updateBook",method={RequestMethod.POST,RequestMethod.GET})
public String updateBook(@Validated Book book,BindingResult br,@RequestParam("DatePress")String datePress,
@RequestParam("DateIn")String dateIn,@RequestParam(value="file",required=false)MultipartFile file,
HttpServletRequest request,HttpServletResponse response,Model model) throws ParseException, IllegalStateException, IOException
{
book.setBkDatePress(DateExchangeUtil.StringToDate(datePress));
book.setBkDateIn(DateExchangeUtil.StringToDate(dateIn));
if(br.hasErrors())
{
List<ObjectError> errors=br.getAllErrors();
for(ObjectError error:errors)
{
model.addAttribute("message",error.getDefaultMessage());
}
return "error";
}
String path=request.getSession().getServletContext().getRealPath("upload")+"/book";
String fileName=file.getOriginalFilename();
String fileType=file.getContentType();
File targetFile = new File(path, fileName);
if(file==null)
{
book.setBkCover("upload/book/empty.jpg");
}
else
{
if(fileType.equals("image/jpeg") ||fileType.equals("image/pjpeg")||fileType.equals("image/gif"))
{
book.setBkCover("upload/book/"+fileName);
file.transferTo(targetFile);
}
else
{
book.setBkCover("upload/book/empty.jpg");
}
}
bookService.updateBookByID(book);
return "index";
}
/**
* @Title : ExportExcel
* @功能描述: TODO 导出数据
* @开发者:陈强
* @参数: @param parameter
* @参数: @param request
* @参数: @param response
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/exportBook")
public String ExportExcel(Parameter parameter,HttpServletRequest request,HttpServletResponse response)
{
System.out.println(parameter.getStart());
parameter.setEnd(parameter.getStart()+10);
List<Book> bookList=bookService.selectBook(parameter);
ExportExcelUtil ex = new ExportExcelUtil();
String title="图书信息表";
String[] headers ={"图书序号","图书编号","书名","作者","出版社","出版日期","ISBN书号","分类号","语言","页数","价格","入馆日期","内容简介","图书状态","图书封面"};
List<String[]> dataset=new ArrayList<String[]>();
for(int i=0;i<bookList.size();i++)
{
Book book=bookList.get(i);
dataset.add(new String[]{book.getBkID(),book.getBkCode(),book.getBkName(),book.getBkAuthor(),
book.getBkPress(),DateExchangeUtil.DateToString(book.getBkDatePress()),
book.getBkISBN(),book.getBkCatalog(),book.getBkLanguage(),Integer.toString(book.getBkPages()),
book.getBkPrice(),DateExchangeUtil.DateToString(book.getBkDateIn()),book.getBkBrief(),book.getBkStatus(),book.getBkCover()});
}
OutputStream out = null;//创建一个输出流对象
try {
out = response.getOutputStream();//
response.setHeader("Content-disposition","attachment; filename="+"book.xls");//filename是下载的xls的名,建议最好用英文
response.setContentType("application/msexcel;charset=UTF-8");//设置类型
response.setHeader("Pragma","No-cache");//设置头
response.setHeader("Cache-Control","no-cache");//设置头
response.setDateHeader("Expires", 0);//设置日期头
String rootPath = request.getSession().getServletContext().getRealPath("/");
ex.exportExcel(rootPath,title,headers, dataset, out);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
try{
if(out!=null){
out.close();
}
}catch(IOException e){
e.printStackTrace();
}
}
return "";
}
}
用户登录管理控制层:
@Controller
@RequestMapping("/Userlogin")
public class UserLoginController {
@Autowired
private UserLoginMapper userLoginMapper;
@Autowired
private UserRealm userRealm;
/**
* @throws IOException
* @throws ServletException
* @Title : createIdentity
* @功能描述: TODO 产生验证码
* @开发者:陈强
* @参数:
* @返回类型:void
*/
@RequestMapping("/identity")
public void createIdentity(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException
{
//com.chen.PLoveLibrary.util.IdentityCode.outputIdentity(request, response);
}
/**
* @Title : Login
* @功能描述: TODO 登陆验证
* @开发者:陈强
* @参数: @param request
* @参数: @param response
* @参数: @param user
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping(value="/login" ,method=RequestMethod.POST)
public String Login(HttpServletRequest request,HttpServletResponse response,SysUser user)
{
/*if(user.getIdentity().equals(request.getSession().getAttribute("randomString")))
{*/
org.apache.shiro.subject.Subject subject=SecurityUtils.getSubject();
UsernamePasswordToken token=new UsernamePasswordToken(user.getUsername(), user.getPassword());
if(!subject.isAuthenticated())
{
subject.login(token);
}
/*}
else
{
return "login";
}*/
request.getSession().setAttribute("admin",user.getUsername());
//将登陆的用户信息存储在session中
Reader reader=userLoginMapper.selectSysUser(user.getUsername());
request.getSession().setAttribute("SysReader",reader);
//model.addAttribute("admin",user.getUsername());
return "frame/frameSet";
}
/**
* @Title : logOut
* @功能描述: TODO 用户注销登陆
* @开发者:陈强
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/logout")
public String logOut()
{
userRealm.clearCached();
return "login";
}
/**
* @Title : login
* @功能描述: TODO 返回后台登陆界面
* @开发者:陈强
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/index")
public String login()
{
return "login";
}
/**
* @throws Exception
* @Title : passwordEdit
* @功能描述: TODO 用户修改密码
* @开发者:陈强
* @参数: @param user
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping(value="/pwdEdit",method=RequestMethod.POST)
public String passwordEdit(SysUser user) throws Exception
{
int i=0;
user.setDate(new Date());
i=userLoginMapper.updatepwdByName(user);
userLoginMapper.updatePwd(user);
if(i==0)
{
throw new Exception("密码修改失败");
}
return "frame/mainFrame";
}
//*********************************************************
// * 权限设置
// *
// *
// *
// *
// ********************************************************
/**
* @Title : comePermission
* @功能描述: TODO 进入权限注册界面
* @开发者:陈强
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("toReaderPermission")
@RequiresPermissions(value={"permission:toReaderPermission","iterm:all"},logical=Logical.OR)
public String comePermission()
{
return "WEB-INF/readerJsp/readerPermission";
}
/**
* @Title : InsertPermission
* @功能描述: TODO 插入权限
* @开发者:陈强
* @参数: @param sysUR
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping(value="insertPermission",method={RequestMethod.GET,RequestMethod.POST})
@RequiresPermissions(value={"permission:insertPermission","iterm:all"},logical=Logical.OR)
public String InsertPermission(SysUR sysUR)
{
userLoginMapper.insertPermission(sysUR);
return "index";
}
/**
* @Title : selectPermission
* @功能描述: TODO 遍历信息
* @开发者:陈强
* @参数: @param parameter
* @参数: @param model
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping(value="selectPermission")
@RequiresPermissions(value={"permission:selectPermission","iterm:all"},logical=Logical.OR)
public String selectPermission(Parameter parameter,Model model)
{
int count=userLoginMapper.getCountsPermission();
int start=parameter.getStart();
if(start<0)start=0;
if(start>count)start-=10;
int end=start+10;
parameter.setEnd(end);
parameter.setStart(start);
List<SysUR> permission=userLoginMapper.selectPermission(parameter);
model.addAttribute("permission", permission);
model.addAttribute("parameter", parameter);
return "WEB-INF/readerJsp/permissionPage";
}
@RequestMapping(value="deletePermission")
@RequiresPermissions(value={"permission:deletePermission","iterm:all"},logical=Logical.OR)
public String DeletePermission(Parameter parameter,RedirectAttributes ra,SysUR sysUR)
{
userLoginMapper.deletePermission(sysUR);
ra.addAttribute("start", parameter.getStart());
return "redirect:/Userlogin/selectPermission";
}
}
读者管理控制层:
@Controller
@RequestMapping("/reader")
@RequiresRoles(value={"BookManager","SysManager","Manager"},logical=Logical.OR)
public class ReaderController {
@Autowired
private ReaderService readerService;
@Autowired
private UserLoginMapper userLoginMapper;
/**
* @Title : comeReader
* @功能描述: TODO 进入读者信息录入界面
* @开发者:陈强
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/toReader")
@RequiresPermissions(value={"reader:toReader","iterm:all"},logical=Logical.OR)
public String comeReader()
{
return "WEB-INF/readerJsp/readerLoad";
}
/**
* @Title : ReaderLoad
* @功能描述: TODO
* @开发者:陈强
* @参数: @param reader
* @参数: @param br
* @参数: @param file
* @参数: @param model
* @参数: @param request
* @参数: @return
* @参数: @throws Exception
* @返回类型:String
* @throws :
*/
@RequestMapping(value="/readerLoad",method={RequestMethod.POST,RequestMethod.POST})
@RequiresPermissions(value={"reader:readerLoad","iterm:all"},logical=Logical.OR)
@SuppressWarnings("unused")
public String ReaderLoad(@Validated Reader reader,BindingResult br,
@RequestParam(value="filePhoto",required=false)MultipartFile file,
Model model,HttpServletRequest request) throws Exception
{
if(br.hasErrors())
{
List<ObjectError> errors=br.getAllErrors();
for(ObjectError error:errors)
{
model.addAttribute("message",error.getDefaultMessage());
}
return "error";
}
int i=0;
String path=request.getSession().getServletContext().getRealPath("upload");
String fileName=file.getOriginalFilename();
String fileType=file.getContentType();
File targetFile = new File(path, fileName);
if(file==null)
{
reader.setRdPhoto("upload/empty.jpg");
}
else
{
if(fileType.equals("image/jpeg") ||fileType.equals("image/pjpeg")||fileType.equals("image/gif"))
{
reader.setRdPhoto("upload/"+fileName);
file.transferTo(targetFile);
}
else
{
reader.setRdPhoto("upload/empty.jpg");
}
}
reader.setRdDateReg(new Date());
i=readerService.insertReader(reader);
if(i==0)
{
throw new Exception("业务办理失败");
}
userLoginMapper.insertSysUser(reader);
model.addAttribute("reader",reader);
return "WEB-INF/readerJsp/readerLoad";
}
/**
* @Title : FindReader
* @功能描述: TODO 查找reader信息实现数据库的分页。
* @开发者:陈强
* @参数: @param start
* @参数: @param model
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/findReader")
@RequiresPermissions(value={"reader:findReader","iterm:all"},logical=Logical.OR)
public String FindReader(Model model,Parameter parameter)
{
int count=readerService.getCounts(parameter);
int start=parameter.getStart();
if(start<0) start=0;
if(start>count)start-=10;
int end=start+10;
parameter.setStart(start);
parameter.setEnd(end);
List<Reader> readerList=readerService.getReaderInfo(parameter);
model.addAttribute("readerList",readerList);
model.addAttribute("start", start);
model.addAttribute("rdID", parameter.getRdID());
return "WEB-INF/readerJsp/readerPage";
}
/**
* @Title : DeleteReader
* @功能描述: TODO 删除用户的信息,在重定向页面
* @开发者:陈强
* @参数: @param rdID
* @参数: @param start
* @参数: @param model
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("deleteReader")
@RequiresPermissions(value={"reader:deleteReader","iterm:all"},logical=Logical.OR)
public String DeleteReader(@RequestParam("rdID")String rdID,@RequestParam(value="start")Integer start,Model model,RedirectAttributes rab)
{
readerService.deleteReaderByrdID(rdID);
userLoginMapper.deleteSysUser(rdID);
SysUR sysUR=new SysUR();
sysUR.setUserName(rdID);
userLoginMapper.deletePermission(sysUR);
System.out.println(rdID);
rab.addAttribute("start", start);
return "redirect:/reader/findReader";
}
/**
* @Title : EditReader
* @功能描述: TODO 读者信息编辑 跳转到读者信息注册界面
* @开发者:陈强
* @参数: @param model
* @参数: @param rdID 用户名
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/editReader/{rdID}")
@RequiresPermissions(value={"reader:editReader","iterm:all"},logical=Logical.OR)
public String EditReader(Model model,@PathVariable String rdID,@RequestParam(value="start")Integer start)
{
Reader reader=readerService.findReaderByrdID(rdID);
model.addAttribute("editReader", reader);
model.addAttribute("start", start);
return "WEB-INF/readerJsp/readerPage";
}
/**
* @Title : UpdateReader
* @功能描述: TODO 编辑读者信息
* @开发者:陈强
* @参数: @param reader 读者类
* @参数: @param file 文件上传
* @参数: @param ra 重定向
* @参数: @param start 页码
* @参数: @param request
* @参数: @return
* @参数: @throws IllegalStateException
* @参数: @throws IOException
* @返回类型:String
* @throws :
*/
@SuppressWarnings("unused")
@RequiresPermissions(value={"reader:updateReader","iterm:all"},logical=Logical.OR)
@RequestMapping(value="/updateReader/{start}",method={RequestMethod.POST,RequestMethod.GET})
public String UpdateReader(@Validated Reader reader,BindingResult br,
@RequestParam(value="filePhoto",required=false)MultipartFile file,
RedirectAttributes ra,
@PathVariable Integer start,
HttpServletRequest request,Model model) throws IllegalStateException, IOException
{
if(br.hasErrors())
{
List<ObjectError> errors=br.getAllErrors();
for(ObjectError error:errors)
{
model.addAttribute("message",error.getDefaultMessage());
}
return "error";
}
int i=0;
String path=request.getSession().getServletContext().getRealPath("upload");
String fileName=file.getOriginalFilename();
String fileType=file.getContentType();
File targetFile = new File(path, fileName);
if(file==null)
{
reader.setRdPhoto("upload/empty.jpg");
}
else
{
if(fileType.equals("image/jpeg") ||fileType.equals("image/pjpeg")||fileType.equals("image/gif"))
{
reader.setRdPhoto("upload/"+fileName);
file.transferTo(targetFile);
}
else
{
reader.setRdPhoto("upload/empty.jpg");
}
}
reader.setRdDateReg(new Date());
System.out.println(reader.getRdID());
i=readerService.updateReaderByrdID(reader);
userLoginMapper.updateSysUser(reader);
ra.addAttribute("start", start);
return "redirect:/reader/findReader";
}
/**
* @Title : SearchReader
* @功能描述: TODO 查找指定的用户
* @开发者:陈强
* @参数: @param rdID
* @参数: @param model
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping(value="/searchReader", method={RequestMethod.POST,RequestMethod.GET})
@RequiresPermissions(value={"reader:searchReader","iterm:all"},logical=Logical.OR)
public String SearchReader(@RequestParam("rdID")String rdID,RedirectAttributes ra)
{
ra.addAttribute("rdID",rdID);
ra.addAttribute("start", 0);
return "redirect:/reader/findReader";
}
/**
* @Title : ExportExcel
* @功能描述: TODO 将数据导出
* @开发者:陈强
* @参数: @param parameter
* @参数: @param request
* @参数: @param response
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/exportExcel")
public String ExportExcel(Parameter parameter,HttpServletRequest request,HttpServletResponse response)
{
int start=parameter.getStart();
int end=start+10;
parameter.setStart(start);
parameter.setEnd(end);
List<Reader> readerList=readerService.getReaderInfo(parameter);
ExportExcelUtil ex = new ExportExcelUtil();
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
String title = "Reader信息记录";
String[] headers = { "用户名","姓名","性别","读者类型","单位名称","电话号码","邮箱","证件状态","办证日期","已借书数量","读者角色","照片"};
List<String[]> dataset = new ArrayList<String[]>();
for(int i=0;i<readerList.size();i++)
{
Reader reader=readerList.get(i);
String borrowQty=Integer.toString(reader.getRdBorrowQty());
String date=format.format(reader.getRdDateReg());
dataset.add(new String[]{reader.getRdID(),reader.getRdName(),reader.getRdSex(),reader.getRdType(),
reader.getRdDept(),reader.getRdPhone(),reader.getRdEmail(),reader.getRdStatus(),
date,borrowQty,reader.getRdAdminRoles(),reader.getRdPhoto()});
System.out.println(reader.getRdID());
}
OutputStream out = null;//创建一个输出流对象
try {
out = response.getOutputStream();//
response.setHeader("Content-disposition","attachment; filename="+"Reader.xls");//filename是下载的xls的名,建议最好用英文
response.setContentType("application/msexcel;charset=UTF-8");//设置类型
response.setHeader("Pragma","No-cache");//设置头
response.setHeader("Cache-Control","no-cache");//设置头
response.setDateHeader("Expires", 0);//设置日期头
String rootPath = request.getSession().getServletContext().getRealPath("/");
ex.exportExcel(rootPath,title,headers, dataset, out);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
try{
if(out!=null){
out.close();
}
}catch(IOException e){
e.printStackTrace();
}
}
return null;
}
/**
* @Title : findStatusByrdID
* @功能描述: TODO 找到证件当前的状态
* @开发者:陈强
* @参数: @param rdID
* @参数: @param model
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping("/findStatusByrdID")
@RequiresPermissions(value={"reader:findStatusByrdID","iterm:all"},logical=Logical.OR)
public String findStatusByrdID(@RequestParam("rdID")String rdID,Model model)
{
String status= readerService.findStatusByrdID(rdID);
model.addAttribute("status", status);
model.addAttribute("rdID", rdID);
return "WEB-INF/readerJsp/readerStatus";
}
/**
* @Title : updateStatus
* @功能描述: TODO 更改证件的状态
* @开发者:陈强
* @参数: @param reader
* @参数: @return
* @返回类型:String
* @throws :
*/
@RequestMapping(value="/updateStatus",method={RequestMethod.POST,RequestMethod.GET})
@RequiresPermissions(value={"reader:updateStatus","iterm:all"},logical=Logical.OR)
public String updateStatus(Reader reader)
{
readerService.updateStatusByrdID(reader);
return "WEB-INF/readerJsp/readerStatus";
}
@RequestMapping("/toReaderStatus")
public String readerStatus()
{
return "WEB-INF/readerJsp/readerStatus";
}
}
源码获取:俺的博客首页 "资源" 里下载!