基于Spring+SpringMvc+Hibernate的咔咔发廊管理系统

基于Spring+SpringMvc+Hibernate的家政服务网-java家政服务网
1.包含源程序,数据库脚本。代码和数据库脚本都有详细注释。
2.课题设计仅供参考学习使用,可以在此基础上进行扩展完善

代码已经上传github,下载地址 https://github.com/21503882/hair-mag
开发环境:
Eclipse ,MYSQL,JDK1.7,Tomcat 7
涉及技术点:
MVC模式、springMvc、Hibernate、Spring、HTML、JavaScript、CSS、JQUERY、poi、jpa、Ajax等
系统采用Hibernate框架实现ORM对象关系映射,前台JSP实现,后台springMvc映射,使用Spring框架进行整合。适合学习J2EE的一段时间的熟手,代码思路清晰,注解详细,数据库用的是mysql5.1,服务器用的tomcat7,JDK版本1.7. 编程软件Eclispe J2EE版本。是典型MVC架构,并且前后台分离;
主要功能:

系统在两个模块的基础上每一个模块又分为几个模块。
1.前台系统功能模块分为
(1)产品展台模块:通过新品上架,分页显示特价产品,产品销售排行展示网站的所有产品;
(2)产品查询模块:按产品的类别查询产品的相关信息;
(3)购物车模块:用户添加产品至购物车,查看购物车中的产品,从购物车中移除不满意的产品,清空购物车中的产品,修改所要购买的产品的数量;
(4)收银台模块:用户满意购物车中的产品后进行结账并填写订单信息;
(5)用户维护模块:为用户提供了用户注册、用户登录、用户资料修改以及找回密码的功能;
(6)订单查询模块:用户通过查看订单能够了解到自己的当前订单信息及历史订单记录;
(7)公告浏览模块:用户通过浏览公告信息,能够及时了解到网站最新的各种信息。
(8)留言模块:客户可以进行留言给我们提意见,我们在不断地改进中前进。

2.后台管理员子系统功能模块分为
(1)产品管理模块:按类别查看产品,对产品的信息进行维护;
(2)用户管理模块:为了保护用户的信息,此模块与前台用户维护的区别是管理员只能查看用户信息和删除操作;
(3)管理员维护模块:这是对管理员的信息进行维护,可以修改管理员的信息。
(4)业务员维护模块:这是对业务员的信息进行维护,管理员可以添加或删除业务员的信息。
(5)订单管理模块:管理员查询订单,查看订单详细信息,删除订单信息,进行订单受理;
(6)公告管理模块:管理员公告浏览,公告信息维护;
(7)留言模块:管理员可以查看客户的留言,对留言进行维护。

package com.yeyunlin.dao;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import com.yeyunlin.info.FoodInfo;
import com.yeyunlin.info.OrderInfo;
import com.yeyunlin.info.ReviewInfo;
import com.yeyunlin.info.UserInfo;
import com.yeyunlin.util.DBUtil;
import com.yeyunlin.util.Tools;
 
public class Dao {
    public static boolean checkPassword(String name, String password) {
        String sql = " select * from managers where name = ? and password = ?";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setString(1, name);
            preparedStatement.setString(2, password);
            ResultSet resultSet = preparedStatement.executeQuery();
            return resultSet.next();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return false;
    }
 
