基于Java的景区售票信息管理系统

news2024/11/18 5:50:18

1.设计要求

(1)要求每个学生独立完成期末作品,在遇到问题时,同学之间可以相互讨论,但切忌复制他人程序。

(2)根据期末作品题目,自己编写程序,上机调试程序,并得到正确的运行结果。

(3)认真撰写期末作品文档,给出核心源代码以及程序的运行结果,并分析运行结果,给出遇到的问题和解决办法。

2.运行环境

Eclipse+JDK1.8及以上+MySQL

3.主要内容

要求完成一个景区售票信息管理系统,使用者能够登录并完成对信息的添加、删除、修改、查询等操作。

4.核心代码

4.1 代码结构

4.2 实体类

AdminInfo实体类AdminInfo.java

package com.sell.model;

/**

 * 管理员信息

 */

public class AdminInfo {

    private Integer id;

    private String username;

    private String password;

    public Integer getId() {

        return id;

    }

    public void setId(Integer id) {

        this.id = id;

    }

    public String getUsername() {

        return username;

    }

    public void setUsername(String username) {

        this.username = username;

    }

    public String getPassword() {

        return password;

    }

    public void setPassword(String password) {

        this.password = password;

    }

    public AdminInfo(Integer id, String username, String password) {

        this.id = id;

        this.username = username;

        this.password = password;

    }

    public AdminInfo() {

    }

    @Override

    public String toString() {

        return "AdminInfo{" +

                "id=" + id +

                ", username='" + username + '\'' +

                ", password='" + password + '\'' +

                '}';

    }

}

Order实体类Order.java

package com.sell.model;

public class Order {

    private Integer id;

    private String cusname;

    private String cardID;

    private String count;

    private String price;

    private String buydate;

    private Integer mpId;

    public Integer getId() {

        return id;

    }

    public void setId(Integer id) {

        this.id = id;

    }

    public String getCusname() {

        return cusname;

    }

    public void setCusname(String cusname) {

        this.cusname = cusname;

    }

    public String getCardID() {

        return cardID;

    }

    public void setCardID(String cardID) {

        this.cardID = cardID;

    }

    public String getCount() {

        return count;

    }

    public void setCount(String count) {

        this.count = count;

    }

    public String getPrice() {

        return price;

    }

    public void setPrice(String price) {

        this.price = price;

    }

    public String getBuydate() {

        return buydate;

    }

    public void setBuydate(String buydate) {

        this.buydate = buydate;

    }

    public Integer getMpId() {

        return mpId;

    }

    public void setMpId(Integer mpId) {

        this.mpId = mpId;

    }

    public Order(Integer id, String cusname, String cardID, String count, String price, String buydate, Integer mpId) {

        this.id = id;

        this.cusname = cusname;

        this.cardID = cardID;

        this.count = count;

        this.price = price;

        this.buydate = buydate;

        this.mpId = mpId;

    }

    public Order() {

    }

    @Override

    public String toString() {

        return "Order{" +

                "id=" + id +

                ", cusname='" + cusname + '\'' +

                ", cardID='" + cardID + '\'' +

                ", count='" + count + '\'' +

                ", price='" + price + '\'' +

                ", buydate='" + buydate + '\'' +

                ", mpId=" + mpId +

                '}';

    }

}

Ticket实体类Ticket.java

package com.sell.model;

public class Ticket {

    private Integer id;

    private String name;

    private String price;

    private Integer sum;

    public Integer getId() {

        return id;

    }

    public void setId(Integer id) {

        this.id = id;

    }

    public String getName() {

        return name;

    }

    public void setName(String name) {

        this.name = name;

    }

    public String getPrice() {

        return price;

    }

    public void setPrice(String price) {

        this.price = price;

    }

    public Integer getSum() {

        return sum;

    }

    public void setSum(Integer sum) {

        this.sum = sum;

    }

    public Ticket(Integer id, String name, String price, Integer sum) {

        this.id = id;

        this.name = name;

        this.price = price;

        this.sum = sum;

    }

    public Ticket() {

    }

    @Override

    public String toString() {

        return "Ticket{" +

                "id=" + id +

                ", name='" + name + '\'' +

                ", price='" + price + '\'' +

                ", sum=" + sum +

                '}';

    }

}

4.3 操作数据库的代码

(1)获得连接、关闭代码Db.java

package com.sell.db;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

public class Db {

