Java project: food forum system (java + SSM + jsp + jQuery + layui + MySQL)

pastclouds 2022-05-14 15:03:43 阅读数:378

javaprojectfoodforumjava

The source code for : Blog's front page " resources " Download !

Project introduction

The project is mainly divided into foreground and background ;
The main functions of the front desk include :
Sign in 、 register ; home page 、 My post 、 Suggestions ; List of sections 、 Post view 、 Post and reply, etc ;
After ordinary users log in , The main functions are :
My home page 、 User center 、 Basic settings 、 Moderator application 、 My attention 、 Block users 、 My private letter, etc ;
The main functions of the background include :
Member management : Estoppel 、 Title 、 Delete etc. ;
Website information : add to 、 edit 、 Delete etc. ;
link : add to 、 edit 、 Delete etc. ;
Section management : Add, modify, delete classification 、 Revoke the moderator, etc ;
Post management : transfer 、 The essence of 、 Roof placement 、 Delete etc. ;
Moderator review : adopt 、 Refuse, etc ;
Suggestions : reply 、 Delete ;
Sensitive characters : add to 、 edit 、 Delete sensitive characters ;
Report information : Check the informant 、 informant 、 Reasons for reporting, etc ;


Environmental needs

1. Running environment : It is best to java jdk 1.8, We run on this platform . Other versions can, in theory .
2.IDE Environmental Science :IDEA,Eclipse,Myeclipse Fine . recommend IDEA;
3.tomcat Environmental Science :Tomcat 7.x,8.x,9.x All versions are available
4. Hardware environment :windows 7/8/10 1G Above memory ; perhaps Mac OS;
5. whether Maven project : no ; See if the source directory contains pom.xml; If included , Then for maven project , Otherwise, it is not maven project  
6. database :MySql 5.7 edition ;


Technology stack

1. Back end :Spring SpringMVC MyBatis
2. front end :JSP+jQuery+LayUI


Instructions

1. Use Navicat Or other tools , stay mysql Create a database with the corresponding name in , And import the sql file ;
2. Use IDEA/Eclipse/MyEclipse Import the project ,Eclipse/MyEclipse Import time , if maven Item, please select maven;
if maven project , After importing successfully, please execute maven clean;maven install command , To configure tomcat, And then run ;
3. In the project db.properties Change the database configuration in the configuration file to your own configuration ;
4. Run the project , Input http://localhost:8080/cateforumssm Sign in

 

 

 

 

 

 

 

 

 

User management controller :

