ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

软件工程学习期末周总结

2022-07-10 08:00:08  阅读:113  来源: 互联网

标签:总结 restaurant tr 软件工程 期末 child table NULL border


本周一直在进行数据库的小学期学习  因此更加熟练地掌握了数据库的应用

 

一、功能概述

    通用销售管理系统是建立在信息技术基础上,以系统化的管理思想,为餐饮品牌提供加盟管理和用户信息管理的平台,其核心思想是餐饮加盟管理,即从加盟管理范围去优化餐饮品牌开分店方面的信息。它整合了回到首页、客户信息、店铺资料、业务管理、信息查询、安全退出六个功能模块。通用餐饮品牌管理系统是以管理为中心,整合加盟,意向等管理流程,优化餐饮品牌资源。

1.登录

     登录这一模块,主要功能有:用户输入账号与密码,并对账号与密码的输入情况进行处理,新用户注册以及对注册内容的审核,提交和重置。其中除了重置的其余各个部分都与数据库进行了连接与相应的增、查、匹配工作。

2.用户注册

     这一模块,主要是采集新用户的信息,包括账号,密码,邮箱,电话。同时,系统自动将其存入SQL数据库,便于以后查看与使用。

3.加盟管理

      加盟业务页面可以显示店铺编号、店铺剩余可加盟数量、加盟数量和操作。在该模块,可以进行添加加盟信息操作,同时可以进行查看详细信息和删除加盟信息操作。添加加盟信息中,需要采集品牌编号、加盟数量、加盟价格、加盟客户名称,加盟地址等数据,数据库提供增,删,改,查功能。

4.加盟意向管理

     加盟意向管理页面可以显示品牌编号,餐饮品牌名称,意向加盟数量以及加盟价格等。在该模块可以进行添加加盟意向信息操作,同时可以查看详细信息和删除加盟意向操作。

二、数据库设计

   1.dingdan

 

Field

Type

Comment

 

id

int NOT NULL

 

 

user

varchar(255) NOT NULL

 

 

restaurant_id

int NOT NULL

 

 

restaurant_num

int NOT NULL

 

 

restaurant_price

int NOT NULL

 

 

restaurant_sum_price

int NOT NULL

 

 

user_address

varchar(255) NOT NULL

 

 

zhuangtai

varchar(255) NOT NULL

 

 

2.restaurant

 

Field

Type

Comment

 

id

int NOT NULL

 

 

restaurant_name

varchar(255) NOT NULL

 

 

restaurant_desc

text NOT NULL

 

 

restaurant_address

varchar(255) NOT NULL

 

 

restaurant_price

varchar(255) NOT NULL

 

 

restaurant_spec

varchar(255) NOT NULL

 

 

   3.shopping_cart

 

Field

Type

Comment

 

id

int NOT NULL

 

 

user

varchar(255) NOT NULL

 

 

restaurant_id

int NOT NULL

 

 

restaurant_num

int NOT NULL

 

 

restaurant_price

int NOT NULL

 

 

restaurant_sum_price

int NOT NULL

 

 

 

   4.user

 

Field

Type

Comment

 

username

varchar(255) NOT NULL

 

 

password

varchar(255) NOT NULL

 

 

email

varchar(255) NOT NULL

 

 

tel

varchar(255) NOT NULL

 

 

 

三、关键代码

  1.数据库表

数据库: `restaurant`

 

表的结构 `restaurant`