    public static Connection getConnection(){

        Connection connection = null;

        try {

            Class.forName("com.mysql.jdbc.Driver");

            connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/a?characterEncoding=utf-8","root","rootfenfen");

        } catch (Exception e) {

            e.printStackTrace();

            System.out.println("连接失败!");

        }

        return connection;

    }

    /**

     * 关闭资源

     * @param connection

     * @param statement

     * @param resultSet

     */

    public static void closeAll(Connection connection, Statement statement, ResultSet resultSet){

        try {

            if(resultSet!=null){

                resultSet.close();

            }

            if(statement!=null){

                statement.close();

            }

            if(connection!=null){

                connection.close();

            }

        } catch (SQLException e) {

            e.printStackTrace();

        }

    }

}

            }

        } catch (SQLException e) {

            e.printStackTrace();

        }

    }

}

(1)管理员登录代码

package com.sell.dao;

import com.sell.db.Db;

import com.sell.model.AdminInfo;

import java.sql.Connection;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

public class AdminInfoDaoImpl implements AdminInfoDao {

    @Override

    public AdminInfo login(AdminInfo adminInfo) throws SQLException {

        AdminInfo adminInfo1 = new AdminInfo();

        String sql = "select * from admininfo where username = 'admin' and password='123456'";

        Connection connection = Db.getConnection();

        Statement statement = connection.createStatement();

        ResultSet resultSet = statement.executeQuery(sql);

        while (resultSet.next()){

            adminInfo1.setId(resultSet.getInt(1));

            adminInfo1.setUsername(resultSet.getString(2));

            adminInfo1.setPassword(resultSet.getString(3));

        }

        return adminInfo1;

    }

}

  1. 门票表的操作代码

package com.sell.dao;

import com.sell.db.Db;

import com.sell.model.Ticket;

import java.sql.Connection;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.ArrayList;

import java.util.List;

public class TicketDaoImpl implements TicketDao{

    @Override

    public List<Ticket> selectTickets(Ticket ticket) throws SQLException {

        List list=new ArrayList();

        Connection connection = Db.getConnection();

        Statement statement =connection.createStatement();

        String sql="select * from s_ticket where 1=1";

        if(ticket!=null){

            if(ticket.getName()!=null){

                sql+=" and name like '%"+ticket.getName()+"%'";

            }

        }

        ResultSet resultSet = statement.executeQuery(sql);

        while (resultSet.next()){

            Ticket ticket1=new Ticket();

            ticket1.setId(resultSet.getInt(1));

            ticket1.setName(resultSet.getString(2));

            ticket1.setPrice(resultSet.getString(3));

            ticket1.setSum(resultSet.getInt(4));

            list.add(ticket1);

        }

        return list;

    }

    @Override

    public Ticket selectTicketById(Ticket ticket) throws SQLException {

        Connection connection = Db.getConnection();

        Statement statement =connection.createStatement();

        String sql="select * from s_ticket where id="+ticket.getId();

        ResultSet resultSet = statement.executeQuery(sql);

        while (resultSet.next()){

            ticket.setId(resultSet.getInt(1));

            ticket.setName(resultSet.getString(2));

            ticket.setPrice(resultSet.getString(3));

            ticket.setSum(resultSet.getInt(4));

        }

        return ticket;

    }

    @Override

    public int insertTicketById(Ticket ticket) throws SQLException {

        Connection connection = Db.getConnection();

        Statement statement =connection.createStatement();

        String sql = "INSERT INTO s_ticket  (name,price,sum) VALUES('"+ticket.getName()+"','"+ticket.getPrice()+"',"+ticket.getSum()+")";

        return statement.executeUpdate(sql);

    }

    @Override

    public int updateTicketByid(Ticket ticket) throws SQLException {

        Connection connection = Db.getConnection();

        Statement statement =connection.createStatement();

        String sql="UPDATE s_ticket SET name='"+ticket.getName()+"', price='"+ticket.getPrice()+"',sum="+ticket.getSum()+" WHERE id="+ticket.getId();

        return statement.executeUpdate(sql);

    }

    @Override

    public int deleteTicketById(Ticket ticket) throws SQLException {

        Connection connection = Db.getConnection();

        Statement statement =connection.createStatement();

        String sql="delete from s_ticket where id="+ticket.getId();

        return statement.executeUpdate(sql);

    }

}

(4)订单表的操作代码

package com.sell.dao;

import com.sell.db.Db;

import com.sell.model.Order;

