下面都是我在CSDN发的文章好吧。

数据库课程设计——某工厂的物料管理系统(附Java源码与课程设计报告)
数据库课程设计——某商店进销存管理系统(附Java源码与课程设计报告)
数据库课程设计——某煤气公司送气管理系统(附课设报告)
数据库课程设计——基于JavaEE的企业进销存系统(附Java源码与课程设计报告)
Java课程设计——哈夫曼编码译码系统的Java语言实现
C语言课程设计——班级成绩管理系统(附课设报告)
C语言课程设计——排班系统 DFS解决(附课设报告)

O、1277750893 O、

题目:

某煤气公司送气管理系统
实现工作人员、客户信息的管理;
实现煤气类别和供应商的管理;
实现煤气入库管理和出库管理;
实现费用管理;
创建触发器,实现入库、出库时相应类型煤气的数量的增加或减少;
创建存储过程统计每个送气员工指定月份送气的数量;
创建存储过程查询指定月份用气量最大的前 10 个用户,并按用气量递减排列;
建立数据库相关表之间的参照完整性约束;
建立表间关系。

系统功能分析:

在这里插入图片描述

系统截图:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

课程设计报告截图:

在这里插入图片描述
在这里插入图片描述

ER图:

在这里插入图片描述

数据流图:

在这里插入图片描述

SQL代码:

