超市订单管理系统smbms.zip


适用Tomcat、Maven、Java、Mysql开发的一个JavaWeb,用来管理超市订单,可以管理用户、订单、供应商等内容
资源截图
代码片段和文件信息
package com.sqq.dao;

import com.sun.org.apache.xpath.internal.operations.Bool;

import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.Properties;

//操作数据库的公共类
public class baseDao {
    private static String driver;
    private static String url;
    private static String username;
    private static String password;

    //静态代码块,类加载的时候就初始化了
    static {
        Properties properties = new Properties();
        //通过类加载器读取对应的资源
        InputStream is = baseDao.class.getClassLoader().getResourceAsStream(“db.properties“);

        try {
            properties.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }

        driver = properties.getProperty(“driver“);
        url = properties.getProperty(“url“);
        username = properties.getProperty(“username“);
        password = properties.getProperty(“password“);

    }

    //获取数据库的连接
    public static Connection getConnection(){
        Connection connection = null;
        try {
            Class.forName(driver);
            connection= DriverManager.getConnection(urlusernamepassword);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return connection;
    }

    //编写查询公共类
    public static ResultSet execute(Connection connection PreparedStatement preparedStatement   ResultSet resultSet String sql object[] params) throws SQLException {
        //预编译的sql,在后面直接执行就可以了
        preparedStatement = connection.prepareStatement(sql);
        for (int i = 0; i             //setobject占位符从1开始,但是我们的数组是从0开始
            preparedStatement.setobject(i+1params[i]);
        }
        resultSet=preparedStatement.executeQuery();
        return  resultSet;
    }

    //编写增删改公共类
    public static int execute(Connection connectionPreparedStatement preparedStatement String sql object[] params) throws SQLException {
        preparedStatement = connection.prepareStatement(sql);
        for (int i = 0; i             //setobject占位符从1开始,但是我们的数组是从0开始
            preparedStatement.setobject(i+1params[i]);
        }
        int updateRows=preparedStatement.executeUpdate();
        return  updateRows;
    }

    //释放资源
    public static boolean closeResource(Connection connectionPreparedStatement preparedStatementResultSet resultSet){
        Boolean flag = true;

        if(connection!=null){
            try {
                connection.close();
                //GC回收
                connection=null;
            } catch (SQLException e) {
                e.printStackTrace();
                flag=false;
            }
        }

        if(preparedStatement!=null){
            try {
                preparedStatement.close();
                //GC回收
                preparedStatement=null;
            } catch (SQLException e) {
                e.printStackTrace();
          

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-05-11 11:00  smbms
     目录           0  2020-05-11 11:02  smbms.git
     文件          13  2020-05-11 11:01  smbms.gitCOMMIT_EDITMSG
     文件          23  2020-05-11 11:00  smbms.gitHEAD
     文件         280  2020-05-11 12:55  smbms.gitconfig
     文件          73  2020-05-11 11:00  smbms.gitdescription
     目录           0  2020-05-11 11:00  smbms.githooks
     文件         478  2020-05-11 11:00  smbms.githooksapplypatch-msg.sample
     文件         896  2020-05-11 11:00  smbms.githookscommit-msg.sample
     文件        3079  2020-05-11 11:00  smbms.githooksfsmonitor-watchman.sample
     文件         189  2020-05-11 11:00  smbms.githookspost-update.sample
     文件         424  2020-05-11 11:00  smbms.githookspre-applypatch.sample
     文件        1638  2020-05-11 11:00  smbms.githookspre-commit.sample
     文件         416  2020-05-11 11:00  smbms.githookspre-merge-commit.sample
     文件        1348  2020-05-11 11:00  smbms.githookspre-push.sample
     文件        4898  2020-05-11 11:00  smbms.githookspre-rebase.sample
     文件         544  2020-05-11 11:00  smbms.githookspre-receive.sample
     文件        1492  2020-05-11 11:00  smbms.githooksprepare-commit-msg.sample
     文件        3610  2020-05-11 11:00  smbms.githooksupdate.sample
     文件          65  2020-05-11 11:01  smbms.gitindex
     目录           0  2020-05-11 11:00  smbms.gitinfo
     文件         240  2020-05-11 11:00  smbms.gitinfoexclude
     目录           0  2020-05-11 11:01  smbms.gitobjects
     目录           0  2020-05-11 11:01  smbms.gitobjects4b
     文件          15  2020-05-11 11:01  smbms.gitobjects4b825dc642cb6eb9a060e54bf8d69288fbee4904
     目录           0  2020-05-11 13:03  smbms.gitobjectsinfo
     目录           0  2020-05-11 13:03  smbms.gitobjectspack
     目录           0  2020-05-11 11:00  smbms.git
efs
     目录           0  2020-05-11 13:03  smbms.git
efsheads
     目录           0  2020-05-11 13:03  smbms.git
efs ags
     目录           0  2020-05-11 10:54  smbms.idea
............此处省略555个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)