0
点赞
收藏
分享

微信扫一扫

go test用法(获取单元测试覆盖率)

基于JAVA springboot+mybatis智慧生活分享平台设计和实现

文章目录

主要功能模块设计:

登录注册、首页信息浏览、分类查看、详情查看、评论、收藏、浏览量、关注、以及后台管理
主要技术:Java、springmvc、mybatis、mysql、tomcat、jquery、layui、bootstarp、JavaScript、html、css、jsp、log4j等一些常见的基本技术。

系统前端页面主要功能展示:

在这里插入图片描述

分类查看详情数据:

在这里插入图片描述

用户登录注册:

在这里插入图片描述

详情信息查看:

在这里插入图片描述

用户交流评论信息:

在这里插入图片描述

评论controller层代码

package com.smj.controller.admin;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
 
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import com.smj.entity.Comment;
import com.smj.entity.User;
import com.smj.service.ArticleService;
import com.smj.service.CommentService;
import com.smj.service.ReplyService;
import com.smj.service.UserService;
import com.smj.util.StringUtil;
 
/**
 * 评论Controller层
 * @author smj
 *
 */
@RestController
@RequestMapping("/admin/comment")
public class CommentAdminController {
 
  @Resource
  private CommentService commentService;
 
  @Resource
  private UserService userService;
 
  @Resource
  private ReplyService replyService;
 
  @Resource
  private ArticleService articleService;
 
  /**
   * 分页查询评论
  * @Title: list  
  * @param comment  评论实体
  * @param commentDates  时间段 (搜索用到)
  * @param page  当前页
  * @return  参数说明
  * @return Map<String,Object>    返回类型 
  * @throws
   */
  @RequestMapping("/list")
  public Map<String, Object> list(Comment comment,
      @RequestParam(value = "commentDates", required = false) String commentDates,
      @RequestParam(value = "page", required = false) Integer page,
      @RequestParam(value = "pageSize", required = false) Integer pageSize,
      @RequestParam(value = "nickname", required = false) String nickname) {
    String s_bCommentDate = null; // 开始时间
    String s_eCommentDate = null; // 结束时间
    if (StringUtil.isNotEmpty(commentDates)) {
      String[] strs = commentDates.split(" - "); // 拆分时间段
      s_bCommentDate = strs[0];
      s_eCommentDate = strs[1];
    }
    Integer userId = null;
    Map<String, Object> resultMap = new HashMap<String, Object>();
    if (StringUtil.isNotEmpty(nickname)) {
      User user = userService.findByTrueName(nickname);
      if (user != null) {
        userId = user.getUserId();
      }
      if (userId == null) {
        resultMap.put("errorInfo", "用户昵称不存在,没有评论!");
      } else {
        resultMap.put("errorNo", 0);
      }
    } else {
      resultMap.put("errorNo", 0);
    }
    List<Comment> commentList = commentService.list(comment, s_bCommentDate, s_eCommentDate, page - 1, pageSize,
        userId);
    Long total = commentService.getCount(comment, s_bCommentDate, s_eCommentDate, userId);
    resultMap.put("data", commentList);
    resultMap.put("total", total);
    return resultMap;
  }
 
  /**
   * 删除评论
   * @param ids
   * @return
   */
  @RequestMapping("/delete")
  public Map<String, Object> delete(@RequestParam(value = "commentId") String ids) {
    String[] idsStr = ids.split(","); // 拆分ids字符串
    Map<String, Object> resultMap = new HashMap<String, Object>();
    for (int i = 0; i < idsStr.length; i++) {
      Integer articleId = commentService.getArticleId(Integer.parseInt(idsStr[i]));
      commentService.delete(Integer.parseInt(idsStr[i]));
      if (articleId != null) {
        articleService.reduceComment(articleId);
      }
    }
    resultMap.put("errorNo", 0);
    resultMap.put("data", 1);
    return resultMap;
  }
 
}

发表文章分享信息

在这里插入图片描述

我的个人信息和收藏信息以及关注用户等

在这里插入图片描述

关注用户和取消关注用户

在这里插入图片描述

对喜欢的文章进行收藏和取消收藏

在这里插入图片描述

后台管理员信息:

后台主要功能模块为:
1.用户模块管理:用户登录、用户注册、用户的查询、添加、删除操作、
2.智慧生活分享管理:分享列表的展示、添加、修改、删除操作、
3.智慧生活分享详情管理:智慧生活笔记详情列表的查看、添加、删除等操作、
4.管理员信息管理:管理员信息的查看、修改、
5.公告信息管理:公告信息的查看、添加、修改、删除操作、
6.用户模块管理:用户列表查询、添加、删除、
7.用户评论模块管理:用户评论查询、添加、删除、
8.注销退出登录管理
在这里插入图片描述

举报

相关推荐

0 条评论