CREATE TABLE `restaurant` (

  `id` int(11) NOT NULL,

  `restaurant_name` varchar(100) NOT NULL,

  `restaurant_desc` text NOT NULL,

  `restaurant_address` varchar(255) NOT NULL,

  `restaurant_price` varchar(50) NOT NULL,

  `restaurant_spec` varchar(100) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;ALTER TABLE `restaurant`

  ADD PRIMARY KEY (`id`);

 

表的结构 `shopping_cart`

CREATE TABLE `shopping_cart` (

  `id` int(11) NOT NULL,

  `user` varchar(100) NOT NULL,

  `restaurant_id` text NOT NULL,

  `restaurant_num` int(11) NOT NULL,

  `restaurant_price` int(50) NOT NULL,

  `restaurant_sum_price` int(255) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

表的索引 `shopping_cart`

ALTER TABLE `shopping_cart`

  ADD PRIMARY KEY (`id`);

 

表的结构 `user`

CREATE TABLE `user` (

  `username` varchar(255) NOT NULL,

  `password` varchar(255) NOT NULL,

  `email` varchar(255) NOT NULL,

  `tel` varchar(255) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

表的索引 `user`

ALTER TABLE `user`

  ADD PRIMARY KEY (`username`);

 

CREATE TABLE `dingdan` (

  `id` int(11) NOT NULL,

  `user` varchar(255) NOT NULL,

  `restaurant_id` int(32) NOT NULL,

  `restaurant_num` int(30) NOT NULL,

  `restaurant_price` int(30) NOT NULL,

  `restaurant_sum_price` int(32) NOT NULL,

  `user_address` varchar(255) NOT NULL,

  `zhuangtai` varchar(255) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;表的索引`dingdan`

ALTER TABLE `dingdan`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

 

  1. 数据库连接

<?php

class Mysql{

    private $host;

    private $root;

    private $passwords;

    private $database;

 

    #析构函数,具有构造函数的类,在创建对象时会调用构造函数,完成一些初始化的操作。

    function __construct($host,$root,$passwords,$database){

        $this->host = $host;        # $this-> 在类本身内部使用本类的属性或者方法

        $this->root = $root;

        $this->passwords = $passwords;

        $this->database = $database;

        $this->connect();

    }

 

    #连接数据库

    function connect(){

        $this->conn=mysqli_connect($this->host,$this->root,$this->passwords); #连接数据库服务器

        mysqli_query($this->conn,"set names utf8"); #设置字符集

        mysqli_select_db($this->conn,$this->database); #选择数据库

    }

 

    #创建查询结果集

    function query($sql){

        return mysqli_query($this->conn,$sql);

    }

 

    #返回结果集中的记录总数

    function rows($result){

        return mysqli_num_rows($result);

    }

 

    #自定义查询方法selectbyId

    function selectbyUser($table,$username){

        return $this->query("SELECT * FROM $table where username='$username'");

    }

 

    //自定义插入数据方法

    function insert($table,$username,$password,$email,$tel){

        $this->query("INSERT INTO $table (username,password,email,tel) VALUES ('$username','$password','$email','$tel')");

//        $affected = mysqli_affected_rows($this);

//        if ($affected !== 1) {

//            $GLOBALS['error_message'] = '添加数据失败';

//            return;

//        }

    }

 

    function findpwd($table,$email)

    {

        return $this->query("SELECT * FROM $table where email='$email'");

    }

 

    #mysql_fetch_assoc() 函数从结果集中取得一行作为关联数组。

    function assoc($result){

        return mysqli_fetch_assoc($result);

    }

 

    #数据库关闭

    function dbClose(){

        mysqli_close($this->conn);

    }

}

$db = new Mysql("localhost","root","zyz020716","restaurant");

?>

3.餐饮品牌信息页面代码:

 

<?php

include ('limit.php');

?>

<!DOCTYPE html>

<head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>商品信息管理</title>

    <link href="http://cdn.bootcss.com/highlight.js/8.0/styles/monokai_sublime.min.css" rel="stylesheet">

    <link rel="stylesheet" href="../css/heightlength.css">

    <link rel="stylesheet" href="../css/mxjs.css">

 

    <style>

        .button {

            border-color: cornsilk;

            background-color: rgba(100, 149, 237, .7);

            color: aliceblue;

            border-style: hidden;

            border-radius: 5px;

            width: 100px;

            height: 31px;

            font-size: 16px;

            margin-top: 30px;

        }

    </style>

    <!--表格效果-->

    <style>

        #table_wrap > table {

            font-size: 16px;

            text-align: center;

            margin: 0 auto;

            border-collapse: separate;

            border-spacing: 0;

            border: 2px #000;

        }

 

        table thead tr, table tbody tr {

            height: 50px;

            line-height: 50px;

            /*background-color: pink;*/

        }

 

        table tr th:first-child, table tr td:first-child { /*设置table左边边框*/

            border-left: 2px solid #eaeaea;

        }

 

        table tr th:last-child, table tr td:last-child { /*设置table右边边框*/

            border-right: 2px solid #eaeaea;

        }

 

        table tr td:first-child,

        table tr td:nth-child(2),

        table tr td:nth-child(3),

        table tr td:last-child { /*设置table表格每列底部边框*/

            border-bottom: 2px solid #eaeaea;

        }

 

        /*table tr:last-child td:first-child,

        table tr:last-child td:nth-child(2),

        table tr:last-child td:nth-child(3),

        table tr:last-child td:last-child{/!*设置table表格最后一列底部边框*!/

            border-bottom: 2px solid #000;

        }*/

        table tr th {

            background: #eaeaea;

        }

 

        table tr:first-child th:first-child {

            border-top-left-radius: 12px;

        }

 

        table tr:first-child th:last-child {

            border-top-right-radius: 12px;

        }

 

        table tr:last-child td:first-child {

            border-bottom-left-radius: 12px;

        }

 

        table tr:last-child td:last-child {

            border-bottom-right-radius: 12px;

        }

 

        /*奇数*/

        table tr:nth-child(odd) {

            background: antiquewhite;

        }

 

        /*偶数*/

        table tr:nth-child(even) {

            background: floralwhite;

        }

 

    </style>

 

</head>

<body class="mScroll">

<div class="container">

    <div class="jsbg">

        <div class="col-lg-12 mxlength">

            <div class="mx-1">

                <h2 style="text-align:center;">商品信息管理</h2>

                <h5 style="text-align: right"><a href="add.html" class="btn btn-primary" style="">添加商品信息</a></h5><br>

                <div id="table_wrap">

                    <table class="table" width="800" cellspacing="0" cellpadding="0">

                        <thead class="table_head">

                        <tr>

                            <th class="text-center">品牌名</th>

                            <th class="text-center">描述</th>

                            <th class="text-center">发源地</th>

                            <th class="text-center">加盟费用</th>

                            <th class="text-center">可加盟数量</th>

                            <th class="text-center">操作</th>

                        </tr>

                        </thead>

                        <tbody>

                        <?php

                        $conn = mysqli_connect("localhost", "root", "zyz020716", "restaurant") or die("数据库连接失败");

                        mysqli_query($conn, 'set names utf8');

                        $sql = "select * from restaurant";

                        $result = mysqli_query($conn, $sql) or die("数据查询失败");

                        while ($row = mysqli_fetch_assoc($result)): ?>

                            <tr class="text-center">

                                <td><?php echo $row['restaurant_name']; ?></td>

                                <td><?php echo $row['restaurant_desc']; ?></td>

                                <td><?php echo $row['restaurant_address']; ?></td>

                                <td><?php echo $row['restaurant_price']; ?>元</td>

                                <td><?php echo $row['restaurant_spec']; ?>支</td>

 

                                <td>

                                    <a href="edit_get.php?id=<?php echo $row['id']; ?>" class="btn btn-primary">修改</a>

                                    <a href="del.php?id=<?php echo $row['id']; ?>" class="btn btn-danger">删除</a>

                                </td>

                            </tr>

                        <?php endwhile; ?>

                        </tbody>

                    </table>

                </div>

            </div>

        </div>

    </div>

</div>

<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>

<script src="http://cdn.bootcss.com/highlight.js/8.0/highlight.min.js"></script>

<script src="../js/smoothscroll.js"></script>

<script src="../js/mking.js"></script>

</body>

 

4.订单删除代码:

 

<?php

// 1. 接收传递过来的id

if(empty($_GET['id'])){

    exit('<h1>连接数据库失败</h1>');

}

$id = $_GET['id'];

// 2. 连接数据库

$link = mysqli_connect('localhost', 'root', 'zyz020716', 'restaurant');

mysqli_query($link,"set names 'utf8'");

// 3. 删除该条数据

$query = mysqli_query($link,"delete from dingdan where id = '$id'");

// 4. 查询失败的处理

if (!$query) {

    exit('<h1>查询数据失败</h1>');

}

// 5. 受影响的行数

$affected_rows = mysqli_affected_rows($link);

// 6. 删除失败

if ($affected_rows <= 0) {

    exit('<h1>删除失败</h1>');

}

header('Location:Admin_dingdan.php');

?>

 

5.用户管理模块:

<?php

include ('limit.php');

?>

<!DOCTYPE html>

<head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>用户管理模块</title>

    <link href="http://cdn.bootcss.com/highlight.js/8.0/styles/monokai_sublime.min.css" rel="stylesheet">

    <link rel="stylesheet" href="../css/heightlength.css">

    <link rel="stylesheet" href="../css/mxjs.css">

 

    <style>

        .button {

            border-color: cornsilk;

            background-color: rgba(100, 149, 237, .7);

            color: #f0f8ff;

            border-style: hidden;

            border-radius: 5px;

            width: 100px;

            height: 31px;

            font-size: 16px;

            margin-top: 30px;

        }

    </style>

    <!--表格效果-->

    <style>

        #table_wrap > table {

            font-size: 16px;

            text-align: center;

            margin: 0 auto;

            border-collapse: separate;

            border-spacing: 0;

            border: 2px #000;

        }

 

        table thead tr, table tbody tr {

            height: 50px;

            line-height: 50px;

            /*background-color: pink;*/

        }

 

        table tr th:first-child, table tr td:first-child { /*设置table左边边框*/

            border-left: 2px solid #eaeaea;

        }

 

        table tr th:last-child, table tr td:last-child { /*设置table右边边框*/

            border-right: 2px solid #eaeaea;

        }

 

        table tr td:first-child,

        table tr td:nth-child(2),

        table tr td:nth-child(3),

        table tr td:last-child { /*设置table表格每列底部边框*/

            border-bottom: 2px solid #eaeaea;

        }

 

        /*table tr:last-child td:first-child,

        table tr:last-child td:nth-child(2),

        table tr:last-child td:nth-child(3),

        table tr:last-child td:last-child{/!*设置table表格最后一列底部边框*!/

            border-bottom: 2px solid #000;

        }*/

        table tr th {

            background: #eaeaea;

        }

 

        table tr:first-child th:first-child {

            border-top-left-radius: 12px;

        }

 

        table tr:first-child th:last-child {

            border-top-right-radius: 12px;

        }

 

        table tr:last-child td:first-child {

            border-bottom-left-radius: 12px;

        }

 

        table tr:last-child td:last-child {

            border-bottom-right-radius: 12px;

        }

 

        /*奇数*/

        table tr:nth-child(odd) {

            background: antiquewhite;

        }

 

        /*偶数*/

        table tr:nth-child(even) {

            background: floralwhite;

        }

 

    </style>

 

</head>

<body class="mScroll">

<div class="container">

    <div class="jsbg">

        <div class="col-lg-12 mxlength">

            <div class="mx-1">

                <h2 style="text-align:center;">用户管理模块</h2>

 

                <div id="table_wrap">

                    <table class="table" width="800" cellspacing="0" cellpadding="0">

                        <thead class="table_head">

                        <tr>

                            <th class="text-center">用户</th>

                            <th class="text-center">密码</th>

                            <th class="text-center">邮件</th>

                            <th class="text-center">电话</th>

                        </tr>

                        </thead>

                        <tbody>

                        <?php

                        $conn = mysqli_connect("localhost", "root", "zyz020716", "restaurant") or die("数据库连接失败");

                        mysqli_query($conn, 'set names utf8');

                        $sql = "select * from user";

                        $result = mysqli_query($conn, $sql) or die("数据查询失败");

                        while ($row = mysqli_fetch_assoc($result)): ?>

                            <tr class="text-center">

                                <td><?php echo $row['username']; ?></td>

                                <td><?php echo $row['password']; ?></td>

                                <td><?php echo $row['email']; ?></td>

                                <td><?php echo $row['tel']; ?></td>

                            </tr>

                        <?php endwhile; ?>

                        </tbody>

                    </table>

                </div>

            </div>

        </div>

    </div>

</div>

<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>

<script src="http://cdn.bootcss.com/highlight.js/8.0/highlight.min.js"></script>

<script src="../js/smoothscroll.js"></script>

<script src="../js/mking.js"></script>

</body>

 

 

四、小结

通过此次数据库的小学期,我接触了PHP的基本知识,了解了PHP的基本语法,同时在PHPStorm中编写了一些简单的PHP语言,但是比较复杂的PHP语法我一点都不了解,只能是像此次实验一样,在通用管理系统中对部分代码作一些修改,但是自己独立完成一个较大的系统仍有很大的困难,与其他同学还存在着差距。在界面设计的时候,想做出一个左侧导航右侧内容的布局,并且调配出一种适合我们团队风格的一种颜色作为主体的色彩,为蓝色。之后在网上查找了许多的相关资料,最后决定使用网上的css模板,而后便将模板改为自己想要的样式,并且通过各种颜色的对比,最后决定使用偏粉色系的颜色来作为我们团队的主题颜色。之后在数据库对订单的增删改和session与cookie不熟练,之后查阅网络相关知识,看了相关的代码,嵌到页面中。总之,这次小学期,让我认识到了自己与其他同学的差距,给了我课下继续努力的动力,同时我也意识到计算机语言的种类真的是太多了,要是做到每一门语言都精通,真是难上加难,我决定利用即将到来的暑期实践,继续巩固自己的知识,把数据库连接掌握好,并进一步学习动态网页的制作以缩小与其他同学的差距。

标签:总结,restaurant,tr,软件工程,期末,child,table,NULL,border
来源: https://www.cnblogs.com/z13516221762/p/16462492.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有