import com.sell.model.Ticket;

import java.sql.Connection;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.ArrayList;

import java.util.List;

public class OrderDaoImpl implements OrderDao{

    @Override

    public List selectOrders(Order order) throws SQLException {

        List list=new ArrayList();

        Connection connection = Db.getConnection();

        Statement statement =connection.createStatement();

        String sql="select * from s_ticket where 1=1";

        ResultSet resultSet = statement.executeQuery(sql);

        while (resultSet.next()){

            Order order1=new Order();

            order1.setId(resultSet.getInt(1));

            order1.setCusname(resultSet.getString(2));

            order1.setCardID(resultSet.getString(3));

            order1.setCount(resultSet.getString(4));

            order1.setPrice(resultSet.getString(5));

            order1.setBuydate(resultSet.getString(6));

            list.add(order1);

        }

        return list;

    }

    @Override

    public int insertOrder(Order order) throws SQLException {

        Connection connection = Db.getConnection();

        Statement statement =connection.createStatement();

        String sql = "INSERT INTO orderinfo (cusname, cardID,count,price,buydate,menpiaoid) VALUES('"+order.getCusname()+"', '"+order.getCardID()+"',"+order.getCount()+",'"+order.getPrice()+"','"+order.getBuydate()+"','"+order.getMpId()+"')";

        return statement.executeUpdate(sql);

    }

}

4.4 主类run.java

package com.sell.run;

import java.sql.SQLException;

import java.util.List;

import java.util.Scanner;

import com.sell.dao.AdminInfoDao;

import com.sell.dao.AdminInfoDaoImpl;

import com.sell.dao.OrderDao;

import com.sell.dao.OrderDaoImpl;

import com.sell.dao.TicketDao;

import com.sell.dao.TicketDaoImpl;

import com.sell.model.AdminInfo;

import com.sell.model.Order;

import com.sell.model.Ticket;

public class Run {

    public static void main(String[] args) throws SQLException {

        Run run=new Run();

        run.runlogin();

    }

    public void runlogin() throws SQLException {

        Scanner scanner = new Scanner(System.in);

        System.out.println("欢迎登录××××景区售票系统");

        System.out.println("请输入账号:");

        String account=scanner.next();

        System.out.println("请输入密码:");

        String password=scanner.next();

        AdminInfo adminInfo = new AdminInfo();

        adminInfo.setUsername(account);

        adminInfo.setPassword(password);

        AdminInfoDao adminInfoDao=new AdminInfoDaoImpl();

        adminInfo=adminInfoDao.login(adminInfo);

        if(adminInfo.getId()!=0){

            //登录成功

            System.out.println("登录成功");

            success();

        }else{

            //成功失败

            System.out.println("登录失败!");

        }

    }

