MySQL期末答辩—仓库管理系统

仓库管理系统:仓库管理系统是一种基于互联网对实际仓库的管理平台,旨在提供一个方便、快捷、安全的存取货物和查询商品信息平台。该系统通过在线用户登录查询,可以线上操作线下具体出/入库操作、查询仓库商品信息、提高仓库运作效率,优化仓库使用流程等功能,实现了用户在网上对仓库操作的全流程。

ER图和数据库模型图

DDL语句

CREATE TABLE products (-- 产品表  
    product_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '商品ID',  
    product_name VARCHAR(255) NOT NULL COMMENT '商品名称',  
    product_category VARCHAR(100) NOT NULL COMMENT '商品类别',  
    specification VARCHAR(255) COMMENT '规格',  
    unit_price DECIMAL(10, 2) NOT NULL COMMENT '单价',  
    stock_quantity INT NOT NULL DEFAULT 0 COMMENT '库存数量'  
);
CREATE TABLE warehouses (-- 仓库表  
    warehouse_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '库房ID',  
    warehouse_name VARCHAR(255) NOT NULL COMMENT '库房名称',  
    location VARCHAR(255) NOT NULL COMMENT '位置',  
    area DECIMAL(10, 2) NOT NULL COMMENT '面积'  
); CREATE TABLE suppliers (-- 供应商表   
    supplier_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '供应商ID',  
    supplier_name VARCHAR(255) NOT NULL COMMENT '供应商名称',  
    contact_person VARCHAR(100) COMMENT '联系人',  
    phone_number VARCHAR(20) COMMENT '联系电话',  
    email VARCHAR(100) COMMENT '电子邮箱',  
    address VARCHAR(255) COMMENT '地址'  
);CREATE TABLE orders (-- 订单表   
    order_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '订单ID',  
    customer_name VARCHAR(255) NOT NULL COMMENT '客户名称',  
    order_date DATE NOT NULL COMMENT '订单日期',  
    total_amount DECIMAL(10, 2) NOT NULL COMMENT '订单总金额',  
    status ENUM('Pending', 'Shipped', 'Delivered', 'Cancelled') NOT NULL COMMENT '订单状态'  
);
CREATE TABLE employees (  
  employee_id int(11) NOT NULL AUTO_INCREMENT COMMENT '员工序号',  
  employee_name varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '员工姓名',  
  department varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门',  
  inventory_responsibility varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '员工职责',  
  inventory_count int(11) NULL DEFAULT NULL COMMENT '记录员工的库存数量',  
  employee_phone VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '员工电话',  
  PRIMARY KEY (employee_id) USING BTREE  
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE inventory_transactions (-- 库存表  
    transaction_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '出入库记录ID',  
    product_id INT,  
    warehouse_id INT,  
    employee_id INT,  
    transaction_type ENUM('In', 'Out') NOT NULL COMMENT '出入库类型',  
    quantity INT NOT NULL COMMENT '数量',  
    transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '交易时间',  
    FOREIGN KEY (product_id) REFERENCES products(product_id),  
    FOREIGN KEY (warehouse_id) REFERENCES warehouses(warehouse_id),  
    FOREIGN KEY (employee_id) REFERENCES employees(employee_id)  );DROP TABLE IF EXISTS `users`;-- 用户表
CREATE TABLE `users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `username` varchar(255) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL COMMENT '电子邮箱',
  `phone_number` varchar(20) DEFAULT NULL COMMENT '联系电话',
  `role` enum('Admin','User') NOT NULL COMMENT '角色',
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `email` (`email`),
  UNIQUE KEY `username` (`username`(50))
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
CREATE TABLE return_orders (-- 退货单表  
    return_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '退货单ID',  
    order_id INT NOT NULL COMMENT '原始订单ID',  
    customer_name VARCHAR(255) NOT NULL COMMENT '客户名称',  
    return_date DATE NOT NULL COMMENT '退货日期',  
    status ENUM('Pending', 'Refunded', 'Rejected') NOT NULL COMMENT '退货状态',  
    FOREIGN KEY (order_id) REFERENCES orders(order_id)  );
CREATE TABLE return_details (-- 退货明细表  
    detail_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '退货明细ID',  
    return_id INT NOT NULL COMMENT '退货单ID',  
    product_id INT NOT NULL COMMENT '商品ID',  
    quantity INT NOT NULL COMMENT '退货数量',  
    FOREIGN KEY (return_id) REFERENCES return_orders(return_id),  
    FOREIGN KEY (product_id) REFERENCES products(product_id)  );
CREATE TABLE order_details (-- 订单明细表  
    detail_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '订单明细ID',  
    order_id INT NOT NULL,  
    product_id INT NOT NULL,  
    quantity INT NOT NULL COMMENT '数量',  
    unit_price DECIMAL(10, 2) NOT NULL COMMENT '单价',  
    FOREIGN KEY (order_id) REFERENCES orders(order_id),  
    FOREIGN KEY (product_id) REFERENCES products(product_id)  );
CREATE TABLE purchase_orders (-- 采购单表  
    po_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '采购单ID',  
    supplier_id INT NOT NULL,  
    purchase_date DATE NOT NULL COMMENT '采购日期',  
    total_amount DECIMAL(10, 2) NOT NULL COMMENT '采购总金额',  
    status ENUM('Pending', 'Received', 'Cancelled') NOT NULL COMMENT '采购单状态',  
    FOREIGN KEY (supplier_id) REFERENCES suppliers(supplier_id)  );
CREATE TABLE inventory (-- 库存表  
    inventory_id INT AUTO_INCREMENT PRIMARY KEY COMMENT '库存记录ID',  
    product_id INT NOT NULL COMMENT '商品ID',  
    warehouse_id INT NOT NULL COMMENT '库房ID',  
    quantity INT NOT NULL DEFAULT 0 COMMENT '库存数量',  
    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',  
    FOREIGN KEY (product_id) REFERENCES products(product_id),  
    FOREIGN KEY (warehouse_id) REFERENCES warehouses(warehouse_id)  );




DML语句

 INSERT INTO products (product_name, product_category, specification, unit_price, stock_quantity)   
VALUES ('iPhone 13', '电子产品', '6.1英寸, 5G', 999.99, 100);  
INSERT INTO products (product_name, product_category, specification, unit_price, stock_quantity)   
VALUES ('MacBook Pro', '电子产品', '16英寸, M1芯片', 2499.99, 50);    
INSERT INTO products (product_name, product_category, specification, unit_price, stock_quantity)   
VALUES ('Nike Air Max', '运动鞋', '男款, 42码', 149.99, 200);   
INSERT INTO products (product_name, product_category, specification, unit_price, stock_quantity)   
VALUES ('Adidas Ultra Boost', '运动鞋', '女款, 38码', 129.99, 150);    
INSERT INTO products (product_name, product_category, specification, unit_price, stock_quantity)   
VALUES ('Sony WH-1000XM4', '音频设备', '无线蓝牙耳机, 降噪', 349.99, 80);   
INSERT INTO warehouses (warehouse_name, location, area)   
VALUES ('一号仓库', '北京市朝阳区', 1000.50);   
INSERT INTO warehouses (warehouse_name, location, area)   
VALUES ('二号仓库', '上海市浦东区', 1500.25);   
INSERT INTO warehouses (warehouse_name, location, area)   
VALUES ('三号仓库', '广州市天河区', 800.75);   
INSERT INTO warehouses (warehouse_name, location, area)   
VALUES ('四号仓库', '深圳市南山区', 1200.00);   
INSERT INTO warehouses (warehouse_name, location, area)   
VALUES ('五号仓库', '杭州市西湖区', 950.30);  
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('张三', '销售部', '库存管理', 500);   
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('李四', '物流部', '库存盘点', 300);   
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('王五', '生产部', '库存补货', 800);  
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('赵六', '财务部', '库存成本核算', NULL);   
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('孙七', '技术部', '库存系统维护', NULL); 
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('周八', '销售部', '库存管理', 650);  
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('吴九', '采购部', '库存采购', 400);   
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('郑十', '物流部', '库存出库', 250);  
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('陈十一', '生产部', '库存监控', 900);   
INSERT INTO employees (employee_name, department, inventory_responsibility, inventory_count)   
VALUES ('卫十二', '行政部', NULL, NULL);  
INSERT INTO inventory_transactions (product_id, warehouse_id, employee_id, transaction_type, quantity)   
VALUES (1, 1, 1, 'In', 10); -- 假设产品ID为1,仓库ID为1,员工ID为1,入库10个产品   
INSERT INTO inventory_transactions (product_id, warehouse_id, employee_id, transaction_type, quantity)   
VALUES (2, 1, 2, 'Out', 5); -- 假设产品ID为2,仓库ID为1,员工ID为2,出库5个产品   
INSERT INTO inventory_transactions (product_id, warehouse_id, employee_id, transaction_type, quantity)   
VALUES (1, 2, 3, 'In', 8); -- 假设产品ID为1,仓库ID为2,员工ID为3,入库8个产品 
INSERT INTO inventory_transactions (product_id, warehouse_id, employee_id, transaction_type, quantity)   
VALUES (3, 2, 4, 'Out', 3); -- 假设产品ID为3,仓库ID为2,员工ID为4,出库3个产品    
INSERT INTO inventory_transactions (product_id, warehouse_id, employee_id, transaction_type, quantity)   
VALUES (2, 3, 5, 'In', 15); -- 假设产品ID为2,仓库ID为3,员工ID为5,入库15个产品   
INSERT INTO inventory_transactions (product_id, warehouse_id, employee_id, transaction_type, quantity)   
VALUES (1, 3, 6, 'Out', 7); -- 假设产品ID为1,仓库ID为3,员工ID为6,出库7个产品  
INSERT INTO inventory_transactions (product_id, warehouse_id, employee_id, transaction_type, quantity)   
VALUES (4, 1, 7, 'In', 20); -- 假设产品ID为4,仓库ID为1,员工ID为7,入库20个产品
INSERT INTO suppliers (supplier_name, contact_person, phone_number, email, address)   
VALUES ('供应商A', '张三', '1234567890', 'supplierA@example.com', '北京市朝阳区');   
INSERT INTO suppliers (supplier_name, contact_person, phone_number, email, address)   
VALUES ('供应商B', '李四', '0987654321', 'supplierB@example.com', '上海市黄浦区');   
INSERT INTO suppliers (supplier_name, contact_person, phone_number, email, address)   
VALUES ('供应商C', '王五', '1112223333', 'supplierC@example.com', '广州市天河区');   
INSERT INTO suppliers (supplier_name, contact_person, phone_number, email, address)   
VALUES ('供应商D', '赵六', '2223334444', 'supplierD@example.com', '深圳市南山区');  
INSERT INTO suppliers (supplier_name, contact_person, phone_number, email, address)   
VALUES ('供应商E', '孙七', '3334445555', 'supplierE@example.com', '杭州市西湖区');   
INSERT INTO suppliers (supplier_name, contact_person, phone_number, email, address)   
VALUES ('供应商F', '周八', '4445556666', 'supplierF@example.com', '成都市武侯区');
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('王五', '2023-01-03', 220.75, 'Delivered');   
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('赵六', '2023-01-04', 75.25, 'Pending');   
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('孙七', '2023-01-05', 300.00, 'Shipped’);   
INSERT INTO orders (customer_name, order_d
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('张三', '2023-01-01', 100.00, 'Pending');   
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('李四', '2023-01-02', 150.50, 'Shipped');  
ate, total_amount, status)   
VALUES ('周八', '2023-01-06', 125.50, 'Delivered');    
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('吴九', '2023-01-07', 80.00, 'Cancelled');    
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('陈十', '2023-01-08', 180.25, 'Pending’); 
INSERT INTO orders (customer_name, order_date, total_amount, status)   
VALUES ('郑十一', '2023-01-09', 250.00, 'Shipped');  
INSERT INTO order_details (order_id, product_id, quantity, unit_price)   
VALUES (6, 1001, 1, 50.00);
INSERT INTO purchase_orders (supplier_id, purchase_date, total_amount, status)   
VALUES (1, '2023-01-01', 500.00, 'Pending');  
INSERT INTO purchase_orders (supplier_id, purchase_date, total_amount, status)   
VALUES (2, '2023-01-05', 700.50, 'Pending');  
INSERT INTO purchase_orders (supplier_id, purchase_date, total_amount, status)   
VALUES (1, '2023-01-10', 300.25, 'Received');   
INSERT INTO purchase_orders (supplier_id, purchase_date, total_amount, status)   
VALUES (3, '2023-01-15', 800.00, 'Pending');  
INSERT INTO purchase_orders (supplier_id, purchase_date, total_amount, status)   
VALUES (2, '2023-01-20', 650.75, 'Received');  
INSERT INTO purchase_orders (supplier_id, purchase_date, total_amount, status)   
VALUES (1, '2023-01-25', 400.00, 'Cancelled’);  
INSERT INTO inventory (product_id, warehouse_id, quantity)   
VALUES (1001, 1, 10);  
INSERT INTO inventory (product_id, warehouse_id, quantity)   
VALUES (1002, 2, 5);    
INSERT INTO inventory (product_id, warehouse_id, quantity)   
VALUES (1003, 1, 20);  
INSERT INTO inventory (product_id, warehouse_id, quantity)   
VALUES (1004, 3, 8);  
INSERT INTO inventory (product_id, warehouse_id, quantity)   
VALUES (1001, 2, 15);
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('adminuser1', 'encrypted_password1', 'adminuser1@example.com', '1234567890', 'Admin');  
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('standarduser1', 'encrypted_password2', 'standarduser1@example.com', '0987654321', 'User');   
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('alice', 'encrypted_password3', 'alice@alice.com', '5551234567', 'User');  
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('bob', 'encrypted_password4', 'bob@bob.com', '5557654321', 'User');    
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('charlie', 'encrypted_password5', 'charlie@charlie.com', '5556543210', 'Admin');   
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('david', 'encrypted_password6', 'david@david.com', '5551112222', 'User');   
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('eve', 'encrypted_password7', 'eve@example.net', '5559876543', 'Admin');   
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('frank', 'encrypted_password8', 'frank@example.org', '5553334444', 'User');    
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('george', 'encrypted_password9', 'george@george.com', '5558887777', 'User');   
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('helen', 'encrypted_password10', 'helen@helen.com', '5555678901', 'Admin');    
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('ian', 'encrypted_password11', 'ian@ian.com', '5552345678', 'User');  
INSERT INTO users (username, password, email, phone_number, role)   
VALUES ('jane', 'encrypted_password12', 'jane@jane.com', '5559012345', 'User’);
INSERT INTO return_orders (order_id, customer_name, return_date, status)   
VALUES (1001, 'John Doe', '2023-01-01', 'Pending');  
INSERT INTO return_orders (order_id, customer_name, return_date, status)   
VALUES (1002, 'Jane Smith', '2023-01-05', 'Refunded');   
INSERT INTO return_orders (order_id, customer_name, return_date, status)   
VALUES (1003, 'Bob Johnson', '2023-01-10', 'Rejected');  
INSERT INTO return_orders (order_id, customer_name, return_date, status)   
VALUES (1004, 'Alice Brown', '2023-01-15', 'Pending');   
INSERT INTO return_orders (order_id, customer_name, return_date, status)   
VALUES (1005, 'Mike Williams', '2023-01-20', 'Refunded');
INSERT INTO return_details (return_id, product_id, quantity)   
VALUES (1, 1001, 2); -- 假设退货单ID为1,商品ID为1001,退货数量为2  
INSERT INTO return_details (return_id, product_id, quantity)   
VALUES (1, 1002, 1); -- 假设退货单ID为1,商品ID为1002,退货数量为1   
INSERT INTO return_details (return_id, product_id, quantity)   
VALUES (2, 1001, 3); -- 假设退货单ID为2,商品ID为1001,退货数量为3  
INSERT INTO return_details (return_id, product_id, quantity)   
VALUES (2, 1003, 1); -- 假设退货单ID为2,商品ID为1003,退货数量为1   
INSERT INTO return_details (return_id, product_id, quantity)   
VALUES (3, 1004, 2); -- 假设退货单ID为3,商品ID为1004,退货数量为2  

查询

--基础查询:
SELECT username AS '姓名', phone_number AS '手机号' FROM users;
--模糊查询:
CREATE INDEX idx_product_name ON products(product_name);
--统计用户订单信息,查询所有用户的下单数量,并进行倒序排列
SELECT customer_name, COUNT(order_id) AS order_count FROM orders GROUP BY customer_name ORDER BY order_count DESC;
--查询用户的基本信息使用多表联合查询
SELECT user_id, username, email, phone_number, role FROM users;
--查看订单中下单最多的产品对应的类别
SELECT p.product_category, SUM(od.quantity) AS total_quantity FROM products p JOIN order_details od ON p.product_id = od.product_id GROUP BY p.product_category ORDER BY total_quantity DESC LIMIT 1;
--查询下单总金额最多的用户
SELECT u.*  
FROM users u  
JOIN (  
    SELECT customer_name, SUM(total_amount) AS total_spent  
    FROM orders  
    GROUP BY customer_name  
    ORDER BY total_spent DESC  
    LIMIT 1  
) AS top_spender ON u.username = top_spender.customer_name;

Trigger触发器

-- 触发器:当新增用户时,在inventory_transactions表中为该用户创建一个初始的库存记录(假设)  
DELIMITER //  
CREATE TRIGGER after_user_insert  
AFTER INSERT ON users  
FOR EACH ROW  
BEGIN  
    INSERT INTO inventory_transactions (employee_id, transaction_type, quantity, transaction_date)  
    VALUES (NEW.user_id, 'In', 0, NOW());  -- 这里假设员工ID和用户ID是相同的,并且只是作为一个演示,数量为0  
END;  
//  
DELIMITER ;
--产品表修改语句添加触发器
DELIMITER //  
CREATE TRIGGER before_product_update  
BEFORE UPDATE ON products  
FOR EACH ROW  
BEGIN  
    IF NEW.unit_price < OLD.unit_price * 0.9 OR NEW.unit_price > OLD.unit_price * 1.1 THEN  
        SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '商品售价上下浮动不能超过10%';  
    END IF;  
END;  
//  
DELIMITER ;
-- 触发器:当删除订单时,先删除订单详情表中的相关记录  
DELIMITER //  
CREATE TRIGGER before_order_delete  
BEFORE DELETE ON orders  
FOR EACH ROW  
BEGIN  
    DELETE FROM order_details WHERE order_id = OLD.order_id;  
END;  
//  
DELIMITER ;

存储过程

--查询产品库存是否符合所需产品数量,并统计订单总金额
DELIMITER //  
  CREATE PROCEDURE create_order_infos(  
    IN p_customer_name VARCHAR(255),  
    IN p_product_id INT,  
    IN p_quantity INT,  
    IN p_warehouse_id INT  )  
BEGIN  
    -- 声明变量  
    DECLARE v_order_id INT;  
    DECLARE v_product_stock INT;  
    DECLARE v_remaining_stock INT;  
   -- 开始事务  
    START TRANSACTION;  
  -- 1. 插入订单记录到orders表  
    INSERT INTO orders (customer_name, order_date, total_amount, status)  
    VALUES (p_customer_name, NOW(), 0, 'Pending');  
  -- 获取新订单的ID  
    SET v_order_id = LAST_INSERT_ID();  
  -- 2. 检查产品库存是否足够  
    SELECT quantity INTO v_product_stock FROM inventory WHERE product_id = p_product_id AND warehouse_id = p_warehouse_id FOR UPDATE;  
  IF v_product_stock >= p_quantity THEN  
        -- 3. 更新库存数量  
        SET v_remaining_stock = v_product_stock - p_quantity;  
        UPDATE inventory SET quantity = v_remaining_stock WHERE product_id = p_product_id AND warehouse_id = p_warehouse_id;  
        -- 假设这里还需要更新产品表的库存(不常见,但为了示例)  
        -- UPDATE products SET stock_quantity = stock_quantity - p_quantity WHERE product_id = p_product_id;  
        -- 4. 插入订单明细到order_details表  
        INSERT INTO order_details (order_id, product_id, quantity, unit_price)  
        SELECT v_order_id, p.product_id, p_quantity, p.unit_price  
        FROM products p  
        WHERE p.product_id = p_product_id;  
        -- 5. 计算订单总金额并更新orders表(假设单价不会变)  
        UPDATE orders o  
        JOIN (  
            SELECT order_id, SUM(quantity * unit_price) AS total_amount  
            FROM order_details  
            WHERE order_id = v_order_id  
        ) od ON o.order_id = od.order_id  
        SET o.total_amount = od.total_amount  
        WHERE o.order_id = v_order_id;  
-- 提交事务  
        COMMIT;  
        SELECT 'Order created successfully.' AS message;  
    ELSE  
        -- 库存不足,回滚事务  
        ROLLBACK;  
        SELECT 'Insufficient stock for the order.' AS message;  
    END IF;  
END //  
  
DELIMITER ;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/768451.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

一文包学会ElasticSearch的大部分应用场合

ElasticSearch 官网下载地址&#xff1a;Download Elasticsearch | Elastic 历史版本下载地址1&#xff1a;Index of elasticsearch-local/7.6.1 历史版本下载地址2&#xff1a;Past Releases of Elastic Stack Software | Elastic ElasticSearch的安装(windows) 安装前所…

1000T的文件怎么能快速从南京传到北京?最佳方案你肯定想不到

今天刷面试题看到一个有意思的面试题&#xff0c; 1000T的文件怎么能以最快速度从南京传到北京&#xff1f; 网络传输 首先我们考虑通过网络传输&#xff0c;需要多长时间。 我特地咨询了在运营商工作的同学&#xff0c;目前带宽&#xff1a; 家庭宽带下行最大1Gbps&#…

双指针系列第 8 篇:盛水最多的容器。几句话讲明白!

Leetcode 题目链接 思路 取首尾双指针和水量如下所示&#xff0c;设高度函数为 h ( i ) h(i) h(i)&#xff0c;在下图中 h ( l ) < h ( r ) h(l) < h(r) h(l)<h(r)。 观察以 l l l 为左边界所能构成的其他水量&#xff0c;与矮的右边界搭配结果如下。 与高的…

每日两题 / 20. 有效的括号 155. 最小栈(LeetCode热题100)

20. 有效的括号 - 力扣&#xff08;LeetCode&#xff09; 遇到左括号入栈 遇到右括号判断栈顶是否为匹配的左括号 最后判断栈是否为空 func isValid(s string) bool {var stk []runefor _, value : range s {if value ( || value { || value [ {stk append(stk, value)}…

计算机操作系统部分选填及大题整理

并发和&#xff08; 共享 &#xff09; 是操作系统的两个最基本的特征,&#xff08; 虚拟 &#xff09;和&#xff08; 异步 &#xff09; 是操作系统的重要特征&#xff0c;并发执行的程序失去可再现性现代操作系统的两个基本特征是&#xff08;程序的并发执行&#xff09;和资…

Docker 部署 Minio 对象存储服务器

文章目录 Github官网文档简介dockerdocker-compose.ymlmc 客户端mc 基础命令Golang 示例创建 test 账号密钥文件上传示例 Github https://github.com/minio/minio 官网 https://min.io/https://www.minio.org.cn/ 文档 https://www.minio.org.cn/docs/minio/kubernetes/up…

1.4 ROS2集成开发环境搭建

1.4.1 安装VSCode VSCode全称Visual Studio Code&#xff0c;是微软推出的一款轻量级代码编辑器&#xff0c;免费、开源而且功能强大。它支持几乎所有主流的程序语言的语法高亮、智能代码补全、自定义热键、括号匹配、代码片段、代码对比Diff、GIT 等特性&#xff0c;支持插件…

上位机第二弹

之前写的代码用上了 现在想想 &#xff0c;北向一侧还挺难搞&#xff0c;设计很巧妙

10 Posix API与网络协议栈

POSIX概念 POSIX是由IEEE指定的一系列标准,用于澄清和统一Unix-y操作系统提供的应用程序编程接口(以及辅助问题,如命令行shell实用程序),当您编写程序以依赖POSIX标准时,您可以非常肯定能够轻松地将它们移植到大量的Unix衍生产品系列中(包括Linux,但不限于此!)。 如…

使用pyinstaller 如何打包python项目

参考&#xff1a;【python项目正确打包方法-哔哩哔哩】 https://b23.tv/EDB6zbG Pyinstaller 详解多种打包过程(去坑,填坑)。_pyinstaller -f -w-CSDN博客 1.打开命令提示符&#xff1a; 找到python项目所在位置&#xff0c;输入cmd即可 2. 安装pipenv: 在命令提示符&#…

【Linux】多线程(一万六千字)

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 目录 文章目录 前言 线程的概念 线程的理解(Linux系统为例) 在Linux系统里如何保证让正文部分的代码可以并发的去跑呢&#xff1f; 为什么要有多进程呢&#xff1f; 为…

CVD-Risk-Prevent 个性化心血管健康推荐系统:基于医学指南的规则框架与 LLM 的结合

CVD-Risk-Prevent 个性化心血管健康推荐系统&#xff1a;基于医学指南的规则框架与 LLM 的结合 提出背景推荐算法的选择选择疑问健康指标管理心血管风险因素目标设定实现目标的计划推荐的多维性 算法关键点&#xff1a;如何将心血管健康指标转换为多维推荐&#xff1f;确定风险…

antfu/ni 在 Windows 下的安装

问题 全局安装 ni 之后&#xff0c;第一次使用会有这个问题 解决 在 powershell 中输入 Remove-Item Alias:ni -Force -ErrorAction Ignore之后再次运行 ni Windows 11 下的 Powershell 环境配置 可以参考 https://github.com/antfu-collective/ni?tabreadme-ov-file#how …

【操作系统】进程管理——调度基础(个人笔记)

学习日期&#xff1a;2024.7.3 内容摘要&#xff1a;调度的概念、层次&#xff0c;进程调度的时机&#xff0c;调度器和闲逛进程&#xff0c;调度算法的评价指标 调度的基本概念 有一堆任务需要处理&#xff0c;但由于资源有限&#xff0c;有的事情不能同时处理&#xff0c;这…

Django学习第三天

python manage.py runserver 使用以上的命令启动项目 实现新建用户数据功能 views.py文件代码 from django.shortcuts import render, redirect from app01 import models# Create your views here. def depart_list(request):""" 部门列表 ""&qu…

什么牌子的充电宝最好耐用?多款热门无线磁吸充电宝推荐

在现代生活中&#xff0c;手机、平板等电子设备已成为我们日常工作的必需品&#xff0c;而充电宝则是这些设备的续航神器&#xff01;无论是长途旅行、外出办公&#xff0c;还是日常通勤&#xff0c;一个耐用且高效的充电宝都是必不可少的选择。然而&#xff0c;市场上充电宝品…

如何选择适合自己的虚拟化技术?

虚拟化技术已成为现代数据中心和云计算环境的核心组成部分。本文将帮助您了解如何选择适合自己需求的虚拟化技术&#xff0c;以实现更高的效率、资源利用率和灵活性。 理解虚拟化技术 首先&#xff0c;让我们了解虚拟化技术的基本概念。虚拟化允许将一个物理服务器划分为多个虚…

探讨命令模式及其应用

目录 命令模式命令模式结构命令模式适用场景命令模式优缺点练手题目题目描述输入描述输出描述题解 命令模式 命令模式是一种行为设计模式&#xff0c; 它可将请求转换为一个包含与请求相关的所有信息的独立对象。 该转换让你能根据不同的请求将方法参数化、 延迟请求执行或将其…

玩玩快速冥(LeetCode50题与70题以及联系斐波那契)

一.算法快速幂 今天刷到两个题,比较有意思,还是记录一下. 先来讲讲50题. LeetCode50(Pow(x,n)) 实现 pow(x, n) &#xff0c;即计算 x 的整数 n 次幂函数&#xff08;即&#xff0c;xn &#xff09;。 这道题一看很平常啊,不就一直乘嘛,循环走一次就够了.但是很抱歉,单纯的想…

ArcTs布局入门04——相对布局 媒体查询

如果你也对鸿蒙开发感兴趣&#xff0c;加入“Harmony自习室”吧 扫描下面的二维码关注公众号。 本文将探讨相对布局与媒体查询&#xff0c;为啥把他们放到一起呢&#xff1f;主要是因为相对布局在响应式的场景下做得不太好&#xff0c;一般情况下和媒体查询&#xff08;不同尺…