資源簡(jiǎn)介
關(guān)于個(gè)人論壇,或者是多人論壇的畢設(shè)作品。包含有發(fā)帖評(píng)論等等各項(xiàng)功能齊全。
代碼片段和文件信息
package?com.moyifan.controller;
import?java.text.SimpleDateFormat;
import?java.util.ArrayList;
import?java.util.Date;
import?java.util.List;
import?javax.servlet.http.HttpServletRequest;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.stereotype.Controller;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.bind.annotation.RequestMethod;
import?com.moyifan.po.Plate;
import?com.moyifan.po.Post;
import?com.moyifan.po.User;
import?com.moyifan.service.CommentsService;
import?com.moyifan.service.PlateService;
import?com.moyifan.service.PostService;
import?com.moyifan.service.ReplyService;
import?com.moyifan.service.UserService;
/**
?*?管理員通知
?*?@author?HP5
?*
?*/
@Controller
@RequestMapping(“/adminpost“)
public?class?AdminPostController?{
/**
?*?注入PostService
?*/
@Autowired
private?PostService?ps;
/**
?*?注入U(xiǎn)serService
?*/
@Autowired
private?UserService?us;
@Autowired
private?CommentsService?commentsService;//?注入CommentsService
@Autowired
private?ReplyService?replyService;//注入ReplyService
@Autowired
private?PlateService?plateService;//注入ReplyService
/**
?*?獲取某個(gè)版面的?全部帖子
?*?@param?request
?*?@return
?*/
@RequestMapping(“/toGetPlatePost“)
public?String?toGetPlatePost(HttpServletRequest?request){
int?pid?=?Integer.parseInt(request.getParameter(“pid“));
List?postList?=?ps.getPostByPid(pid);
List?userList?=?new?ArrayList();
for(int?i=0;i User?user?=?us.getUserById(postList.get(i).getUid());
userList.add(user);
}
request.setAttribute(“userList“?userList);
request.setAttribute(“postList“?postList);
return?“admin/post/getPlatePost“;
}
/**
?*?刪除帖子
?*?@param?request
?*?@return
?*/
@RequestMapping(“/deletePost“)
public?String?deletePost(HttpServletRequest?request){
int?id?=?Integer.parseInt(request.getParameter(“id“));
int?pid?=?Integer.parseInt(request.getParameter(“pid“));
if(pid!=0){
Plate?plate=plateService.getPlateById(pid);
plate.setNum(plate.getNum()-1);
plateService.updatePlate(plate);
}
ps.deletePost(id);
commentsService.deleteCommentsBypostId(id);
replyService.deleteReplyBypostId(id);
return?“redirect:/adminpost/toGetPlatePost?pid=“+pid;
}
/**
?*?跳轉(zhuǎn)至新建通知
?*?@return
?*/
@RequestMapping(“/toNewPost“)
public?String?toNewPost(){
return?“admin/post/newPost“;
}
/**
?*?新建通知
?*?@param?post
?*?通知詳情
?*?@return
?*/
@RequestMapping(value=“/newPost“method=RequestMethod.POST)
public?String?newPost(Post?post){
post.setUid(1);
Date?day=new?Date();????
SimpleDateFormat?df?=?new?SimpleDateFormat(“yyyy-MM-dd?HH:mm:ss“);?
post.setTime(df.format(day));
post.setPhotoNum(-1);
ps.newPost(post);
return?“redirect:/adminpost/toNewPost“;
}
/**
?*?獲取所有歷史通知
?*?@param?request
?*?@
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-04-18?20:00??moyifan\
?????目錄???????????0??2018-04-18?20:00??moyifan\WebContent\
?????目錄???????????0??2018-04-18?20:00??moyifan\WebContent\js\
?????目錄???????????0??2018-04-18?20:00??moyifan\WebContent\js\admin\
?????目錄???????????0??2018-04-18?20:00??moyifan\WebContent\js\admin\css\
?????文件????????1098??2018-04-18?20:00??moyifan\WebContent\js\admin\css\st
?????文件????????2166??2018-04-18?20:00??moyifan\WebContent\js\admin\css\index.css
?????文件????????1714??2018-04-18?20:00??moyifan\WebContent\js\admin\css\select.css
?????文件???????19983??2018-04-18?20:00??moyifan\WebContent\js\admin\css\st
?????文件????????1148??2018-04-18?20:00??moyifan\WebContent\js\admin\css\normalize.css
?????目錄???????????0??2018-04-18?20:00??moyifan\WebContent\js\admin\images\
?????文件????????3851??2018-04-18?20:00??moyifan\WebContent\js\admin\images\t02.png
?????文件????????3100??2018-04-18?20:00??moyifan\WebContent\js\admin\images\add.png
?????文件????????5544??2018-04-18?20:00??moyifan\WebContent\js\admin\images\i04.png
?????文件????????2837??2018-04-18?20:00??moyifan\WebContent\js\admin\images\line1.png
?????文件?????????415??2018-04-18?20:00??moyifan\WebContent\js\admin\images\topbg.gif
?????文件????????4631??2018-04-18?20:00??moyifan\WebContent\js\admin\images\ico06.png
?????文件????????6521??2018-04-18?20:00??moyifan\WebContent\js\admin\images\icon02.png
?????文件????????2826??2018-04-18?20:00??moyifan\WebContent\js\admin\images\btnbg2.png
?????文件????????7382??2018-04-18?20:00??moyifan\WebContent\js\admin\images\icon03.png
?????文件????????2940??2018-04-18?20:00??moyifan\WebContent\js\admin\images\leftico04.png
?????文件????????4747??2018-04-18?20:00??moyifan\WebContent\js\admin\images\i05.png
?????文件????????2862??2018-04-18?20:00??moyifan\WebContent\js\admin\images\itabbg.png
?????文件???????27714??2018-04-18?20:00??moyifan\WebContent\js\admin\images\topright.jpg
?????文件????????4261??2018-04-18?20:00??moyifan\WebContent\js\admin\images\t03.png
?????文件???????30571??2018-04-18?20:00??moyifan\WebContent\js\admin\images\img09.png
?????文件????????4101??2018-04-18?20:00??moyifan\WebContent\js\admin\images\t01.png
?????文件????????6265??2018-04-18?20:00??moyifan\WebContent\js\admin\images\i07.png
?????文件????????4420??2018-04-18?20:00??moyifan\WebContent\js\admin\images\ico05.png
?????文件????????2854??2018-04-18?20:00??moyifan\WebContent\js\admin\images\btnbg1.png
?????文件????????5788??2018-04-18?20:00??moyifan\WebContent\js\admin\images\icon01.png
............此處省略819個(gè)文件信息
評(píng)論
共有 條評(píng)論