    public void success() throws SQLException {

        Scanner scanner = new Scanner(System.in);

        System.out.println("1.添加门票信息");

        System.out.println("2.删除门票信息");

        System.out.println("3.修改门票信息");

        System.out.println("4.查询门票信息");

        System.out.println("5.浏览门票信息");

        System.out.println("6.出售门票");

        System.out.println("7.退出系统");

        System.out.println("请输入1-8");

        int flag=scanner.nextInt();

        TicketDao ticketDao=new TicketDaoImpl();

        OrderDao orderDao=new OrderDaoImpl();

        if(flag==1){

            //添加门票信息

            System.out.println("门票名称");

            String mp=scanner.next();

            System.out.println("门票价格");

            String price=scanner.next();

            System.out.println("门票数量");

            Ticket ticket1=new Ticket();

            int sum=scanner.nextInt();

            ticket1.setName(mp);

            ticket1.setPrice(price);

            ticket1.setSum(sum);

            int insertFlag=ticketDao.insertTicketById(ticket1);

            if(insertFlag==1){

                //新增成功

                System.out.println("新增成功");

                System.out.println("是否返回上一级:y/n");

                String status=scanner.next();

                if(status.equals("y")){

                    success();

                }

            }else{

                //新增失败

                System.out.println("新增失败");

                System.out.println("是否返回上一级:y/n");

                String status=scanner.next();

            }

        }else if(flag==2){

            //删除

            List tickets=ticketDao.selectTickets(null);

            System.out.println("门票id   名称    价格    库存");

            for(int i=0;i<tickets.size();i++){

                Ticket ticket=(Ticket)tickets.get(i);

                System.out.println(ticket.getId()+"      "+ticket.getName()+"      "+ticket.getPrice()+"      "+ticket.getSum());

            }

            System.out.println("请输入删除的id");

            int id=scanner.nextInt();

            Ticket ticket1=new Ticket();

            ticket1.setId(id);

            int deleteFlag=ticketDao.deleteTicketById(ticket1);

            if(deleteFlag==1){

                //删除成功

                System.out.println("删除成功");

                System.out.println("是否返回上一级:y/n");

                String status=scanner.next();

                if(status.equals("y")){

                    success();

                }

            }else{

                //删除失败

                System.out.println("删除失败");

                System.out.println("是否返回上一级:y/n");

                String status=scanner.next();

            }

        }else if(flag==3){

            //修改

            List tickets=ticketDao.selectTickets(null);

            System.out.println("门票id   名称    价格    库存");

            for(int i=0;i<tickets.size();i++){

                Ticket ticket=(Ticket)tickets.get(i);

                System.out.println(ticket.getId()+"      "+ticket.getName()+"      "+ticket.getPrice()+"      "+ticket.getSum());

            }

            System.out.println("请输入修改的id");

            int id=scanner.nextInt();

            Ticket ticket1=new Ticket();

            ticket1.setId(id);

            System.out.println("门票名称");

            String mp=scanner.next();

            System.out.println("门票价格");

            String price=scanner.next();

            System.out.println("门票数量");

            int sum=scanner.nextInt();

            ticket1.setName(mp);

            ticket1.setPrice(price);

            ticket1.setSum(sum);

            int deleteFlag=ticketDao.updateTicketByid(ticket1);

            if(deleteFlag==1){

                //修改成功

                System.out.println("修改成功");

                System.out.println("是否返回上一级:y/n");

                String status=scanner.next();

                if(status.equals("y")){

                    success();

                }

            }else{

                //修改失败

                System.out.println("修改失败");

                System.out.println("是否返回上一级:y/n");

                String status=scanner.next();

            }

        }else if(flag==4){

            //查询

            Ticket ticket1=new Ticket();

            System.out.println("请输入门票名称:");

            String keyname=scanner.next();

            ticket1.setName(keyname);

            List tickets=ticketDao.selectTickets(ticket1);

            System.out.println("门票id   名称    价格    库存");

            for(int i=0;i<tickets.size();i++){

                Ticket ticket=(Ticket)tickets.get(i);

                System.out.println(ticket.getId()+"      "+ticket.getName()+"      "+ticket.getPrice()+"      "+ticket.getSum());

            }

            System.out.println("是否返回上一级:y/n");

            String status=scanner.next();

            if(status.equals("y")){

                success();

            }

        }else if(flag==5){

            //浏览

            List tickets=ticketDao.selectTickets(null);

            System.out.println("门票id   名称    价格    库存");

            for(int i=0;i<tickets.size();i++){

                Ticket ticket=(Ticket)tickets.get(i);

                System.out.println(ticket.getId()+"      "+ticket.getName()+"      "+ticket.getPrice()+"      "+ticket.getSum());

            }

            System.out.println("是否返回上一级:y/n");

            String status=scanner.next();

            if(status.equals("y")){

                success();

            }

        }else if(flag==6){

            //出售

            List tickets=ticketDao.selectTickets(null);

            System.out.println("门票id   名称    价格    库存");

            for(int i=0;i<tickets.size();i++){

                Ticket ticket=(Ticket)tickets.get(i);

                System.out.println(ticket.getId()+"      "+ticket.getName()+"      "+ticket.getPrice()+"      "+ticket.getSum());

            }

            System.out.println("请输入购买门票id");

            int status=scanner.nextInt();

            Ticket ticket=new Ticket();

            ticket.setId(status);

            ticket=ticketDao.selectTicketById(ticket);

            System.out.println("请输入购票人名:");

            String gprm=scanner.next();

            System.out.println("请输入身份证号:");

            String sfz=scanner.next();

            System.out.println("请输入票数:");

            int ps=scanner.nextInt();

            System.out.println("请输入购票时间:");

            String sj=scanner.next();

            Order order=new Order();

            order.setCusname(gprm);

            order.setCardID(sfz);

            order.setCount(String.valueOf(ps));

            order.setPrice(String.valueOf(ps*Double.valueOf(ticket.getPrice())));

            order.setBuydate(sj);

            order.setMpId(status);

            orderDao.insertOrder(order);

            //根据id查询票数

            ticket.setSum(ticket.getSum()-ps);

            ticketDao.updateTicketByid(ticket);

            System.out.println("出票成功");

            System.out.println("是否返回上一级:y/n");

            String status1=scanner.next();

            if(status1.equals("y")){

                success();

            }

        }else if(flag==7){

            System.out.println("退出成功");

            runlogin();

        }

    }

}

