• 大小: 7.42MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-22
  • 语言: 其他
  • 标签: Web  

资源简介

毕业设计《基于Web的图书推荐系统展示平台》

资源截图

代码片段和文件信息

package cn.edu.ustb.controller;

import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import java.util.Properties;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import cn.edu.ustb.dm.dao.BookAuthorInfoMapper;
import cn.edu.ustb.dm.dao.BookOnlineInfoMapper;
import cn.edu.ustb.dm.dao.BookPublishingInfoMapper;

@Controller
public class BookInfoController {
@Resource
private SqlSessionFactory sqlSessionFactory;

private static final Logger logger = LoggerFactory.getLogger(BookInfoController.class);
private Properties properties;
private SqlSession session;
private BookPublishingInfoMapper publishingInfoMapper;
private BookOnlineInfoMapper onlineInfoMapper;
private BookAuthorInfoMapper authorInfoMapper;

private Properties getProperties() {
if(properties == null) {
properties = new Properties();
try {
InputStream in = getClass().getResourceAsStream(“/Web.properties“);
properties.load(in);
} catch (IOException e) {
e.printStackTrace();
}
}
return properties;
}
private BookPublishingInfoMapper getPublishingInfoMapper() {
if(publishingInfoMapper == null)
publishingInfoMapper =  session.getMapper(BookPublishingInfoMapper.class);
return publishingInfoMapper;
}
private BookOnlineInfoMapper getOnlineInfoMapper() {
if(onlineInfoMapper == null)
onlineInfoMapper =  session.getMapper(BookOnlineInfoMapper.class);
return onlineInfoMapper;
}
private BookAuthorInfoMapper getBookAuthorInfoMapper() {
if(authorInfoMapper == null)
authorInfoMapper =  session.getMapper(BookAuthorInfoMapper.class);
return authorInfoMapper;
}

private void resetMapper() {
publishingInfoMapper = null;
onlineInfoMapper = null;
authorInfoMapper = null;
}

@RequestMapping(value=“/bookInfo“ method = RequestMethod.GET)
public String bookInfo(Locale locale Model model
@RequestParam(“id“) int id) {
resetMapper();
session = sqlSessionFactory.openSession();
try {
model.addAttribute(“imageSrc“ getProperties().getProperty(“book_lpic“));
model.addAttribute(“publishing“ getPublishingInfoMapper().selectByPrimaryKey(id));
model.addAttribute(“online“ getOnlineInfoMapper().selectByPrimaryKey(id));
model.addAttribute(“author“ getBookAuthorInfoMapper().selectByPrimaryKey(id));
session.commit();
} finally {
session.close();
}
return “bookInfo“;
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-06-09 03:39  dm-master\
     文件        1264  2013-06-09 03:39  dm-master\.classpath
     文件        1312  2013-06-09 03:39  dm-master\.project
     目录           0  2013-06-09 03:39  dm-master\.settings\
     文件          97  2013-06-09 03:39  dm-master\.settings\org.eclipse.core.resources.prefs
     文件         652  2013-06-09 03:39  dm-master\.settings\org.eclipse.jdt.core.prefs
     文件          86  2013-06-09 03:39  dm-master\.settings\org.eclipse.m2e.core.prefs
     文件         606  2013-06-09 03:39  dm-master\.settings\org.eclipse.wst.common.component
     文件         222  2013-06-09 03:39  dm-master\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件        2079  2013-06-09 03:39  dm-master\.settings\org.eclipse.wst.validation.prefs
     文件        8272  2013-06-09 03:39  dm-master\.settings\org.springframework.ide.eclipse.beans.core.prefs
     文件       11741  2013-06-09 03:39  dm-master\.settings\org.springframework.ide.eclipse.core.prefs
     文件         366  2013-06-09 03:39  dm-master\.springBeans
     文件           9  2013-06-09 03:39  dm-master\README.md
     文件       12799  2013-06-09 03:39  dm-master\glyphicons-halflings.png
     文件        5745  2013-06-09 03:39  dm-master\pom.xml
     目录           0  2013-06-09 03:39  dm-master\src\
     目录           0  2013-06-09 03:39  dm-master\src\main\
     目录           0  2013-06-09 03:39  dm-master\src\main\java\
     目录           0  2013-06-09 03:39  dm-master\src\main\java\cn\
     目录           0  2013-06-09 03:39  dm-master\src\main\java\cn\edu\
     目录           0  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\
     目录           0  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\controller\
     文件        2791  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\controller\BookInfoController.java
     文件        7608  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\controller\IndexController.java
     文件       16583  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\controller\ResultListController.java
     目录           0  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\dm\
     目录           0  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\dm\dao\
     文件        3853  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\dm\dao\AuthorInfoMapper.java
     文件        3055  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\dm\dao\BindingTypeMapper.java
     文件        3753  2013-06-09 03:39  dm-master\src\main\java\cn\edu\ustb\dm\dao\BookAuthorInfoMapper.java
............此处省略116个文件信息

评论

共有 条评论