This is the 10th day of my participation in the More text Challenge. For more details, see more text Challenge

Summer arrived, light snow to cool everyone down

Without further ado, jump right to the point

directory

Main function module design:

Main technology:

Main functions front-end:

Homepage of course selection platform:

Login registration management:

Class selection recommendation category:

My personal center:

Main functions front-end:

Administrator login:

Course selection type management:

Course selection information details management:

Administrator information management:

User Information Management:

Comment Exchange response management:

Some key code shows:

Login module:

Configuration module:

Main table design:

The users table:

List of elective courses:

Course Selection Details:

Comment Exchange Sheet:

Reply Information Sheet:

Main function module design:

Login and registration, homepage information browsing, course selection classification view, course selection details view, comment exchange, collection, page view, background data management, user management, course selection category management, course selection details management, comment exchange and reply management, and announcement information management, etc

Main technology:

Java, SpringMVC, Mybatis, mysql, Tomcat, jquery, Layui, JavaScript, HTML, CSS, JSP, log4J and other common basic technologies.

Main functions front-end:

Homepage of course selection platform:

Enter http://localhost/ to visit the homepage of the course selection and recommendation exchange platform. You can view the rotation diagram and various information. Click to enter the details page

Login registration management:

Class selection recommendation category:

Click to view classified course recommendation information, view course information by category, and administrators can add classified course information in the background

And ranking clicks based on visits,

Course Details:

For course details, you can view course details, author information, page views and other specific data, as well as comment and collection

My personal center:

Including my personal information and favorites information,

Main functions background:

System home page design:

The main function modules include the data maintenance of homepage information statistics, course selection type management, course selection details management, user management, comment and announcement management, etc.

Course selection type management:

Course selection information details management:

View list information. Add, modify, delete, and retrieve information

The details information

Notice Announcement information:

View the data list, add, modify, and delete the data list

User Information Management:

Comment Exchange response management:

Data management of comments and responses

Some key code shows:

Login module:

package com.longwang.controller;

import com.longwang.entity.Article;
import com.longwang.entity.Classify;
import com.longwang.entity.User;
import com.longwang.service.ArticleService;
import com.longwang.service.ClassifyService;
import com.longwang.service.NoticeService;
import com.longwang.service.UserService;
import com.longwang.util.DateUtil;
import com.longwang.util.StringUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.util.*;

/**
 * 根路径以及其他请求处理
 * 
 * @author 李杨勇
 *
 */
@Controller
public class IndexController {

  @Value("${imageFilePath}")
  private String imageFilePath; // 文件路径

  @Resource
  private NoticeService noticeService;

  @Resource
  private UserService userService;

  @Resource
  private ArticleService articleService;
  @Resource
  private ClassifyService classifyService;



  @RequestMapping("/")
  public String index(HttpSession session) {

    // 查询公告
    session.setAttribute("noticeList", noticeService.list(0, 5));
    return "index";// 跳转到index.html
  }


  @RequestMapping("/delete")
  public Map<String, Object> delete(Integer userId) {
    Map<String, Object> resultMap = new HashMap<String, Object>();
    userService.delete(userId);
    resultMap.put("errorNo", 0);
    return resultMap;
  }
  /**
   * 登录页面
   * 
   * @return
   */
  @RequestMapping("/login")
  public String login() {
    return "login";
  }

  /**
   * 前台登录页面
   * 
   * @return
   */
  @RequestMapping("/webLogin")
  public String webLogin() {
    return "webLogin";
  }

  /**
   * 注册
   * 
   * @return
   */
  @RequestMapping("/regist")
  public String regist() {
    return "regist";
  }

  /**
   * 保存注册信息
   * 
   * @param user
   * @return
   */
  @RequestMapping("/saveUser")
  public String saveUser(User user) {
      List<Article> randomArticle = articleService.getRandomArticle(3);
      String ids="";
      for (int i = 0; i < randomArticle.size(); i++) {
          Integer articleId = randomArticle.get(i).getArticleId();
          ids+=articleId+",";
      }
      ids = ids.substring(0, ids.length() -1);
      user.setArticleIds(ids);
      userService.save(user);

    return "webLogin";
  }

  /**
   * 退出登录
   * 
   * @param request
   * @return
   */
  @RequestMapping("/quit")
  public String quit(HttpServletRequest request) {
    HttpSession session = request.getSession();
    session.removeAttribute("user");
    return "index";
  }