5.运行结果与分析

(1)登录

 (2) 添加

(3)删除

(4)修改

(5)查询

(6)浏览

(7)出售门票

(8)退出

 

 

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

uniapp视频播放器

微信小程序使用hic-video-player app(android和ios)使用好用视频播放器注&#xff1a;用的是旧版本的这个组件 目前只有app中支持竖屏横批选集 android视频全屏是通过 beforeDestroy() {// #ifdef APP-VUE// 页面关闭时关闭沉浸模式if (uni.getSystemInfoSync().platform &quo…

【FFmpeg实战】解复用实战

原文链接&#xff1a;https://blog.csdn.net/u014078003/article/details/128554153 1.封装格式相关函数 avformat_alloc_context()&#xff1a;负责申请一个AVFormatContext结构的内存,并进行简单初始化&#xff0c;这个函数可以不用手动调用&#xff0c;内部会自动调用。avf…

【无标题】NXP i.MX 6ULL工业核心板硬件说明书( ARM Cortex-A7,主频792MHz)

1 硬件资源 创龙科技SOM-TLIMX6U是一款基于NXP i.MX 6ULL的ARM Cortex-A7高性能低功耗处理器设计的低成本工业级核心板&#xff0c;主频792MHz&#xff0c;通过邮票孔连接方式引出Ethernet、UART、CAN、LCD、USB等接口。核心板经过专业的PCB Layout和高低温测试验证&…

怎么才能提高自动化测试的覆盖率,华为大佬教你一招!

前言 自动化测试一直是测试人员的核心技能&#xff0c;也是测试的重要手段之一。尤其是在今年所谓的互联网寒冬的行情下&#xff0c;各大企业对测试人员的技术水平要求的很高&#xff0c;而测试人员的技术水平主要集中在三大自动化测试领域&#xff0c;再加测试辅助脚本的编写…

智慧园区能源管理系统建设方案

随着能源资源的日益紧缺和环境保护意识的不断提高&#xff0c;智慧园区能源管理系统建设成为了当前能源管理的热点话题。智慧园区能源管理系统是一种集成化的能源管理平台&#xff0c;可以实现对园区内各种能源的实时监测、分析和管理&#xff0c;从而达到优化能源配置、提高能…

Python 学习之NumPy(一)

文章目录 1.为什么要学习NumPy2.NumPy的数组变换以及索引访问3.NumPy筛选使用介绍筛选出上面nb数组中能被3整除的所有数筛选出数组中小于9的所有数提取出数组中所有的奇数数组中所有的奇数替换为-1二维数组交换2列生成数值5—10&#xff0c;shape 为(3,5)的二维随机浮点数 NumP…

对一大厂游戏测试员的访谈实录,带你了解游戏测试

今天采访了一个在游戏行业做测试的同学&#xff0c;他所在的游戏公司是做大型多人在线角色扮演类的游戏&#xff0c;类似传奇游戏。他所在的公司目前有1200多人&#xff0c;是上市公司&#xff0c;目前游戏产品在国内海外都有市场。 因为我是一个对游戏无感的人&#xff0c;所…

【C++ 程序设计】第 7 章:输入/输出流

目录 一、流类简介 二、标准流对象 三、控制I/O格式 &#xff08;1&#xff09;流操纵符 &#xff08;2&#xff09;标志字 四、调用cout的成员函数【示例一】 五、调用 cin 的成员函数 &#xff08;1&#xff09;get() 函数 &#xff08;2&#xff09;getline()…

高考选什么专业好?适合考公务员的10大热门专业,了解一下!

高考是人生的分水岭&#xff0c;它是青春和未来的交汇处。高考成绩的优劣将对考生未来的发展产生深远的影响。作为学生们人生中重要的一站&#xff0c;高考不仅考验着学生的学业能力&#xff0c;也考验着他们的心理素质和思维能力。 高考结束后&#xff0c;众多考生面临的一个重…

FFmpeg视频转码参数详解