/*
 Navicat Premium Data Transfer

 Source Server         : 2019122128
 Source Server Type    : MySQL
 Source Server Version : 50549
 Source Host           : localhost:3306
 Source Schema         : lichun_gas

 Target Server Type    : MySQL
 Target Server Version : 50549
 File Encoding         : 65001

 Date: 12/12/2021 22:04:57
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for lichun_client
-- ----------------------------
DROP TABLE IF EXISTS `lichun_client`;
CREATE TABLE `lichun_client`  (
  `client_id` int(6) NOT NULL AUTO_INCREMENT COMMENT '客户编号',
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
  `phone_number` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码',
  `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '地址',
  PRIMARY KEY (`client_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 300015 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for lichun_gas
-- ----------------------------
DROP TABLE IF EXISTS `lichun_gas`;
CREATE TABLE `lichun_gas`  (
  `gas_id` int(6) NOT NULL AUTO_INCREMENT COMMENT '煤气编号',
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
  `inventory` int(11) NOT NULL DEFAULT 0 COMMENT '库存量',
  `purchase_price` double NULL DEFAULT 0 COMMENT '进价',
  `price` double NOT NULL DEFAULT 0 COMMENT '售价',
  PRIMARY KEY (`gas_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 100005 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for lichun_instore
-- ----------------------------
DROP TABLE IF EXISTS `lichun_instore`;
CREATE TABLE `lichun_instore`  (
  `instore_id` int(6) NOT NULL AUTO_INCREMENT COMMENT '入库编号',
  `instore_date` date NULL DEFAULT NULL COMMENT '入库日期',
  `gas_id` int(6) NOT NULL COMMENT '煤气编号',
  `supplier_id` int(6) NOT NULL COMMENT '供应商编号',
  `purchase_price` double(8, 2) NOT NULL COMMENT '进价',
  `instore_quantity` int(6) NOT NULL COMMENT '入库数量',
  `instore_expenditure` double(10, 2) NULL DEFAULT NULL COMMENT '入库支出',
  PRIMARY KEY (`instore_id`) USING BTREE,
  INDEX `fk_instore_gas`(`gas_id`) USING BTREE,
  INDEX `fk_instore_supplier`(`supplier_id`) USING BTREE,
  CONSTRAINT `fk_instore_gas` FOREIGN KEY (`gas_id`) REFERENCES `lichun_gas` (`gas_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_instore_supplier` FOREIGN KEY (`supplier_id`) REFERENCES `lichun_supplier` (`supplier_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for lichun_outstore
-- ----------------------------
DROP TABLE IF EXISTS `lichun_outstore`;
CREATE TABLE `lichun_outstore`  (
  `outstore_id` int(6) NOT NULL AUTO_INCREMENT COMMENT '出库编号',
  `outstore_date` date NOT NULL COMMENT '出库日期',
  `gas_id` int(6) NOT NULL COMMENT '煤气编号',
  `outstore_quantity` int(6) NOT NULL COMMENT '出库数量',
  `outstore_income` double(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '出库收入',
  `staff_id` int(6) NOT NULL COMMENT '员工编号',
  `client_id` int(6) NOT NULL COMMENT '客户编号',
  PRIMARY KEY (`outstore_id`) USING BTREE,
  INDEX `fk_outstore_gas`(`gas_id`) USING BTREE,
  INDEX `fk_outstore_staff`(`staff_id`) USING BTREE,
  INDEX `fk_outstore_client`(`client_id`) USING BTREE,
  CONSTRAINT `fk_outstore_client` FOREIGN KEY (`client_id`) REFERENCES `lichun_client` (`client_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_outstore_gas` FOREIGN KEY (`gas_id`) REFERENCES `lichun_gas` (`gas_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_outstore_staff` FOREIGN KEY (`staff_id`) REFERENCES `lichun_staff` (`staff_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for lichun_staff
-- ----------------------------
DROP TABLE IF EXISTS `lichun_staff`;
CREATE TABLE `lichun_staff`  (
  `staff_id` int(6) NOT NULL AUTO_INCREMENT COMMENT '员工编号',
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
  `sex` int(1) NULL DEFAULT NULL COMMENT '性别',
  `age` int(2) NULL DEFAULT NULL COMMENT '年龄',
  `phone_number` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码',
  `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址',
  PRIMARY KEY (`staff_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 200006 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for lichun_supplier
-- ----------------------------
DROP TABLE IF EXISTS `lichun_supplier`;
CREATE TABLE `lichun_supplier`  (
  `supplier_id` int(6) NOT NULL AUTO_INCREMENT COMMENT '供应商编号',
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
  `phone_number` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '手机号码',
  `city` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '城市',
  PRIMARY KEY (`supplier_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 400005 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Procedure structure for queryandsort
-- ----------------------------
DROP PROCEDURE IF EXISTS `queryandsort`;
delimiter ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `queryandsort`(in theyear int, in themonth int)
begin
	select lichun_client.client_id as '客户编号', lichun_client.name as '姓名', SUM(outstore_quantity) as '用气量' from lichun_outstore, lichun_client
	where year(outstore_date) = theyear and month(outstore_date) = themonth and lichun_outstore.client_id = lichun_client.client_id
	group by lichun_outstore.client_id
	order by outstore_quantity desc
	limit 10;
end
;;
delimiter ;

-- ----------------------------
-- Procedure structure for statisitcs
-- ----------------------------
DROP PROCEDURE IF EXISTS `statisitcs`;
delimiter ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `statisitcs`(in theyear int, in themonth int)
begin
	select lichun_staff.staff_id as '员工编号', lichun_staff.name as '姓名', SUM(outstore_quantity) as '送气量' from lichun_outstore, lichun_staff
	where year(outstore_date) = theyear and month(outstore_date) = themonth and lichun_outstore.staff_id = lichun_staff.staff_id
	group by lichun_outstore.staff_id;
end
;;
delimiter ;

-- ----------------------------
-- Triggers structure for table lichun_instore
-- ----------------------------
DROP TRIGGER IF EXISTS `calculate_instore_expenditure`;
delimiter ;;
CREATE TRIGGER `calculate_instore_expenditure` BEFORE INSERT ON `lichun_instore` FOR EACH ROW begin

	set new.instore_expenditure = new.purchase_price * new.instore_quantity;
	
	set new.instore_date = now();

end
;;
delimiter ;

-- ----------------------------
-- Triggers structure for table lichun_instore
-- ----------------------------
DROP TRIGGER IF EXISTS `set_purchase_price_and_inventory`;
delimiter ;;
CREATE TRIGGER `set_purchase_price_and_inventory` AFTER INSERT ON `lichun_instore` FOR EACH ROW begin


	update lichun_gas set inventory = inventory + NEW.instore_quantity where gas_id = NEW.gas_id;


	update lichun_gas set purchase_price = NEW.purchase_price where gas_id = NEW.gas_id;


	update lichun_gas set price = NEW.purchase_price * 1.2 where gas_id = NEW.gas_id;


end
;;
delimiter ;

-- ----------------------------
-- Triggers structure for table lichun_outstore
-- ----------------------------
DROP TRIGGER IF EXISTS `calculate_outstore_expenditure`;
delimiter ;;
CREATE TRIGGER `calculate_outstore_expenditure` BEFORE INSERT ON `lichun_outstore` FOR EACH ROW begin

	set new.outstore_income = new.outstore_quantity * (select price from lichun_gas where gas_id = NEW.gas_id);

	set new.outstore_date = now();


end
;;
delimiter ;

-- ----------------------------
-- Triggers structure for table lichun_outstore
-- ----------------------------
DROP TRIGGER IF EXISTS `set_inventory`;
delimiter ;;
CREATE TRIGGER `set_inventory` AFTER INSERT ON `lichun_outstore` FOR EACH ROW update lichun_gas set inventory = inventory - NEW.outstore_quantity where gas_id = NEW.gas_id
;;
delimiter ;

SET FOREIGN_KEY_CHECKS = 1;

数据字典

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Logo

快速构建 Web 应用程序

更多推荐