作者主页:夜未央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,关注后发送消息即可,都会给您回复的。 若没有及时回复请耐心等待,通常当天会有回复
后台界面
- package com.shop.serviceImpl;
-
- import java.util.List;
-
- import org.springframework.beans.factory.annotation.Autowired;
-
- import com.shop.Utils.PageBean;
- import com.shop.mapper.CategorysecondMapper;
- import com.shop.po.Categorysecond;
- import com.shop.po.CategorysecondExample;
- import com.shop.po.CategorysecondExample.Criteria;
- import com.shop.service.CategorySecondService;
-
-
- public class CategorySecondServiceImpl implements CategorySecondService {
- @Autowired
- private CategorysecondMapper categorysecondMapper;
-
- @Override
- public PageBean
adminCategorySecond_findAllByPage(int page) { - PageBean
pageBean = new PageBean<>(); - // 设置这是第几页
- pageBean.setPage(page);
- // 设置10个
- int limitPage = 10;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- CategorysecondExample example = new CategorysecondExample();
- totlePage = categorysecondMapper.countByExample(example);
- if (Math.ceil(totlePage % limitPage) == 0) {
- totlePage = totlePage / limitPage;
- } else {
- totlePage = totlePage / limitPage + 1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- // 集合 分页查询
- CategorysecondExample csexample = new CategorysecondExample();
- csexample.setBeginPage(beginPage);
- csexample.setLimitPage(limitPage);
- List
list = categorysecondMapper - .selectByExample(csexample);
- pageBean.setList(list);
- return pageBean;
- }
-
- @Override
- public void adminCategorySecond_save(Categorysecond categorysecond)
- throws Exception {
- categorysecondMapper.insert(categorysecond);
- }
-
- @Override
- public Categorysecond findByCsid(int csid) throws Exception {
- return categorysecondMapper.selectByPrimaryKey(csid);
- }
-
- @Override
- public void adminCategorySecond_update(Categorysecond categorysecond) {
- categorysecondMapper.updateByPrimaryKey(categorysecond);
- }
-
- @Override
- public void adminCategorySecond_delete(int csid) {
- categorysecondMapper.deleteByPrimaryKey(csid);
- }
-
- @Override
- public List
findAll() throws Exception { - return categorysecondMapper.selectByExample1();
- }
-
- @Override
- public void adminCategorySecond_deleteByCid(int cid) throws Exception {
- CategorysecondExample example = new CategorysecondExample();
- Criteria createCriteria = example.createCriteria();
- createCriteria.andCidEqualTo(cid);
- categorysecondMapper.deleteByExample(example);
- }
- }
- package com.shop.serviceImpl;
-
- import java.util.List;
-
- import org.springframework.beans.factory.annotation.Autowired;
-
- import com.shop.mapper.CategoryMapper;
- import com.shop.po.Category;
- import com.shop.po.CategoryExample;
- import com.shop.service.CategoryService;
-
-
- public class CategoryServiceImpl implements CategoryService{
-
- @Autowired
- private CategoryMapper categoryMapper;
-
- @Override//查询一级目录
- public List
findCategory() throws Exception { - List
list = categoryMapper.findCategoryAndSecondcategory(); - if(list!=null && list.size()>0){
- return list;
- }
- return null;
- }
- @Override
- public void addCategory(Category addCategory) throws Exception {
- categoryMapper.insert(addCategory);
- }
-
- @Override
- public List
adminbFindCategory() { - System.out.println("3333333333333");
- CategoryExample example = new CategoryExample();
-
- List
list = categoryMapper.selectByExample(example); - if(list!=null && list.size()>0){
- return list;
- }
- return null;
- }
- @Override
- public Category findCategory(int cid) throws Exception {
- return categoryMapper.selectByPrimaryKey(cid);
- }
- @Override
- public void adminCategory_update(Category category) {
- categoryMapper.updateByPrimaryKey(category);
- }
- @Override
- public void deleteCategoryByCid(int cid) throws Exception {
- categoryMapper.deleteByPrimaryKey(cid);
- }
- }
- package com.shop.serviceImpl;
-
- import java.util.List;
-
- import org.springframework.beans.factory.annotation.Autowired;
-
- import com.shop.Utils.PageBean;
- import com.shop.mapper.MessageMapper;
- import com.shop.po.Message;
- import com.shop.service.MessageService;
-
-
- public class MessageServiceImpl implements MessageService {
- @Autowired
- private MessageMapper messagesMapper;
-
- @Override
- public void insertMessage(Message messages) throws Exception {
- messagesMapper.insert(messages);
- }
-
- @Override
- public PageBean
findAllMessageByPage(int page) throws Exception { - PageBean
pageBean = new PageBean<>(); - // 设置这是第几页
- pageBean.setPage(page);
- // 设置10个
- int limitPage =4;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- totlePage = messagesMapper.countAllMessage();
- if(Math.ceil(totlePage % limitPage)==0){
- totlePage=totlePage / limitPage;
- }else{
- totlePage=totlePage / limitPage+1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- //商品集合
- List
list = messagesMapper.findAllMessageByPage(beginPage, limitPage) ; - pageBean.setList(list);
- return pageBean;
- }
-
- @Override
- public void deleteMessage(int messageid) throws Exception {
- messagesMapper.deleteByPrimaryKey(messageid);
- }
- }
- package com.shop.serviceImpl;
-
- import java.util.List;
-
- import org.springframework.beans.factory.annotation.Autowired;
-
- import com.shop.Utils.PageBean;
- import com.shop.mapper.OrderitemMapper;
- import com.shop.mapper.OrdersMapper;
- import com.shop.po.Orderitem;
- import com.shop.po.Orders;
- import com.shop.service.OrderService;
-
-
- public class OrderServiceImpl implements OrderService {
- @Autowired
- private OrdersMapper ordersMapper;
- @Autowired
- private OrderitemMapper orderitemMapper;
- public void toOrder(Orders orders) throws Exception {
- ordersMapper.insert(orders);
- }
-
- @Override
- public void toOrderItem(Orderitem orderitem) throws Exception {
- orderitemMapper.insert(orderitem);
- }
-
- @Override
- public void payOrder(Orders orders) throws Exception {
- Orders payOrder = ordersMapper.selectByPrimaryKey(orders.getOid());
- if(orders.getReceiveinfo()!=null && orders.getPhonum()!=null){
- payOrder.setPhonum(orders.getPhonum());
- payOrder.setReceiveinfo(orders.getReceiveinfo());
- payOrder.setAccepter(orders.getAccepter());
- payOrder.setState(1);
- }
- ordersMapper.updateByPrimaryKeySelective(payOrder);
- }
-
- @Override
- public PageBean
findOrderByUidAndPage(int page, Integer uid) - throws Exception {
- PageBean
pageBean = new PageBean<>(); - // 设置这是第几页
- pageBean.setPage(page);
- // 设置10个
- int limitPage =4;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- totlePage = ordersMapper.countOrdersByUid(uid);
- if(Math.ceil(totlePage % limitPage)==0){
- totlePage=totlePage / limitPage;
- }else{
- totlePage=totlePage / limitPage+1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- // 商品集合
- List
list = ordersMapper.findOrderByUidAndPage(uid,beginPage,limitPage); - pageBean.setList(list);
- return pageBean;
- }
-
- @Override
- public Orders findOrderByOid(int oid) {
- return ordersMapper.selectByPrimaryKey(oid);
- }
-
- @Override
- public PageBean
findAllOrderByStateAndPage(int page) - throws Exception {
- PageBean
pageBean = new PageBean<>(); - // 设置这是第几页
- pageBean.setPage(page);
- // 设置10个
- int limitPage = 4;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- totlePage = ordersMapper.countAllOrders();
- if(Math.ceil(totlePage % limitPage)==0){
- totlePage=totlePage / limitPage;
- }else{
- totlePage=totlePage / limitPage+1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- //商品集合
- List
list = ordersMapper.findAllOrderByPage(beginPage,limitPage); - pageBean.setList(list);
- return pageBean;
- }
-
- @Override
- public void updateOrderStatus(int oid, int status) throws Exception {
- Orders payOrder = ordersMapper.selectByPrimaryKey(oid);
- payOrder.setState(status);
- ordersMapper.updateByPrimaryKeySelective(payOrder);
- }
-
- @Override
- public PageBean
findAllOrderByStateAndPage(int state,int page) - throws Exception {
- PageBean
pageBean = new PageBean<>(); - // 设置这是第几页
- pageBean.setPage(page);
- // 设置10个
- int limitPage =4;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- totlePage = ordersMapper.countOrdersByState(state);
-
- if(Math.ceil(totlePage % limitPage)==0){
- totlePage=totlePage / limitPage;
- }else{
- totlePage=totlePage / limitPage+1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- //商品集合
- List
list = ordersMapper.findAllOrderByStateAndPage(state, beginPage, limitPage) ; - pageBean.setList(list);
- return pageBean;
- }
- }
- package com.shop.serviceImpl;
-
- import java.util.ArrayList;
- import java.util.List;
-
- import javax.swing.text.StyledEditorKit.ForegroundAction;
-
- import org.springframework.beans.factory.annotation.Autowired;
-
- import com.shop.Utils.PageBean;
- import com.shop.mapper.ProductMapper;
- import com.shop.po.Category;
- import com.shop.po.CategoryExample;
- import com.shop.po.CategorysecondExample;
- import com.shop.po.Product;
- import com.shop.po.ProductExample;
- import com.shop.po.ProductExample.Criteria;
- import com.shop.service.ProductService;
-
-
- public class ProductServiceImpl implements ProductService {
-
- @Autowired
- private ProductMapper productMapper;
- // 查询热门商品 带分页的查询
- public List
findHotProduct() throws Exception { - ProductExample example = new ProductExample();
- ProductExample.Criteria criteria = example.createCriteria();
- criteria.andIsHotEqualTo(1);
- example.setOrderByClause("pdate DESC");
- example.setBeginPage(0);
- example.setEnd(4);
- List
list = productMapper.selectByExample(example); - /*for (Product product : list) {
- System.out.println(product.getPname());
- }*/
- if(list!=null && list.size()>0){
- return list;
- }
- return null;
- }
- @Override
- public List
findNewProduct() throws Exception { - ProductExample example = new ProductExample();
- ProductExample.Criteria criteria = example.createCriteria();
- example.setOrderByClause("pdate DESC");
- example.setBeginPage(0);
- example.setEnd(8);
- List
list = productMapper.selectByExample(example); - /*for (Product product : list) {
- System.out.println(product.getPname());
- }*/
- if(list!=null && list.size()>0){
- return list;
- }
- return null;
- }
- // 根据id查找商品
- public Product productFindByPid(int pid) throws Exception {
- return productMapper.selectByPrimaryKey(pid);
- }
- // 根据cid查找商品
- public PageBean
findProductyBycid(int cid, int page) - throws Exception {
- PageBean
pageBean = new PageBean<>(); - // 设置这是第几页
- pageBean.setPage(page);
- // 设置10个
- int limitPage =12;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- totlePage = productMapper.countProducyByCid(cid);
- if(Math.ceil(totlePage % limitPage)==0){
- totlePage=totlePage / limitPage;
- }else{
- totlePage=totlePage / limitPage+1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- // 商品集合
- List
list = productMapper.findProductByCid(cid,beginPage,limitPage); - pageBean.setList(list);
-
- return pageBean;
- }
- // 根据csid查找商品
- public PageBean
finbProductByCsid(int csid, int page) { - PageBean
pageBean = new PageBean<>(); - pageBean.setPage(page);
- // 设置10个
- int limitPage =12;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- totlePage = productMapper.countProducyByCsid(csid);
- if(Math.ceil(totlePage % limitPage)==0){
- totlePage=totlePage / limitPage;
- }else{
- totlePage=totlePage / limitPage+1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- // 商品集合
- List
list = productMapper.findProductBycsid(csid,beginPage,limitPage); - pageBean.setList(list);
- return pageBean;
- }
- @Override
- public Product finbProductByPid(int pid) {
- return productMapper.selectByPrimaryKey(pid);
- }
- @Override
- public PageBean
findAllProduct(int page) throws Exception { - PageBean
pageBean = new PageBean<>(); - pageBean.setPage(page);
- // 设置10个
- int limitPage =12;
- pageBean.setLimitPage(limitPage);
- // 设置一共多少页
- int totlePage = 0;
- // 查询一共有多少页
- ProductExample example = new ProductExample();
- totlePage = productMapper.countByExample(example);
- if(Math.ceil(totlePage % limitPage)==0){
- totlePage=totlePage / limitPage;
- }else{
- totlePage=totlePage / limitPage+1;
- }
- pageBean.setTotlePage(totlePage);
- int beginPage= (page-1)*limitPage;
- // 商品集合
- List
list = productMapper.findAllProduct(beginPage,limitPage); - pageBean.setList(list);
- return pageBean;
- }
- @Override
- public void adminProduct_save(Product product) throws Exception {
- productMapper.insert(product);
- }
- @Override
- public void adminProduct_deletecs(int pid) throws Exception {
- productMapper.deleteByPrimaryKey(pid);
- }
- @Override
- public void adminProduct_update(Product product) throws Exception {
- productMapper.updateByPrimaryKey(product);
- }
- @Override
- public List
searchProduct(String condition) throws Exception { -
- List
list = productMapper.searchProduct(condition) ; -
- if(list!=null && list.size()>0){
- return list;
- }
- return null;
- }
- }
如果也想学习本系统,下面领取。关注并回复:163ssm