1.包含源程序,数据库脚本。代码和数据库脚本都有详细注释。
2.课题设计仅供参考学习使用,可以在此基础上进行扩展完善
开发环境:
代码已经上传github,下载地址https://github.com/21503882/student-file
Eclipse ,MYSQL,JDK1.8,Tomcat 7
涉及技术点:
MVC模式、SpringMvc、Mybatis、Spring、bootstrap、HTML、JavaScript、CSS、JQUERY、log4j、Ajax、maven等
系统采用Mybatis框架实现ORM对象关系映射,前台JSP实现,后台springMvc映射,使用Spring框架进行整合。适合学习J2EE的一段时间的熟手,代码思路清晰,注解详细,数据库用的是mysql5.1,服务器用的tomcat7,JDK版本1.8. 编程软件Eclispe J2EE版本。是典型MVC架构,并且前后台分离
主要功能:
太多的截图。其他暂时省去了
源码截图部分如下:
package com.lin.sharebooks;
import com.github.pagehelper.PageHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import java.util.Properties;
@SpringBootApplication
@EnableCaching
//表明开启servlet的注解
@ServletComponentScan
public class SharebooksApplication {
public static void main(String[] args) {
SpringApplication.run(SharebooksApplication.class, args);
}
//配置mybatis的分页插件pageHelper
@Bean
public PageHelper pageHelper(){
PageHelper pageHelper=new PageHelper();
Properties properties=new Properties();
properties.setProperty("offsetAsPageNum","true");
properties.setProperty("rowBoundsWithCount","true");
//设置为true时表示参数合理化,例如currpage<1,自动返回第一页数据,currpage>总页数时,自动返回最后一页数据
properties.setProperty("reasonable","false");
//配置mysql数据库的方言
properties.setProperty("dialect","mysql");
pageHelper.setProperties(properties);
return pageHelper;
}
}
package com.lin.sharebooks.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lin.sharebooks.model.*;
import com.lin.sharebooks.service.*;
import com.lin.sharebooks.util.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private RedisComponent redisComponent;
@Autowired
private ObjectMapper objectMapper;
@Autowired
private LoginlogService loginlogService;
@Autowired
private BookService bookService;
@Autowired
private MessageService messageService;
@Autowired
private PostService postService;
@Autowired
private NoticeService noticeService;
/**
* 用户注册时,检查邮箱是否已被注册使用
* @param email
* @return
*/
@ApiOperation(value="账号可用性",notes = "判断注册账号是否已被注册使用")
@RequestMapping(value="/judgeEmail",method= RequestMethod.POST)
public Map<String,Object> judgeEmail(String email){
Map<String,Object> map=new HashMap<>();
boolean flag=userService.isUsedEmail(email);
if(flag){
map.put("status", ResultMsg.OK);
}else{
map.put("status",Resu