  /**
   * 退出登录
   * 
   * @param request
   * @return
   */
  @RequestMapping("/quitAdmin")
  public String quitAdmin(HttpServletRequest request) {
    HttpSession session = request.getSession();
    session.removeAttribute("user");
    return "login";
  }

  /**
   * 验证登录
   *
   * @param user
   * @param request
   * @return
   */
  @RequestMapping("/checkLogin")
  public ModelAndView checkLogin(User user, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    HttpSession session = request.getSession();
    User u = userService.findByUsernameAndPassword(user.getUsername(), user.getPassword());
    if (u == null) {
      mav.addObject("user", user);
      mav.addObject("errorInfo", "用户名或者密码错误!");
      mav.setViewName("webLogin");
    } else {
      u.setLatelyLoginTime(new Date());
      userService.save(u);
      session.setAttribute("user", u);
      mav.addObject("username", u.getUsername());
      mav.addObject("user", u);
      mav.addObject("success", true);
      mav.setViewName("/index");
    }
    return mav;
  }

  /**
   * 查看个人信息
   * 
   * @return
   */
  @RequestMapping("viewPerson")
  public ModelAndView viewPerson(HttpServletRequest request) {
    User user = (User) request.getSession().getAttribute("user");
    ModelAndView mav = new ModelAndView();
    User u = userService.findById(user.getUserId());
    mav.addObject("user", u);
    mav.setViewName("/viewPerson");
    return mav;
  }

  /**
   * 查看个人课程收藏夹
   * 
   * @return
   */
  @RequestMapping("viewCollection")
  public ModelAndView viewCollection(HttpServletRequest request, HttpSession session) {
    User user = (User) request.getSession().getAttribute("user");
    ModelAndView mav = new ModelAndView();
    User u = userService.findById(user.getUserId());
    String artIds = u.getArticleIds();
    List<String> result = new ArrayList<>();
    if (StringUtils.isNotBlank(artIds)) {
      result = Arrays.asList(StringUtils.split(artIds, ","));
    }
    List<Integer> retIds = new ArrayList<>();
    for (String temp : result) {
      retIds.add(Integer.valueOf(temp).intValue());
    }
    List<Article> retArt = articleService.findByListId(retIds);
    session.setAttribute("noticeList", noticeService.list(0, 5));
    mav.addObject("retArt", retArt);
    mav.addObject("user", u);
    mav.setViewName("/viewCollection");
    return mav;
  }

  /**
   * 查看个人关注用户
   * 
   * @return
   */
  @RequestMapping("viewFocusUser")
  public ModelAndView viewFocusUser(HttpServletRequest request, HttpSession session) {
    User user = (User) request.getSession().getAttribute("user");
    ModelAndView mav = new ModelAndView();
    User u = userService.findById(user.getUserId());
    String userIds = u.getUserIds();
    List<String> result = new ArrayList<>();
    if (StringUtils.isNotBlank(userIds)) {
      result = Arrays.asList(StringUtils.split(userIds, ","));
    }
    List<Integer> retIds = new ArrayList<>();
    for (String temp : result) {
      retIds.add(Integer.valueOf(temp).intValue());
    }
    List<User> retArt = userService.findByListId(retIds);
    session.setAttribute("noticeList", noticeService.list(0, 5));
    mav.addObject("retArt", retArt);
    mav.addObject("user", u);
    mav.setViewName("/viewFocusUser");
    return mav;
  }

  /**
   * 保存用户信息
   * 
   * @param user
   * @return
   */
  @RequestMapping("/save")
  public ModelAndView save(User user) {
    ModelAndView mav = new ModelAndView();
    userService.save(user);
    mav.setViewName("/index");
    return mav;
  }

  /**
   * 写笔记页面
   * 
   * @param request
   * @return
   */
  // @RequestMapping("notePage")
  // public String notePage(HttpServletRequest request, Model model) {
  // User user = (User) request.getSession().getAttribute("user");
  // if (user == null) {
  // return "webLogin";
  // }
  // List<Classify> list = classifyService.findAll();
  // model.addAttribute("list", list);
  // return "one";
  // }

  @RequestMapping("notePage")
  public ModelAndView notePage(HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    User user = (User) request.getSession().getAttribute("user");
    if (user == null) {
      mav.setViewName("/webLogin");
      return mav;
    }
    List<Classify> list = classifyService.findAll();
    mav.addObject("list", list);
    mav.setViewName("/one");
    return mav;
  }

