Git Product home page Git Product logo

forum-community's Introduction

ThisIsUs Community

概述

社区功能结构

社区总体分为三个功能模块

  • 普通功能:注册与登录,发表主题帖,回帖,浏览主题帖,这些是社区用户所有的功能
  • 社区板块管理:删除主题帖,删除回复贴.指定精华贴.这些功能是社区版块理员和社区管理员权限
  • 社区管理:包括创建社区版块,指定社区版块管理员,用户锁定与解锁.这些权限是社区管理员所有

社区用例描述

社区主要角色为4种:游客,普通用户,社区版块管理员,社区管理员. UML

主要功能流程描述

用户登录

Login

发表主题帖

Post

回复主题帖

Reply

删除帖子

Delete

置顶精华帖

SetTop

指定板块管理员

DesignateAdministrator

系统设计

Web层使用SpringMVC处理请求与响应,使用JSP视图搭配JSTL标签.并提供了一个字符转换编码过滤器防止中文乱码.服务层使用Spring4.0,持久层使用Hibernate.使用Maven构建项目.

系统架构

社区总共为4个模块,为用户管理,社区管理,版块管理以及社区基础功能.

  • 用户管理模块分为用户注册,登录,注销.
  • 论坛管理模块为创建社区板块,指定版块管理员,用户锁定与解锁.
  • 版块管理模块为主题帖删除,回复主题帖,置顶精华帖.
  • 社区基础功能有帖子搜索,社区板块列表,社区主题帖列表,浏览主题帖,发表主题帖,回复主题帖.

POJO(Plain Ordinary Java Objects)设计

总共有7个PO类,BaseDomain是PO类的基类,实现Serializable接口.

  • Board:社区板块PO类
  • Topic:社区主题PO类,包括主题帖的作者,所属社区板块,创建时间,浏览数,回复数,mainPost对应主题帖
  • Post:主题帖PO类,一个Topic拥有一个MainPost(主题帖子),但有很多个Post(回帖).
  • User:用户PO类
  • LoginLog:社区用户登录日志PO类 POJO

持久层设计

持久层采用Hibernate技术,创建所有的DAO的基类BaseDao,注入Hibernate的HibernateTemplate模板.BaseDao提供了常见的数据操作方法(如增删改查),子类只需要定义自己需要的特殊方法.BaseDao使用了java泛型,子类在继承时候只需要指定T的类型即可. DAO

服务层设计

服务层通过封装持久层的DAO完成业务逻辑,Web层通过调用服务层的类来完成模块中的业务.服务层包含两个类.一个是UserService,一个是ForumService.
UserService通过调用持久层的UserDao来实现持久化对象.提供了保存,更新,锁定,解锁用户等功能.还能依据用户名或者ID查询用户以及根据用户名模糊查询多个用户. UserService ForumService使用TopicDao,BoardDao,PostDao,UserDao实现了社区的基本功能, ForumService

Web层设计

在Web层定义了一个Controller的基类:BaseController,为其他Controller提供一个共有的方法.比如从Session中获取登录用户User对象,将请求转向一个URL等等. Web 使用Spring注解MVC,一个Controller可以对应多个请求.

  • RegisterController:用户注册控制器
  • LogininController:用户登录,注销控制器
  • ForumManageController:社区管理控制器,包括添加社区板块,指定社区板块管理员,对用户锁定与解锁.
  • BoardManageController:社区基本功能,包括发帖,回帖,删帖,置顶精华贴.

数据库设计:

主键使用自增机制,没有外键.只有_board_manager没有对应的POJO,他对应User与Board多对多关系,从Hibernate映射文件可以看出.
Mysql

待解决

Maven每次都会引入Hibernate3.2.5GA依赖,导致jar包冲突,需删除该依赖。

一开始没注意,数据库里面的date应该改为dateTime类型。导致帖子排序只能精确到天。 mysql数据库:它们分别是 date、datetime、time、timestamp和year。date :“yyyy-mm-dd”格式表示的日期值 time :“hh:mm:ss”格式表示的时间值 datetime: “yyyy-mm-dd hh:mm:ss”格式 timestamp: “yyyymmddhhmmss”格式表示的时间戳值 year: “yyyy”格式的年份值。 date “1000-01-01”到“9999-12-31” 3字节 time “-838:59:59”到“838:59:59” 3字节 datetime “1000-01-01 00:00:00” 到“9999-12-31 23:59:59” 8字节 timestamp 19700101000000 到2037 年的某个时刻 4字节 year 1901 到2155 1字节

更新

新增加内置头像以及上传头像

forum-community's People

Contributors

watermelon-lee avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.