/**
* User controller
*
*/
@RestController
@RequestMapping("/admin/user")
public class UserAdminController {
@Resource
private UserService userService;
@Value("${MD5Salt}")
private String salt; // md5 Encrypting salt
/**
* according to ID Find user
* @param userId
* @return
*/
@RequestMapping("/findById")
public Map<String, Object> findById(Integer userId) {
Map<String, Object> resultMap = new HashMap<String, Object>();
User user = userService.findById(userId);
resultMap.put("errorNo", 0);
resultMap.put("data", user);
return resultMap;
}
/**
* Paging query users
* @param user
* @param registrationDates
* @param page
* @param limit
* @return
*/
@RequestMapping("/list")
public Map<String, Object> list(User user,
@RequestParam(value = "latelyLoginTimes", required = false) String latelyLoginTimes,
@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
String s_bregistrationDate = null; // Starting time
String s_eregistrationDate = null; // End time
if (StringUtil.isNotEmpty(latelyLoginTimes)) {
String[] strs = latelyLoginTimes.split(" - "); // Split time periods
s_bregistrationDate = strs[0];
s_eregistrationDate = strs[1];
}
List<User> userList = userService.list(user, s_bregistrationDate, s_eregistrationDate, page - 1, pageSize);
Long total = userService.getCount(user, s_bregistrationDate, s_eregistrationDate);
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("errorNo", 0);
resultMap.put("data", userList);
resultMap.put("total", total);
return resultMap;
}
@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;
}
/**
* Cancel the attention
* @param request
* @param userId
* @return
*/
@RequestMapping("/removeFocusUser")
public ModelAndView removeFocusUser(HttpServletRequest request, String userId) {
ModelAndView mav = new ModelAndView();
User user = (User) request.getSession().getAttribute("user");// Currently logged in user
String userIds = user.getUserIds();
List<String> tempList = Arrays.asList(userIds.split(","));
List<String> lineIdList = new ArrayList<>(tempList);
lineIdList.remove(userId);
String ret = StringUtils.join(lineIdList, ",");
user.setUserIds(ret);
userService.save(user);
mav.setViewName("redirect:/viewFocusUser");
return mav;
}
/**
* Focus on users
* @param request
* @param userId
* @return
*/
@RequestMapping("/addFocusUser")
public ModelAndView addFocusUser(HttpServletRequest request, String userId) {
ModelAndView mav = new ModelAndView();
User user = (User) request.getSession().getAttribute("user");// Currently logged in user
String userIds = user.getUserIds();
List<String> tempList = Arrays.asList(userIds.split(","));
List<String> lineIdList = new ArrayList<>(tempList);
lineIdList.add(userId);
String ret = StringUtils.join(lineIdList, ",");
user.setUserIds(ret);
userService.save(user);
mav.setViewName("redirect:/viewFocusUser");
return mav;
}
@RequestMapping("/addFocusUser/{userId}")
public ModelAndView addFocusUser(@PathVariable(value = "userId", required = false) Integer userId,
HttpSession session) {
ModelAndView mav = new ModelAndView();
User user = (User) session.getAttribute("user");// Currently logged in user
String userIds = user.getUserIds();
List<String> tempList = new ArrayList<>();
if (userIds != null) {
tempList = Arrays.asList(userIds.split(","));
}
List<String> lineIdList = new ArrayList<>(tempList);
lineIdList.add(userId.toString());
String ret = StringUtils.join(lineIdList, ",");
user.setUserIds(ret);
userService.save(user);
mav.setViewName("redirect:/viewFocusUser");
return mav;
}
/**
* Cancel collection
* @param request
* @param userId
* @return
*/
@RequestMapping("/removeCollection")
public ModelAndView removeCollection(HttpServletRequest request, String artId) {
ModelAndView mav = new ModelAndView();
User user = (User) request.getSession().getAttribute("user");// Currently logged in user
String artIds = user.getArticleIds();
List<String> tempList = Arrays.asList(artIds.split(","));
List<String> lineIdList = new ArrayList<>(tempList);
lineIdList.remove(artId);
String ret = StringUtils.join(lineIdList, ",");
user.setArticleIds(ret);
userService.save(user);
mav.setViewName("redirect:/viewCollection");
return mav;
}
/**
* Collection
* @param request
* @param userId
* @return
*/
@RequestMapping("/addCollection")
public ModelAndView addCollection(HttpServletRequest request, String artId) {
ModelAndView mav = new ModelAndView();
User user = (User) request.getSession().getAttribute("user");// Currently logged in user
String artIds = user.getArticleIds();
List<String> tempList = Arrays.asList(artIds.split(","));
List<String> lineIdList = new ArrayList<>(tempList);
lineIdList.add(artId);
String ret = StringUtils.join(lineIdList, ",");
user.setArticleIds(ret);
userService.save(user);
mav.setViewName("redirect:/viewCollection");
return mav;
}
}

Reply to management control : 

/**
* reply Controller layer
*
*/
@RestController
@RequestMapping("/admin/reply")
public class ReplyAdminController {
@Resource
private ReplyService replyService;
/**
* Paging query reply
* @param reply
* @param page
* @param limit
* @return
*/
@RequestMapping("/list")
public Map<String, Object> list(Reply reply,@RequestParam(value="page",required=false)Integer page,@RequestParam(value="pageSize",required=false)Integer pageSize){
Map<String, Object> resultMap=new HashMap<String, Object>();
List<Reply> replyList=replyService.list(reply,page-1, pageSize);
Long total=replyService.getCount();
resultMap.put("errorNo", 0);
resultMap.put("data", replyList);
resultMap.put("total", total);
return resultMap;
}
/**
* Delete reply
* @param ids
* @return
*/
@RequestMapping("/delete")
public Map<String, Object> delete(@RequestParam(value="replyId")String ids){
String []idsStr=ids.split(",");
Map<String, Object> resultMap=new HashMap<String, Object>();
for(int i=0;i<idsStr.length;i++) {
replyService.delete(Integer.parseInt(idsStr[i]));
}
resultMap.put("errorNo", 0);
resultMap.put("data", 1);
return resultMap;
}
}

Blogger management control :

/**
* Blogger controller
*
*/
@RestController
@RequestMapping("/admin/blogger")
public class BloggerAdminController {
@Resource
private BloggerService bloggerService;
@Resource
private StartupRunner startupRunner;
/**
* Find bloggers
* @param bloggerId
* @return
*/
@RequestMapping("/find")
public Map<String, Object> find() {
Map<String, Object> resultMap=new HashMap<String, Object>();
resultMap.put("errorNo", 0);
resultMap.put("data", bloggerService.find());
return resultMap;
}
/**
* Add or modify bloggers
* @param blogger
* @return
*/
@RequestMapping("/save")
public Map<String, Object> save(Blogger blogger){
Map<String, Object> resultMap=new HashMap<String, Object>();
bloggerService.save(blogger);
resultMap.put("errorNo", 0);
resultMap.put("data", 1);
startupRunner.loadData();
return resultMap;
}
}

The source code for : Blog's front page " resources " Download ! 

版权声明:本文为[pastclouds]所创,转载请带上原文链接,感谢。 https://qdmana.com/2022/134/202205141459242870.html