  /**
   * 保存笔记
   * 
   * @param article
   * @param request
   * @return
   */
  @RequestMapping("addNote")
  public ModelAndView addNote(Article article, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    // 获取当前用户信息
    User user = (User) request.getSession().getAttribute("user");
    article.setUserId(user.getUserId());
    article.setPublishDate(new Date());
    article.setClick(0);
    article.setCommentNum(0);
    article.setContentNoTag(StringUtil.Html2Text(article.getContent()));
    articleService.save(article);
    mav.setViewName("/index");
    return mav;
  }

  @RequestMapping("saveNote")
  public ModelAndView saveNote(Article article, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    Article a = articleService.findById(article.getArticleId());
    article.setPublishDate(a.getPublishDate());
    // 获取当前用户信息
    articleService.save(article);
    mav.setViewName("/index");
    return mav;
  }

  /**
   * 查看笔记
   * 
   * @return
   */
  @RequestMapping("viewNote")
  public String viewNote(HttpSession session) {
    session.setAttribute("noticeList", noticeService.list(0, 5));
    return "mylist";
  }

  @RequestMapping("/delete/{id}")
  public String delete(@PathVariable(value = "id") String id) throws Exception {
    articleService.delete(Integer.parseInt(id));
    return "mylist";
  }

  /**
   * 查看个人笔记加载数据列表
   * 
   * @param article
   * @param publishDates
   * @param page
   * @param pageSize
   * @return
   */
  @RequestMapping("/mylist")
  public Map<String, Object> list(Article article,
      @RequestParam(value = "publishDates", required = false) String publishDates,
      @RequestParam(value = "page", required = false) Integer page,
      @RequestParam(value = "pageSize", required = false) Integer pageSize, HttpServletRequest request) {
    Map<String, Object> resultMap = new HashMap<String, Object>();
    // User user = (User) request.getSession().getAttribute("user");
    // article.setUserId(user.getUserId());
    String s_bPublishDate = null; // 开始时间
    String s_ePublishDate = null; // 结束时间
    if (StringUtil.isNotEmpty(publishDates)) {
      String[] strs = publishDates.split(" - "); // 拆分时间段
      s_bPublishDate = strs[0];
      s_ePublishDate = strs[1];
    }
    Long total = articleService.getCount(article, s_bPublishDate, s_ePublishDate);
    int totalPage = (int) (total % pageSize == 0 ? total / pageSize : total / pageSize + 1); // 总页数
    resultMap.put("totalPage", totalPage);
    resultMap.put("errorNo", 0);
    resultMap.put("data", articleService.list(article, s_bPublishDate, s_ePublishDate, page - 1, pageSize));
    resultMap.put("total", total);
    return resultMap;
  }

  /**
   * 后台默认首页
   * 
   * @return
   */
  @RequestMapping("/index")
  public String root() {
    return "/common/index";
  }

  /**
   * 博主信息页面
   * 
   * @return
   */
  @RequestMapping("/blogger")
  public String blogger() {
    return "/blogger/index";
  }