    public static List<UserInfo> getAllUsers() {
        List<UserInfo> userInfos = new ArrayList<UserInfo>();
        String sql;
        sql = " select * from users";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            ResultSet resultSet = preparedStatement.executeQuery();
            while (resultSet.next()) {
                UserInfo userInfo = new UserInfo();
                userInfo.setName(resultSet.getString(1));
                userInfo.setAccount(resultSet.getString(2));
                userInfo.setPassword(resultSet.getString(3));
                userInfo.setIntegral(resultSet.getInt(4));
                userInfo.setIcon(resultSet.getString(5));
                userInfos.add(userInfo);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return userInfos;
    }
 
    public static List<OrderInfo> getAllOrder(String name) {
        List<OrderInfo> orderInfos = new ArrayList<OrderInfo>();
        String sql;
        if (name.equals("")) {
            sql = " select * from foodorder";
        } else {
            sql = " select * from foodorder where user_name = '" + name + "' ";
        }
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            ResultSet resultSet = preparedStatement.executeQuery();
            while (resultSet.next()) {
                OrderInfo orderInfo = new OrderInfo();
                orderInfo.setOrderId(resultSet.getString(1));
                orderInfo.setUsername(resultSet.getString(2));
                orderInfo.setFoodid(resultSet.getInt(3));
                orderInfo.setDeskid(resultSet.getInt(4));
                orderInfo.setTime(resultSet.getString(5));
                orderInfo.setPaytype(resultSet.getString(6));
                orderInfos.add(orderInfo);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return orderInfos;
    }
 
    public static List<OrderInfo> getUnpayOrder() {
        List<OrderInfo> orderInfos = new ArrayList<OrderInfo>();
        String sql;
        sql = " select * from foodorder where paytype = ? ";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setString(1, "0");
            ResultSet resultSet = preparedStatement.executeQuery();
            while (resultSet.next()) {
                OrderInfo orderInfo = new OrderInfo();
                orderInfo.setOrderId(resultSet.getString(1));
                orderInfo.setUsername(resultSet.getString(2));
                orderInfo.setFoodid(resultSet.getInt(3));
                orderInfo.setDeskid(resultSet.getInt(4));
                orderInfo.setTime(resultSet.getString(5));
                orderInfo.setPaytype(resultSet.getString(6));
                orderInfos.add(orderInfo);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return orderInfos;
    }
 
    public static String getFoodName(int number) {
        String sql;
        sql = " select name from food where number = ?";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setInt(1, number);
            ResultSet resultSet = preparedStatement.executeQuery();
            if (resultSet.next()) {
                return resultSet.getString(1);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return null;
    }
 
    public static List<FoodInfo> getFoods(String type) {
        List<FoodInfo> foodInfos = new ArrayList<FoodInfo>();
        String sql;
        sql = " select * from food where type = ?";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setString(1, type);
            ResultSet resultSet = preparedStatement.executeQuery();
            while (resultSet.next()) {
                FoodInfo foodInfo = new FoodInfo();
                foodInfo.setNumber(resultSet.getInt(1));
                foodInfo.setName(resultSet.getString(2));
                foodInfo.setPrice(resultSet.getInt(3));
                foodInfo.setType(resultSet.getString(4));
                foodInfo.setIcon(resultSet.getString(5));
                foodInfo.setDescription(resultSet.getString(6));
                foodInfos.add(foodInfo);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return foodInfos;
    }
 
    public static boolean isFoodHave(int number) {
        String sql;
        sql = " select name from food where number = ?";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setInt(1, number);
            ResultSet resultSet = preparedStatement.executeQuery();
            return resultSet.next();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return false;
    }
 
    public static void insertFood(int number, String name, int price,
            String type, String icon, String description) {
        String sql = " insert into food(number , name , price , type , icon , description )values(?,?,?,?,?,?) ";
        DBUtil util = new DBUtil();
        Connection conn = util.openConn();
        try {
            PreparedStatement preparedStatement = conn.prepareStatement(sql);
 
            preparedStatement.setInt(1, number);
            preparedStatement.setString(2, name);
            preparedStatement.setInt(3, price);
            preparedStatement.setString(4, type);
            preparedStatement.setString(5, icon);
            preparedStatement.setString(6, description);
 
            preparedStatement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            util.closeConn(conn);
        }
    }
 
    public static List<ReviewInfo> getReviews() {
        List<ReviewInfo> reviewInfos = new ArrayList<ReviewInfo>();
        String sql;
        sql = " select * from reviews";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            ResultSet resultSet = preparedStatement.executeQuery();
            while (resultSet.next()) {
                ReviewInfo reviewInfo = new ReviewInfo();
                reviewInfo.setName(resultSet.getString(1));
                reviewInfo.setContent(resultSet.getString(2));
                reviewInfo.setTime(resultSet.getString(3));
                reviewInfos.add(reviewInfo);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return reviewInfos;
    }
 
    public static void addReview(String name, String content, String time) {
        String sql = " insert into reviews(name, content, time)values(?,?,?) ";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setString(1, name);
            preparedStatement.setString(2, content);
            preparedStatement.setString(3, time);
            preparedStatement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
    }
 
    public static Map getAllFoodId() {
        String sql;
        sql = " select food_id from foodorder";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            ResultSet resultSet = preparedStatement.executeQuery();
            Map foodIdMap = new HashMap();
            while (resultSet.next()) {
                int foodId = resultSet.getInt(1);
                if (foodIdMap.containsKey(foodId)) {
                    int value = (int) foodIdMap.get(foodId);
                    foodIdMap.put(foodId, value + 1);
                } else {
                    foodIdMap.put(foodId, 1);
                }
            }
            return foodIdMap;
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return null;
    }
 
    public static Map getOrderesFoodId(String name) {
        String sql;
        sql = " select food_id from foodorder where user_name = ?";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setString(1, name);
            ResultSet resultSet = preparedStatement.executeQuery();
            Map foodIdMap = new HashMap();
            while (resultSet.next()) {
                int foodId = resultSet.getInt(1);
                if (foodIdMap.containsKey(foodId)) {
                    int value = (int) foodIdMap.get(foodId);
                    foodIdMap.put(foodId, value + 1);
                } else {
                    foodIdMap.put(foodId, 1);
                }
            }
            return foodIdMap;
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return null;
    }
 
    public static void deleteAllInteresting() {
        String sql = " delete from allinteresting ";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
    }
    
    public static void insertInteresting(int[] array){
        String sql = " insert into allinteresting(food_id)values(?) ";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            connection.setAutoCommit(false);
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            int i = 0;
            while (i < Tools.ALL_INTERESTING_NUMBER) {
                preparedStatement.setInt(1, array[i]);
                preparedStatement.addBatch();
                i++;
            }
            preparedStatement.executeBatch();
            connection.commit();
            preparedStatement.clearBatch();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
    }
    
    public static void insertUserInteresting(String name , int[] array){
        String sql = " insert into userinteresting(user_name, food_id)values(?, ?) ";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            connection.setAutoCommit(false);
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            int i = 0;
            while (i < Tools.USER_INTERESTING_NUMBER) {
                preparedStatement.setString(1, name);
                preparedStatement.setInt(2, array[i]);
                preparedStatement.addBatch();
                i++;
            }
            preparedStatement.executeBatch();
            connection.commit();
            preparedStatement.clearBatch();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
    }
    
    public static List<String> getSimilarName(int foodId){
        List<String> userNames = new ArrayList<String>();
        String sql = " select user_name from userinteresting where food_id = ? ";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setInt(1, foodId);
            ResultSet resultSet = preparedStatement.executeQuery();
            while (resultSet.next()) {
                String name = resultSet.getString(1);
                userNames.add(name);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
        return userNames;
    }
    
    public static void addRecommemdFood(int id) {
        String sql = " insert into recommemd(food_id)values(?) ";
        DBUtil dbUtil = new DBUtil();
        Connection connection = dbUtil.openConn();
        try {
            PreparedStatement preparedStatement = connection
                    .prepareStatement(sql);
            preparedStatement.setInt(1, id);
            preparedStatement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            dbUtil.closeConn(connection);
        }
    }
}
代码已经上传github,下载地址 https://github.com/21503882/hair-mag

基于Spring+SpringMvc+Hibernate的咔咔发廊管理系统相关推荐

  1. 基于Spring+SpringMVC+hibernate实现的体检中心管理系统

    源码及论文下载: http://www.byamd.xyz/tag/java/ 摘 要 随着人们生活水平的不断提高,人们的保健意识随之增强,体检已普遍成为人们保健的重要部分.特殊职业的体检.各种职业病 ...

  2. java项目-第99期基于spring+springmvc+hibernate的在线问卷答题系统-计算机毕业设计

    java项目-第99期基于spring+springmvc+hibernate的在线问卷答题系统[毕业设计] [源码请到下载专栏下载] 1.项目简述 今天分享的项目是<在线问卷答题系统>, ...

  3. 基于Spring+SpringMVC+MyBatis超市进销存管理系统

    基于SSM超市进销存管理系统 一.系统介绍 二.功能展示 1.进货信息 2.退货信息 3.商品信息 4.商品类别 5.库存信息 6.库存预警 7.临期商品 8.销售信息 9.客户退货信息 10.客户信 ...

  4. Spring+SpringMVC+Hibernate整合(封装CRUD操作)

    前言:当前Web项目开发的框架主流应该非Spring+SpringMVC+Hibernate莫属,不管是工作还是学习中涉及框架技术,首先是要搭建一套运行环境,虽然网上框架整合的教程很多,但我还是输出此 ...

  5. Spring+SpringMVC+Hibernate实现投票/调查问卷网站

    使用SSH架构(Spring+SpringMVC+Hibernate)实现了简单的调查问卷网站.最终效果如图: 下面整理实现流程. 前言 1.SSH架构 SSH是MVC架构的一种实现. Spring. ...

  6. 基于Spring+SpringMvc+Mybatis开发javaWeb汽车维修管理系统

    你知道的越多,你不知道的越多 点赞再看,养成习惯 源码分享在文末,点赞关注,解锁更多毕业设计项目 企鹅:869192208 如果您有疑问或者见解,欢迎指教: 文章目录 一.开发背景 二. 需求分析 三 ...

  7. Spring+SpringMVC+Hibernate整合操作数据库 概述

    概述 Hibernate是一款优秀的ORM框架,能够连接并操作数据库,包括保存和修改数据.Spring MVC是Java的web框架,能够将Hibernate集成进去,完成数据的CRUD.Hibern ...

  8. Spring+SpringMvc+Hibernate 框架搭建

    2019独角兽企业重金招聘Python工程师标准>>> 框架篇:Spring+SpringMVC+hibernate整合开发 一.建立项目 1.新建一个空项目project 相当于e ...

  9. 基于Spring+SpringMvc实现的足球队管理系统

    项目编号:BS-XX-018 本项目基于Spring+Springmvc实现了一个足球队管理系统,系统功能完整,页面简洁大方,适合于毕业设计使用.下面展示一下系统的设计结构以及系统功能. 系统功能结构 ...

最新文章

  1. 浅显易懂 Makefile 入门 (01)— 什么是Makefile、为什么要用Makefile、Makefile规则、Makefile流程如何实现增量编译
  2. leetcode--长按键入--python
  3. 11. 系统信息监控
  4. 公众号质量改进调查问卷
  5. 第10章 例题 7-4 汉诺(Hanoi)塔问题
  6. 后端开发需要学什么_都2020年了,还在纠结学什么语言?| 后端篇
  7. UBI文件系统和镜像的制作及分区挂载说明
  8. C++ Semaphore信号量使用
  9. 设置文字不能被选中复制
  10. 前端下载音频的两种处理方式
  11. java SNS网络系统,Java源码:SNS社交管理系统JEESNS v1.3
  12. plc编程语言有几种?plc常用的编程语言
  13. 【视频】老外拍的阿里巴巴纪录片,讲述淘宝怎么打败eBay
  14. AI就是闭上眼想要一份凉皮,睁开眼就会有一份凉皮摆在眼前
  15. 赛格威机器人路萌中国首秀 开发者计划今年将在国内落地
  16. 技术分享,休闲娱乐一体的网站
  17. 不知道怎么建设企业文化?这里有个案例给你!
  18. GCN:图卷积神经网络
  19. 山东省第五届ACM省赛题——Colorful Cupcakes(四维dp)
  20. Linux中更改文件显示只读不可写

热门文章

  1. 导致 MySQL 索引失效
  2. 修改远程计算机的ip,利用psexec.exe和netsh远程修改IP地址
  3. 校招黑名单:好家伙,GitHub 上这个仓库火了!
  4. 认清自己的主干,不能大钱小钱都同等抓
  5. 框架手写系列---javassist修改字节码方式,实现美团Robust热修复框架
  6. 微信小程序商城项目实战(第五篇:购物车)
  7. mate20por3d人脸识别_华为mate20pro和苹果的人脸识别哪个更好呢?
  8. mysql 登入数据_登录MySQL数据库
  9. Linux-输出重定向命令
  10. 输出重定向Linux命令,Linux Shell重定向(输入输出重定向)精讲