1 固定码率因子crf&#xff08;Constant Rate Factor&#xff09; 固定码率因子&#xff08;CRF&#xff09;是 x264 和 x265 编码器的默认质量&#xff08;和码率控制&#xff09;设置。取值范围是 0 到 51&#xff0c;这其中越低的值&#xff0c;结果质量越好&#xff0c;同…

阿里云docker启动xxljob,部署自己的定时任务

本次安装版本xxl-job-admin:2.3.0 一&#xff1a;创建xxl-job数据库的各种表 作者官方地址 下载sql执行 二&#xff1a;docker拉取xxl-job镜像 docker pull xuxueli/xxl-job-admin:2.3.0 三&#xff1a;docker启动xxl-job服务 docker run -e PARAMS"--spring.datasour…

用C语言实现经典游戏——贪吃蛇

目录 1.游戏实现思想 &#xff08;1&#xff09;定义蛇对象 &#xff08;2&#xff09;食物对象 &#xff08;3&#xff09;分数&#xff1a; &#xff08;4&#xff09;初始化蛇 &#xff08;5&#xff09;初始化食物 &#xff08;6&#xff09;修改控制台光标位置 &…

Spring Data JPA 报 HOUR_OF_DAY: 0 -> 1异常的解决过程和方案

在进行数据查询时&#xff0c;控制台报了Caused by: com.mysql.cj.exceptions.WrongArgumentException: HOUR_OF_DAY: 0 -> 1异常&#xff0c;查询得知&#xff1a;这是由于查mysql库&#xff0c;转换类型为datetime类型的字段引起的。 网上的解决方案有多种&#xff0c;大…

坐标系转换QGIS插件GeoHey

最近要将面要素&#xff08;GCJ02火星坐标系&#xff09;转WGS84&#xff0c;用程序转太麻烦了&#xff0c;找了半天没找到合适的。 插件非常好用&#xff01;&#xff01;&#xff01; 在QGIS中&#xff0c;由极海&#xff08;GeoHey&#xff09;团队提供GeoHey Toolbox插件…

Linux_清理docker容器的log

最近发现服务器硬盘空间满了&#xff0c;就排查了一番&#xff0c;发现有docker容器的log文件占用太多&#xff0c;所以要做一下清理。 首先是要找到docker容器log文件的储存位置。 1、首先在执行了一下 df -Th 命令&#xff0c;发现根目录满了。 2、然后去到根目录下&#xff…

Android项目中接入 Lint代码规范

一、概述 Android Studio 提供了一个名为 Lint 的代码扫描工具,可帮助开发者发现并更正代码结构质量方面的问题,并且无需您实际执行应用,也不必编写测试用例。系统会报告该工具检测到的每个问题并提供问题的描述消息和严重级别,以便开发者可以快速确定需要优先进行的关键改…

Linux下vim的常见命令操作(快速复查)

目录 前言1、Vim常用操作1.1、环境参数1.2、方向1.3、插入命令1.4、定位命令1.5、删除命令1.6、复制和剪切命令1.7、替换和取消命令1.8、搜索和搜索替换命令1.9、保存和退出命令1.10、其他命令1.11、可视模式 前言 本篇文章不面向新手&#xff0c;全文几乎都是命令&#xff0c;…

【Redis】多级缓存之缓存数据同步策略与Canal

目录 一、数据同步策略 1.设置有效期 2.同步双写 3.异步通知 二、Canal 三、监听Canal 一、数据同步策略 缓存数据同步的常见方式有三种&#xff1a; 1.设置有效期 给缓存设置有效期&#xff0c;到期后自动删除。再次查询时更新&#xff0c;他简单、方便&#xff0c;但…

H5学习 (一)--创建工程

文章目录 一、下载安装VS Code二、创建新文件1. 使用cmd N&#xff0c;创建一个文件2. 点击 Select a language&#xff0c;改变文件的编码类型3. 选择HTML 语言模式4. 输入 !按回车键&#xff0c;就会自动生成一个HTML模版5. 右击项目&#xff0c;选择 “Open In Default Bro…

交叉熵、Focal Loss以及其Pytorch实现

交叉熵、Focal Loss以及其Pytorch实现 本文参考链接&#xff1a;https://towardsdatascience.com/focal-loss-a-better-alternative-for-cross-entropy-1d073d92d075 文章目录 交叉熵、Focal Loss以及其Pytorch实现一、交叉熵二、Focal loss三、Pytorch1.[交叉熵](https://pyto…