  /**
   * 图片上传处理 @Title: ckeditorUpload @param file 图片文件 @return 参数说明 @return
   * Map<String,Object> 返回类型 @throws
   */
  @ResponseBody
  @RequestMapping("/upload")
  public Map<String, Object> ckeditorUpload(@RequestParam("file") MultipartFile file) {
    Map<String, Object> resultMap = new HashMap<String, Object>();
    Map<String, Object> resultMap1 = new HashMap<String, Object>();
    String fileName = file.getOriginalFilename(); // 获取文件名
    String suffixName = fileName.substring(fileName.lastIndexOf(".")); // 获取文件的后缀
    String newFileName = "";
    try {
      newFileName = DateUtil.getCurrentDateStr() + suffixName; // 新文件名
      FileUtils.copyInputStreamToFile(file.getInputStream(), new File(imageFilePath + newFileName)); // 上传
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    resultMap.put("code", 0);
    resultMap1.put("filePath", newFileName);
    resultMap.put("data", resultMap1);
    return resultMap;
  }

}
Copy the code

Configuration module:

server: port: 80 servlet: context-path: / spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/choosing_courses? useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai username: root password: 123456 jpa: hibernate: ddl-auto: update show-sql: true database-platform: org.hibernate.dialect.MySQLDialect thymeleaf: cache: false thymeleaf: prefix: classpath:/templates/ MD5Salt: longwang imageFilePath: C:\\Users\\Administrator\\Desktop\\choosingCourses\\src\\main\\webapp\\static\\images\\ downloadImagePath: C:\\Users\\Administrator\\Desktop\\choosingCourses\\src\\main\\webapp lucenePath: C:\\Users\\Administrator\\Desktop\\choosingCourses\\luceneCopy the code

Main table design:

The users table:

CREATE TABLE `NewTable` (
`user_id`  int(11) NOT NULL AUTO_INCREMENT ,
`head_portrait`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`lately_login_time`  datetime NULL DEFAULT NULL ,
`nickname`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`registration_date`  datetime NULL DEFAULT NULL ,
`sex`  varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`open_id`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`password`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`username`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`article_ids`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`birthday`  date NULL DEFAULT NULL ,
`momo`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`phone`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`user_ids`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
PRIMARY KEY (`user_id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=20
ROW_FORMAT=COMPACT
;
Copy the code

List of elective courses:

CREATE TABLE `NewTable` (
`classify_id`  int(11) NOT NULL AUTO_INCREMENT ,
`classify_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
PRIMARY KEY (`classify_id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=27
ROW_FORMAT=COMPACT
;
Copy the code

Course Selection Details:

CREATE TABLE `NewTable` (
`article_id`  int(11) NOT NULL AUTO_INCREMENT ,
`author`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
`click`  int(11) NULL DEFAULT NULL ,
`comment_num`  int(11) NULL DEFAULT NULL ,
`content`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL ,
`image_name`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`is_original`  int(11) NULL DEFAULT NULL ,
`is_top`  int(11) NULL DEFAULT NULL ,
`publish_date`  datetime NULL DEFAULT NULL ,
`title`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
`classify_id`  int(11) NULL DEFAULT NULL ,
`user_id`  int(11) NULL DEFAULT NULL ,
PRIMARY KEY (`article_id`),
FOREIGN KEY (`classify_id`) REFERENCES `t_classify` (`classify_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `FKo4fros4yfq1m9ay7sgtlcvbc4` (`classify_id`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=58
ROW_FORMAT=COMPACT
;
Copy the code

Comment Exchange Sheet:

CREATE TABLE `NewTable` (
`comment_id`  int(11) NOT NULL AUTO_INCREMENT ,
`comment_date`  datetime NULL DEFAULT NULL ,
`content`  varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`article_id`  int(11) NULL DEFAULT NULL ,
`user_id`  int(11) NULL DEFAULT NULL ,
PRIMARY KEY (`comment_id`),
FOREIGN KEY (`article_id`) REFERENCES `t_article` (`article_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
FOREIGN KEY (`user_id`) REFERENCES `t_user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `FKlsvvc2ob8lxg2m9qqry15ru0y` (`article_id`) USING BTREE ,
INDEX `FKtamaoacctq4qpko6bvtv0ke1p` (`user_id`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=15
ROW_FORMAT=COMPACT
;
Copy the code

Reply Information Sheet:

CREATE TABLE `NewTable` (
`reply_id`  int(11) NOT NULL AUTO_INCREMENT ,
`content`  varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`reply_date`  datetime NULL DEFAULT NULL ,
`comment_id`  int(11) NULL DEFAULT NULL ,
`user_id`  int(11) NULL DEFAULT NULL ,
PRIMARY KEY (`reply_id`),
FOREIGN KEY (`comment_id`) REFERENCES `t_comment` (`comment_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
FOREIGN KEY (`user_id`) REFERENCES `t_user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX `FKk4ydp71wampdbnguly8iks4rf` (`comment_id`) USING BTREE ,
INDEX `FKslt6r79iw1p9cbxns09erjv6v` (`user_id`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
AUTO_INCREMENT=6
ROW_FORMAT=COMPACT
;
Copy the code

Java SSM Springboot +VUE epidemic prevention system based on the separation of front and rear end design and implementation

Based on Java Springboot + Mybatis film ticketing website management system foreground + background design and implementation

Design and implementation of winery internal management system based on Java SSM Springboot + Mybatis

Design and implementation of intelligent life sharing platform based on JAVA Springboot + Mybatis

Design and implementation of furniture mall platform system based on Java Springboot + Vue + Redis

Design and implementation of anti-epidemic material information management system based on JAVA SSM SpringBoot

More actual combat projects >>>

Ok, that’s all for today, friends like, favorites, comments, one key three go, see you next time ~~