• Java项目:SSM在线美食分享推荐平台网站


    作者主页:夜未央5788

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    项目介绍

    该项目为前后台项目,分为普通用户与管理员两种角色,前台普通用户登录,后台管理员登录;

    管理员角色包含以下功能:

    管理员登录,用户管理,一级分类管理,二级分类管理,美食管理,留言管理等功能。

    用户角色包含以下功能:

    用户登录,按分类查看,写留言等功能。

    演示视频:点此查看

    由于本程序规模不大,可供课程设计,毕业设计学习演示之用

    更多项目源码,请到“源码空间站”,地址:http://www.shuyue.fun/

    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
    2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
    3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
    4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 

    5.数据库:MySql 5.7版本;

    6.是否Maven项目:否;

    技术栈

    1. 后端:Spring+SpringMVC+Mybatis

    2. 前端:JSP+jQuery+Ajax

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

    3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;

    4. 运行项目,输入localhost:8080/ 登录

    运行指导教程

    idea导入源码空间站项目教程说明(Windows版)-ssm篇:

    关于IDEA导入源码空间站源码的使用教程(windows版)

    源码看好后直接在网站付款下单即可,付款成功会自动弹出百度网盘链接,网站地址:http://www.shuyue.fun/ 。

    其它问题请关注公众号:程序员MM,关注后发送消息即可,都会给您回复的。 若没有及时回复请耐心等待,通常当天会有回复

    运行截图

    前台界面

     

     

     

    后台界面

     

     

     

     

     

     

    相关代码

    CategorySecondServiceImpl

    1. package com.shop.serviceImpl;
    2. import java.util.List;
    3. import org.springframework.beans.factory.annotation.Autowired;
    4. import com.shop.Utils.PageBean;
    5. import com.shop.mapper.CategorysecondMapper;
    6. import com.shop.po.Categorysecond;
    7. import com.shop.po.CategorysecondExample;
    8. import com.shop.po.CategorysecondExample.Criteria;
    9. import com.shop.service.CategorySecondService;
    10. public class CategorySecondServiceImpl implements CategorySecondService {
    11. @Autowired
    12. private CategorysecondMapper categorysecondMapper;
    13. @Override
    14. public PageBean adminCategorySecond_findAllByPage(int page) {
    15. PageBean pageBean = new PageBean<>();
    16. // 设置这是第几页
    17. pageBean.setPage(page);
    18. // 设置10个
    19. int limitPage = 10;
    20. pageBean.setLimitPage(limitPage);
    21. // 设置一共多少页
    22. int totlePage = 0;
    23. // 查询一共有多少页
    24. CategorysecondExample example = new CategorysecondExample();
    25. totlePage = categorysecondMapper.countByExample(example);
    26. if (Math.ceil(totlePage % limitPage) == 0) {
    27. totlePage = totlePage / limitPage;
    28. } else {
    29. totlePage = totlePage / limitPage + 1;
    30. }
    31. pageBean.setTotlePage(totlePage);
    32. int beginPage= (page-1)*limitPage;
    33. // 集合 分页查询
    34. CategorysecondExample csexample = new CategorysecondExample();
    35. csexample.setBeginPage(beginPage);
    36. csexample.setLimitPage(limitPage);
    37. List list = categorysecondMapper
    38. .selectByExample(csexample);
    39. pageBean.setList(list);
    40. return pageBean;
    41. }
    42. @Override
    43. public void adminCategorySecond_save(Categorysecond categorysecond)
    44. throws Exception {
    45. categorysecondMapper.insert(categorysecond);
    46. }
    47. @Override
    48. public Categorysecond findByCsid(int csid) throws Exception {
    49. return categorysecondMapper.selectByPrimaryKey(csid);
    50. }
    51. @Override
    52. public void adminCategorySecond_update(Categorysecond categorysecond) {
    53. categorysecondMapper.updateByPrimaryKey(categorysecond);
    54. }
    55. @Override
    56. public void adminCategorySecond_delete(int csid) {
    57. categorysecondMapper.deleteByPrimaryKey(csid);
    58. }
    59. @Override
    60. public List findAll() throws Exception {
    61. return categorysecondMapper.selectByExample1();
    62. }
    63. @Override
    64. public void adminCategorySecond_deleteByCid(int cid) throws Exception {
    65. CategorysecondExample example = new CategorysecondExample();
    66. Criteria createCriteria = example.createCriteria();
    67. createCriteria.andCidEqualTo(cid);
    68. categorysecondMapper.deleteByExample(example);
    69. }
    70. }

    CategoryServiceImpl

    1. package com.shop.serviceImpl;
    2. import java.util.List;
    3. import org.springframework.beans.factory.annotation.Autowired;
    4. import com.shop.mapper.CategoryMapper;
    5. import com.shop.po.Category;
    6. import com.shop.po.CategoryExample;
    7. import com.shop.service.CategoryService;
    8. public class CategoryServiceImpl implements CategoryService{
    9. @Autowired
    10. private CategoryMapper categoryMapper;
    11. @Override//查询一级目录
    12. public List findCategory() throws Exception {
    13. List list = categoryMapper.findCategoryAndSecondcategory();
    14. if(list!=null && list.size()>0){
    15. return list;
    16. }
    17. return null;
    18. }
    19. @Override
    20. public void addCategory(Category addCategory) throws Exception {
    21. categoryMapper.insert(addCategory);
    22. }
    23. @Override
    24. public List adminbFindCategory() {
    25. System.out.println("3333333333333");
    26. CategoryExample example = new CategoryExample();
    27. List list = categoryMapper.selectByExample(example);
    28. if(list!=null && list.size()>0){
    29. return list;
    30. }
    31. return null;
    32. }
    33. @Override
    34. public Category findCategory(int cid) throws Exception {
    35. return categoryMapper.selectByPrimaryKey(cid);
    36. }
    37. @Override
    38. public void adminCategory_update(Category category) {
    39. categoryMapper.updateByPrimaryKey(category);
    40. }
    41. @Override
    42. public void deleteCategoryByCid(int cid) throws Exception {
    43. categoryMapper.deleteByPrimaryKey(cid);
    44. }
    45. }

    MessageServiceImpl

    1. package com.shop.serviceImpl;
    2. import java.util.List;
    3. import org.springframework.beans.factory.annotation.Autowired;
    4. import com.shop.Utils.PageBean;
    5. import com.shop.mapper.MessageMapper;
    6. import com.shop.po.Message;
    7. import com.shop.service.MessageService;
    8. public class MessageServiceImpl implements MessageService {
    9. @Autowired
    10. private MessageMapper messagesMapper;
    11. @Override
    12. public void insertMessage(Message messages) throws Exception {
    13. messagesMapper.insert(messages);
    14. }
    15. @Override
    16. public PageBean findAllMessageByPage(int page) throws Exception {
    17. PageBean pageBean = new PageBean<>();
    18. // 设置这是第几页
    19. pageBean.setPage(page);
    20. // 设置10个
    21. int limitPage =4;
    22. pageBean.setLimitPage(limitPage);
    23. // 设置一共多少页
    24. int totlePage = 0;
    25. // 查询一共有多少页
    26. totlePage = messagesMapper.countAllMessage();
    27. if(Math.ceil(totlePage % limitPage)==0){
    28. totlePage=totlePage / limitPage;
    29. }else{
    30. totlePage=totlePage / limitPage+1;
    31. }
    32. pageBean.setTotlePage(totlePage);
    33. int beginPage= (page-1)*limitPage;
    34. //商品集合
    35. List list = messagesMapper.findAllMessageByPage(beginPage, limitPage) ;
    36. pageBean.setList(list);
    37. return pageBean;
    38. }
    39. @Override
    40. public void deleteMessage(int messageid) throws Exception {
    41. messagesMapper.deleteByPrimaryKey(messageid);
    42. }
    43. }

    OrderServiceImpl

    1. package com.shop.serviceImpl;
    2. import java.util.List;
    3. import org.springframework.beans.factory.annotation.Autowired;
    4. import com.shop.Utils.PageBean;
    5. import com.shop.mapper.OrderitemMapper;
    6. import com.shop.mapper.OrdersMapper;
    7. import com.shop.po.Orderitem;
    8. import com.shop.po.Orders;
    9. import com.shop.service.OrderService;
    10. public class OrderServiceImpl implements OrderService {
    11. @Autowired
    12. private OrdersMapper ordersMapper;
    13. @Autowired
    14. private OrderitemMapper orderitemMapper;
    15. public void toOrder(Orders orders) throws Exception {
    16. ordersMapper.insert(orders);
    17. }
    18. @Override
    19. public void toOrderItem(Orderitem orderitem) throws Exception {
    20. orderitemMapper.insert(orderitem);
    21. }
    22. @Override
    23. public void payOrder(Orders orders) throws Exception {
    24. Orders payOrder = ordersMapper.selectByPrimaryKey(orders.getOid());
    25. if(orders.getReceiveinfo()!=null && orders.getPhonum()!=null){
    26. payOrder.setPhonum(orders.getPhonum());
    27. payOrder.setReceiveinfo(orders.getReceiveinfo());
    28. payOrder.setAccepter(orders.getAccepter());
    29. payOrder.setState(1);
    30. }
    31. ordersMapper.updateByPrimaryKeySelective(payOrder);
    32. }
    33. @Override
    34. public PageBean findOrderByUidAndPage(int page, Integer uid)
    35. throws Exception {
    36. PageBean pageBean = new PageBean<>();
    37. // 设置这是第几页
    38. pageBean.setPage(page);
    39. // 设置10个
    40. int limitPage =4;
    41. pageBean.setLimitPage(limitPage);
    42. // 设置一共多少页
    43. int totlePage = 0;
    44. // 查询一共有多少页
    45. totlePage = ordersMapper.countOrdersByUid(uid);
    46. if(Math.ceil(totlePage % limitPage)==0){
    47. totlePage=totlePage / limitPage;
    48. }else{
    49. totlePage=totlePage / limitPage+1;
    50. }
    51. pageBean.setTotlePage(totlePage);
    52. int beginPage= (page-1)*limitPage;
    53. // 商品集合
    54. List list = ordersMapper.findOrderByUidAndPage(uid,beginPage,limitPage);
    55. pageBean.setList(list);
    56. return pageBean;
    57. }
    58. @Override
    59. public Orders findOrderByOid(int oid) {
    60. return ordersMapper.selectByPrimaryKey(oid);
    61. }
    62. @Override
    63. public PageBean findAllOrderByStateAndPage(int page)
    64. throws Exception {
    65. PageBean pageBean = new PageBean<>();
    66. // 设置这是第几页
    67. pageBean.setPage(page);
    68. // 设置10个
    69. int limitPage = 4;
    70. pageBean.setLimitPage(limitPage);
    71. // 设置一共多少页
    72. int totlePage = 0;
    73. // 查询一共有多少页
    74. totlePage = ordersMapper.countAllOrders();
    75. if(Math.ceil(totlePage % limitPage)==0){
    76. totlePage=totlePage / limitPage;
    77. }else{
    78. totlePage=totlePage / limitPage+1;
    79. }
    80. pageBean.setTotlePage(totlePage);
    81. int beginPage= (page-1)*limitPage;
    82. //商品集合
    83. List list = ordersMapper.findAllOrderByPage(beginPage,limitPage);
    84. pageBean.setList(list);
    85. return pageBean;
    86. }
    87. @Override
    88. public void updateOrderStatus(int oid, int status) throws Exception {
    89. Orders payOrder = ordersMapper.selectByPrimaryKey(oid);
    90. payOrder.setState(status);
    91. ordersMapper.updateByPrimaryKeySelective(payOrder);
    92. }
    93. @Override
    94. public PageBean findAllOrderByStateAndPage(int state,int page)
    95. throws Exception {
    96. PageBean pageBean = new PageBean<>();
    97. // 设置这是第几页
    98. pageBean.setPage(page);
    99. // 设置10个
    100. int limitPage =4;
    101. pageBean.setLimitPage(limitPage);
    102. // 设置一共多少页
    103. int totlePage = 0;
    104. // 查询一共有多少页
    105. totlePage = ordersMapper.countOrdersByState(state);
    106. if(Math.ceil(totlePage % limitPage)==0){
    107. totlePage=totlePage / limitPage;
    108. }else{
    109. totlePage=totlePage / limitPage+1;
    110. }
    111. pageBean.setTotlePage(totlePage);
    112. int beginPage= (page-1)*limitPage;
    113. //商品集合
    114. List list = ordersMapper.findAllOrderByStateAndPage(state, beginPage, limitPage) ;
    115. pageBean.setList(list);
    116. return pageBean;
    117. }
    118. }

    ProductServiceImpl

    1. package com.shop.serviceImpl;
    2. import java.util.ArrayList;
    3. import java.util.List;
    4. import javax.swing.text.StyledEditorKit.ForegroundAction;
    5. import org.springframework.beans.factory.annotation.Autowired;
    6. import com.shop.Utils.PageBean;
    7. import com.shop.mapper.ProductMapper;
    8. import com.shop.po.Category;
    9. import com.shop.po.CategoryExample;
    10. import com.shop.po.CategorysecondExample;
    11. import com.shop.po.Product;
    12. import com.shop.po.ProductExample;
    13. import com.shop.po.ProductExample.Criteria;
    14. import com.shop.service.ProductService;
    15. public class ProductServiceImpl implements ProductService {
    16. @Autowired
    17. private ProductMapper productMapper;
    18. // 查询热门商品 带分页的查询
    19. public List findHotProduct() throws Exception {
    20. ProductExample example = new ProductExample();
    21. ProductExample.Criteria criteria = example.createCriteria();
    22. criteria.andIsHotEqualTo(1);
    23. example.setOrderByClause("pdate DESC");
    24. example.setBeginPage(0);
    25. example.setEnd(4);
    26. List list = productMapper.selectByExample(example);
    27. /*for (Product product : list) {
    28. System.out.println(product.getPname());
    29. }*/
    30. if(list!=null && list.size()>0){
    31. return list;
    32. }
    33. return null;
    34. }
    35. @Override
    36. public List findNewProduct() throws Exception {
    37. ProductExample example = new ProductExample();
    38. ProductExample.Criteria criteria = example.createCriteria();
    39. example.setOrderByClause("pdate DESC");
    40. example.setBeginPage(0);
    41. example.setEnd(8);
    42. List list = productMapper.selectByExample(example);
    43. /*for (Product product : list) {
    44. System.out.println(product.getPname());
    45. }*/
    46. if(list!=null && list.size()>0){
    47. return list;
    48. }
    49. return null;
    50. }
    51. // 根据id查找商品
    52. public Product productFindByPid(int pid) throws Exception {
    53. return productMapper.selectByPrimaryKey(pid);
    54. }
    55. // 根据cid查找商品
    56. public PageBean findProductyBycid(int cid, int page)
    57. throws Exception {
    58. PageBean pageBean = new PageBean<>();
    59. // 设置这是第几页
    60. pageBean.setPage(page);
    61. // 设置10个
    62. int limitPage =12;
    63. pageBean.setLimitPage(limitPage);
    64. // 设置一共多少页
    65. int totlePage = 0;
    66. // 查询一共有多少页
    67. totlePage = productMapper.countProducyByCid(cid);
    68. if(Math.ceil(totlePage % limitPage)==0){
    69. totlePage=totlePage / limitPage;
    70. }else{
    71. totlePage=totlePage / limitPage+1;
    72. }
    73. pageBean.setTotlePage(totlePage);
    74. int beginPage= (page-1)*limitPage;
    75. // 商品集合
    76. List list = productMapper.findProductByCid(cid,beginPage,limitPage);
    77. pageBean.setList(list);
    78. return pageBean;
    79. }
    80. // 根据csid查找商品
    81. public PageBean finbProductByCsid(int csid, int page) {
    82. PageBean pageBean = new PageBean<>();
    83. pageBean.setPage(page);
    84. // 设置10个
    85. int limitPage =12;
    86. pageBean.setLimitPage(limitPage);
    87. // 设置一共多少页
    88. int totlePage = 0;
    89. // 查询一共有多少页
    90. totlePage = productMapper.countProducyByCsid(csid);
    91. if(Math.ceil(totlePage % limitPage)==0){
    92. totlePage=totlePage / limitPage;
    93. }else{
    94. totlePage=totlePage / limitPage+1;
    95. }
    96. pageBean.setTotlePage(totlePage);
    97. int beginPage= (page-1)*limitPage;
    98. // 商品集合
    99. List list = productMapper.findProductBycsid(csid,beginPage,limitPage);
    100. pageBean.setList(list);
    101. return pageBean;
    102. }
    103. @Override
    104. public Product finbProductByPid(int pid) {
    105. return productMapper.selectByPrimaryKey(pid);
    106. }
    107. @Override
    108. public PageBean findAllProduct(int page) throws Exception {
    109. PageBean pageBean = new PageBean<>();
    110. pageBean.setPage(page);
    111. // 设置10个
    112. int limitPage =12;
    113. pageBean.setLimitPage(limitPage);
    114. // 设置一共多少页
    115. int totlePage = 0;
    116. // 查询一共有多少页
    117. ProductExample example = new ProductExample();
    118. totlePage = productMapper.countByExample(example);
    119. if(Math.ceil(totlePage % limitPage)==0){
    120. totlePage=totlePage / limitPage;
    121. }else{
    122. totlePage=totlePage / limitPage+1;
    123. }
    124. pageBean.setTotlePage(totlePage);
    125. int beginPage= (page-1)*limitPage;
    126. // 商品集合
    127. List list = productMapper.findAllProduct(beginPage,limitPage);
    128. pageBean.setList(list);
    129. return pageBean;
    130. }
    131. @Override
    132. public void adminProduct_save(Product product) throws Exception {
    133. productMapper.insert(product);
    134. }
    135. @Override
    136. public void adminProduct_deletecs(int pid) throws Exception {
    137. productMapper.deleteByPrimaryKey(pid);
    138. }
    139. @Override
    140. public void adminProduct_update(Product product) throws Exception {
    141. productMapper.updateByPrimaryKey(product);
    142. }
    143. @Override
    144. public List searchProduct(String condition) throws Exception {
    145. List list = productMapper.searchProduct(condition) ;
    146. if(list!=null && list.size()>0){
    147. return list;
    148. }
    149. return null;
    150. }
    151. }

    如果也想学习本系统,下面领取。关注并回复:163ssm 

  • 相关阅读:
    inpaint-anything:分割任何东西遇到图像修复
    static详解
    Xavier MAC与PHY自适应速率分析-代码分析
    Redis4 缓存淘汰策略及事务实现乐观锁
    用户微服务用户注册功能实现
    个人练习-Leetcode-1034. Coloring A Border
    算法岗面经:2023届腾讯算法岗暑期实习一面面经
    玩转快速排序(C语言版)
    复制粘贴是怎么实现的
    MS2711D手持式频谱分析仪
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126446949