Java项⽬:⼩说在线阅读系统(前台阅读+后台管理)
(java+SSM+jsp+mysql。。。
源码获取:博客⾸页 "资源" ⾥下载!
⼀、项⽬简述
功能包括(管理员和游客⾓⾊):
1:⽤户及主要操作功能 游客可以浏览⽹站的主页,但是需要注册为会员后部分⼩ 说才能对⽹络⼩说进免费⾏阅读或阅读。⽤户可以收藏书架,留⾔评论,上次阅读,阅读历史,章节选择等等功 能。
2:管理模块 ⽹络⼩说管理模块包括不同⽹络⼩说类别的添加,删除以 及⽹络⼩说的上传,删除管理。可以包括武侠⼩书,都市 ⾔情,穿越⼩书等各个类等等功能。
⼆、项⽬运⾏
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都⽀持)
项⽬技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax等等。
书籍管理控制层:
@Controller
public class BookController {
@Autowired
private BookService bookService;
// @Autowired
// private BookService bookService;
//⼩说列表
@RequestMapping("/book/list")
public String list(Model model,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "3") Integer pageSize) { PageInfo<Book> pageInfo=bookService.list(page,pageSize);
model.addAttribute("list",List());
model.addAttribute("pageInfo",pageInfo);
return "book/book-list";
}
//⼩说添加
@RequestMapping("/book/addPage")
public String addPage() {
return "book/book-add";
}
//
// // 添加⼩说
@RequestMapping("/book/add")
@ResponseBody
public ResultData add(Book book) {
return bookService.add(book);
}
// 编辑⼩说状态
@RequestMapping("/book/editCondition")
@ResponseBody
public ResultData editCondition(Integer bookId, Integer condition){ return bookService.updateStatus(bookId,condition);
}
// 编辑页⾯
@RequestMapping("/book/editPage")
public String editPage(Model model, Integer bookId){
Book dbBook = bookService.findById(bookId);
model.addAttribute("book",dbBook);
return "book/book-edit";
}
//更新基本信息
@RequestMapping("/book/edit")
@ResponseBody
public ResultData edit(Book book){
return bookService.edit(book);
}
// 批量删除
@RequestMapping("/book/deleteAll")
@ResponseBody
public ResultData deleteAll(@RequestParam(name="ids") String ids){
//将ids转为数组
String[] idArr = ids.split(",");
//将字符串数组转为int数组
return bookService.batchDelete(idArr);
}
// search
jquery在线库@RequestMapping("/book/search")
public String searchList(Model model,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "3") Integer pageSize,
String keyword) {
PageInfo<Book> pageInfo=bookService.searchList(page,pageSize,keyword);
model.addAttribute("list",List());
model.addAttribute("pageInfo",pageInfo);
return "book/book-list";
}
@RequestMapping("/book/search1")
public String searchList1(Model model,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "3") Integer pageSize,
String keyword1) {
PageInfo<Book> pageInfo=bookService.searchList1(page,pageSize,keyword1);
model.addAttribute("list",List());
model.addAttribute("pageInfo",pageInfo);
return "book/book-list";
}
@RequestMapping(value = "/book/getByType",method = RequestMethod.GET)
public String getByType(Integer bookType, Model model, HttpSession session){
List<Book> bookList = bookService.findByType(bookType);
List<Book> randList = bookService.findRandList();
//将字符串数组转为int数组
session.setAttribute("bookList",bookList);
session.setAttribute("randList",randList);
return "/front/personal";
}
@RequestMapping(value = "/book/getByName",method = RequestMethod.POST)
public String getByName(String likeName, Model model, HttpSession session) throws UnsupportedEncodingException {
public String getByName(String likeName, Model model, HttpSession session) throws UnsupportedEncodingException { // String likeName1 = new Bytes("ISO-8859-1"),"utf-8");
List<Book> bookList = bookService.findByLikeName(likeName);
List<Book> randList = bookService.findRandList();
/
/将字符串数组转为int数组
session.setAttribute("bookList",bookList);
session.setAttribute("randList",randList);
return "/front/personal";
}
}
⾓⾊控制层:
@Controller
public class AuthorController {
@Autowired
private AuthorService authorService;
@RequestMapping("/zuozhe")
public String duzhe(){
return "loginauthor";
}
@RequestMapping("/zuoping")
public String zuoping(){
return "index11";
}
/**
* 登陆操作
* @return
*/
@RequestMapping("/loginauthor")
@ResponseBody
public ResultData login2(Author author){
ResultData resultData=authorService.login2(author);
return resultData;
}
//作者列表
@RequestMapping("/author/list")
public String list(Model model,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "5") Integer pageSize){
PageInfo<Author> pageInfo = authorService.list(page,pageSize);
model.addAttribute("list",List());
model.addAttribute("pageInfo",pageInfo);
return "author/author-list";
}
//搜索作者显⽰列表
@RequestMapping("/author/search")
public String searchList(Model model,
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论