SpringBoot的Data开发篇:整合JDBC、整合MybatisMP,YAML文件加密的实现,数据项目监控平台的使用和实现

SpringBoot整合JDBC

实现步骤:

  1. 导pom文件坐标

    除springboot启动器和test坐标外,还需要导入spring jdbc和mysql的坐标

    <dependencies>
        <!--Spring JDBC-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
        </dependency>
        <!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.29</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
  2. application.yaml配置文件,配置数据源

    #配置数据源
    spring:
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/spring?serverTimezone=GMT
        username: root
        password: 123456
    
  3. 创建实体类

    public class Emp {
        private int eid;
        private String ename;
        private String esex;
    	// get,set,toString,有参无参构造
    }
    
  4. 创建映射器

    public class MyRowMapper implements RowMapper<Emp> {
        @Override
        public Emp mapRow(ResultSet rs, int rowNum) throws SQLException {
            int eid = rs.getInt("eid");
            String ename = rs.getString("ename");
            String esex = rs.getString("esex");
            Emp emp = new Emp(eid, ename, esex);
            return emp;
        }
    }
    
  5. junit测试

    @SpringBootTest
    class Springboot01DataJdbcApplicationTests {
        @Autowired(required = false)
        JdbcTemplate jdbcTemplate;
        
        @Test
        void show1(){
            int row = jdbcTemplate.update("insert into emp(ename,esex) values(?,?)", "张三", "男");
            System.out.println(row);
        }
        
        @Test
        void show2(){
            int row = jdbcTemplate.update("delete from emp where eid=?", "2");
            System.out.println(row);
        }
        @Test
        void show3() {
            Emp emp = jdbcTemplate.queryForObject("select * from emp where eid=?", new MyRowMapper(), "1");
            System.out.println(emp);
    
        }
        @Test
        void show4(){
            List<Emp> query = jdbcTemplate.query("select * from emp", new MyRowMapper());
            query.forEach(System.out::println);
        }
    }
    

总结:SpringBoot整合JDBC后使用JDBC和dbutil非常相似,用到了模板模式,核心是jdbcTemplate,增删改用update方法全查用query方法,查询返回值一个实例用queryObject方法,查询都需要传一个映射器

SpringBoot整合Mybatis&MP

实现步骤:

  1. 导pom.xml文件坐标

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        
        <!--mybatis+mp-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.3</version>
        </dependency>
        <!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.29</version>
        </dependency>
    </dependencies>
    
  2. application.yaml配置文件

    #数据源
    spring:
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/spring?serverTimezone=GMT
        username: root
        password: 123456
    #mybatis
    mybatis:
      configuration:
        map-underscore-to-camel-case: true
      type-aliases-package: com.dong.pojo
    mybatis-plus:
      configuration:
        map-underscore-to-camel-case: true
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #mybatis所执行的sql输出控制台
    
    • mybatis:

      • map-underscore-to-camel-case: true ——》配置自动驼峰映射
      • type-aliases-package: com.dong.pojo ——》mybatis配置起别名
    • mybatis-plus:

      • map-underscore-to-camel-case: true ——》自动驼峰映射

      • llog-impl: org.apache.ibatis.logging.stdout.StdOutImpl ——》

        mybatis所执行的sql输出控制台

  3. 实体类:

    @NoArgsConstructor
    @AllArgsConstructor
    @Data
    @TableName(value = "student")
    public class Student implements Serializable {
        @TableId("stu_id")
        private int stuId;
        @TableField("stu_name")
        private String stuName;
        @TableField("stu_sex")
        private String stuSex;
    
        public Student(String stuName, String stuSex) {
            this.stuName = stuName;
            this.stuSex = stuSex;
        }
    }
    
  4. dao层

    @Mapper/*逐个注入*/
    public interface StudentMapper extends BaseMapper<Student> {
        @Select("select * from student")
        public List<Student> findAll();
    }
    
    • StudentMapper接口继承了MP的公共dao层方法,继承公共方法还可以自定义方法

    • @Mapper:将Mapper注入导容器,@Mapper是逐个注入,并创建Mapper实例,每个Mapper接口都需要添加此注解

    • @MapperScan:将Mapper批量注入导容器中,只需要在主启动程序添加此注解就可以

      演示:

      @SpringBootApplication
      @MapperScan(basePackages = "com.dong.mapper")
      public class Springboot02DataMybatisMpApplication {
          public static void main(String[] args) {
          SpringApplication.run(Springboot02DataMybatisMpApplication.class, args);
          }
      }
      

      @MapperScan(basePackages = “com.dong.mapper”),basePackages属性填写Mapper存放的路径,就可以扫描到所有的Mapper接口注入容器并创建实例

  5. 实现分页查询

    实现分页查询需要写一个配置类,配置分页拦截器

    /*分页查询配置*/
    @Configuration
    public class MybatisPlusConfig {
        //注入mp拦截器
        @Bean
        public MybatisPlusInterceptor mybatisPlusInterceptor(){
            //1.实例化拦截器
            MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
            //2.分页拦截器
            mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
            return mybatisPlusInterceptor;
        }
    }
    
  6. junit测试:

    @SpringBootTest
    class Springboot02DataMybatisMpApplicationTests {
        @Autowired(required = false)
        StudentMapper studentMapper;
    
        //新增
        @Test
        void show1(){
            Student stu = new Student("李四","男");
            int row = studentMapper.insert(stu);
            System.out.println(row);
        }
    
        // 删除
        @Test
        void show2(){
            int row = studentMapper.deleteById("4");
            System.out.println(row);
        }
    
        // 修改
        @Test
        void show3(){
            Student student = new Student();
            student.setStuSex("女");
            student.setStuId(1);
            int row = studentMapper.updateById(student);
            System.out.println(row);
        }
    
        // 单查
        @Test
        void show4(){
            Student student = studentMapper.selectById(3);
            System.out.println(student);
        }
    
        // 全查
        @Test
        void show5(){
            List<Student> list =  studentMapper.findAll();
            list.forEach(System.out::println);
        }
    
        // 分页查询
        @Test
        void show6(){
            //1.创建分页规则
            IPage<Student> page = new Page<Student>(2,2);
            //2.查询
            studentMapper.selectPage(page,null);
            //3 获取分页结果
            System.out.println("当前页码值:"+page.getCurrent());
            System.out.println("每页显示数:"+page.getSize());
            System.out.println("一共多少页:"+page.getPages());
            System.out.println("一共多少条数据:"+page.getTotal());
            System.out.println("数据:"+page.getRecords());
        }
    }
    

总结实现流程:

  1. 建库建项目
  2. 导坐标
  3. 写applicaiton.yaml文件
  4. 写enjoy配置类
  5. 实体类,@TableName()注解关联数据库
  6. dao层,service层
  7. controller层和页面(因为需要上传文件到七牛云,写文件工具类)

SpringBoot切换Druid数据源

实现步骤:

  1. 导入druid坐标

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid-spring-boot-starter</artifactId>
        <version>1.2.18</version>
    </dependency>
    
  2. 配置application.yaml主配置文件

    #配置数据源
    spring:
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/spring?serverTimezone=GMT
        username: root
        password: 123456
        type: com.alibaba.druid.pool.DruidDataSource
    

    数据源新增配置:type;配置后数据源即切换为druid

  3. 编写DruidConfig配置类

    @Configuration
    public class DruidConfig {
        // 给druid配置数据源
        @Bean
        @ConfigurationProperties(prefix = "spring.datasource")
        public DataSource dataSource(){
            return new DruidDataSource();
        }
    }
    

    告诉druid数据库的信息

  4. 可以在juint单元测试中测试

    @Autowired(required = false)
    DataSource dataSource;
    
    @Test
    void contextLoads() throws Exception{
        System.out.println(dataSource.getClass());
        System.out.println(dataSource.getConnection());
    }
    

    结果:

    class com.alibaba.druid.pool.DruidDataSource
    com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@c7f4457

Druid的配置参数

在这里插入图片描述

YAML文件加密的实现

因为主配置文件中数据库的账号密码都是明文的,不安全,所以需要对YAML主配置文件进行加密

实现方式:

  1. druid自带可以对密码加密(有且只能对密码加密)

  2. Jasypt任意内容加密

    演示:Jasypt对账号密码加密实现步骤

实现步骤:

  1. 添加jasypt坐标

    <!--jasypt坐标-->
    <dependency>
        <groupId>com.github.ulisesbocchio</groupId>
        <artifactId>jasypt-spring-boot-starter</artifactId>
        <version>2.1.0</version>
    </dependency>
    
  2. 启动类添加注解:@EnableConfigurationProperties

    @EnableConfigurationProperties:作用,开启加密

    @SpringBootApplication
    @EnableConfigurationProperties
    public class Springboot03DataDruidApplication {
        public static void main(String[] args) {
            SpringApplication.run(Springboot03DataDruidApplication.class, args);
        }
    }
    
  3. 通过测试类生成密码

    @Test
    void show1(){
        StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor();
        EnvironmentPBEConfig config = new EnvironmentPBEConfig();
        // 加密的算法,这个算法是默认的
        config.setAlgorithm("PBEWithMD5AndDES");
        // 加密的密钥,随便自己填写,很重要千万不要告诉别人
        config.setPassword("programmerdong");
        standardPBEStringEncryptor.setConfig(config);
        //自己的密码
        String plainText = "root";
        String encryptedText = standardPBEStringEncryptor.encrypt(plainText);
        System.out.println(encryptedText);
    
    }
    
    • config.setPassword:加密的密钥,密钥会和想要加密的内容通过算法一起生成加密的内容,解密的时候也需要此密钥,简单来说,使用加密后的内容解密也需要密钥
    • String plainText = " ":字符串中写想要加密的内容,账号、密码等等
    • 运行测试类,控制台会打印加密后的内容,将账号输入运行一次,再将密码输入运行一次
    • 注意:账号密码最好都生成后再去yaml文件中改,如果生成了一个之后配置了yaml,一定要配置密钥,否则第二次生成报错
  4. 配置yaml文件

    spring:
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/spring?serverTimezone=GMT
        username: ENC(lrPe70ChJmyln/gFKmdXLw==)		 #	加密后的账号
        password: ENC(7J9GcM0PbiAa8uEtNNrtcg==)		 #  加密后的密码
        type: com.alibaba.druid.pool.DruidDataSource  # 数据源 Druid
    
    # 密钥
    jasypt:
      encryptor:
        password: programmerdong
    
    • 注意:加密后的内容在配置文件中需要写在ENC()中
    • 这里配置的密钥是生成加密内容是自己设置的密钥

Druid数据监控平台

Druid的监控主要监控数据访问层

实现步骤:

  1. 导pom文件坐标,略

  2. yaml主配置文件

    spring:
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/spring?serverTimezone=GMT
        username: root
        password: 123456
        type: com.alibaba.druid.pool.DruidDataSource
        filters: stat,wall
    
    • 使用Druid监控平台使用Druid数据源
    • filters:配置Druid监控平台
  3. 编写Druid配置类

    @Configuration
    public class DruidConfig {
    
        // 给druid配置数据源
        @Bean
        @ConfigurationProperties(prefix = "spring.datasource")
        public DataSource dataSource(){
            return new DruidDataSource();
        }
    
        // 配置servlet
        @Bean
        public ServletRegistrationBean registrationBean(){
            //1.创建servlet注册类
            ServletRegistrationBean<StatViewServlet>  servletRegistrationBean =  new ServletRegistrationBean<StatViewServlet>();
            //2.创建制作页面的servlet
            StatViewServlet statViewServlet = new StatViewServlet();
            //3.绑定servlet
            servletRegistrationBean.setServlet(statViewServlet);
            servletRegistrationBean.setUrlMappings(Arrays.asList("/druid/*"));
            //4.参数绑定
            Map<String,String> maps = new HashMap<String,String>();
            maps.put(StatViewServlet.PARAM_NAME_USERNAME,"admin");	
            maps.put(StatViewServlet.PARAM_NAME_PASSWORD,"123");	
            maps.put(StatViewServlet.PARAM_NAME_ALLOW,"");//白名单
            maps.put(StatViewServlet.PARAM_NAME_DENY,"192.168.0.12");//黑名单
            servletRegistrationBean.setInitParameters(maps);
            return servletRegistrationBean;
        }
    
        // 配置listener
        @Bean
        public FilterRegistrationBean filterRegistrationBean(){
    
            FilterRegistrationBean<WebStatFilter> bean = new FilterRegistrationBean<WebStatFilter>();
            bean.setFilter(new WebStatFilter());
            //所有请求进行监控处理
            bean.setUrlPatterns(Arrays.asList("/*"));
    
            Map<String, String> initPrams = new HashMap<>();
            //添加不需要忽略的格式信息
            initPrams.put(WebStatFilter.PARAM_NAME_EXCLUSIONS, "*.js,*.css,/druid/*");
            bean.setInitParameters(initPrams);
    
            return bean;
        }
    }
    
  4. 访问监控平台路径:localhost:8080/druid/login

    输出账号密码即可登录

    在这里插入图片描述

SpringBoot 项目监控的使用实现

Druid监控平台主要用于监控数据访问层,监测整个Spring项目不是很好用,而SpringBoot自带监控功能Actuator,可以帮助实现对程序内部运行情况监控,比如监控状况、Bean加载情况、配置属性 、日志信息等

实现Actuator的步骤:

  1. 导入依赖坐标

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    
  2. 访问http://localhost:8080/actuator访问后可以通过json.cn查看json

注意:使用时一定要先访问一个普通接口,否则不开启监控,报错404

在这里插入图片描述

  1. 具体使用

    在这里插入图片描述

SpringBoot Admin

因为Actuator的监控信息都是JSON的文本,可读性差,有社区开源项目做出了可视化页面

  • Spring Boot Admin是一个开源社区项目,用于管理和监控SpringBoot应用程序。
  • Spring Boot Admin 有两个角色,客户端(Client)和服务端(Server)。
  • 应用程序作为Spring Boot Admin Client向为Spring Boot Admin Server注册
  • Spring Boot Admin Server 的UI界面将Spring Boot Admin Client的Actuator Endpoint上的一些监控信息。

实现步骤:

被监控的叫做客户端,监控叫做服务器端

客户端admin-client:

  1. 创建admin-client模块(一个springboot web项目)

  2. 导入坐标:admin-starter-client

    <!--监控平台客户端-->
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-client</artifactId>
        <version>2.2.0</version>
    </dependency>
    

    这里SpringBoot版本的问题肯能导致监控失败,建议使用SpringBoot版本:2.4.3

  3. 配置文件:server地址等

    配置文件properties或yanl;这里用到的是properties

    # 配置Info信息
    info.name=DJX
    info.age=22
    
    # 开启健康检查的完整信息
    management.endpoint.health.show-details=always
    # 将所有的监控endponit暴露出来,能够看到监控了很多,比如容器中的Bean
    management.endpoints.web.exposure.include=*
    
    # admin-server访问地址
    spring.boot.admin.client.url=http://localhost:8081
    

服务器端admin-server:

  1. 创建admin-server模块(springboot的项目)

  2. 导入坐标: admin-starter-server

    <!--admin server坐标-->
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-server</artifactId>
        <version>2.7.3</version>
    </dependency>
    

    建议使用Springboot版本为2.7.2

  3. 配置端口号

    server.port=8081
    

    这里的端口号是客户端配置的服务器访问地址,需要对应上

  4. 在启动类上添加注解:@EnableAdminServer

测试:

  1. 先启动服务器

  2. 服务器启动成功,启动客户端

  3. 访问路径:localhost:8081(服务器端口号)

    在这里插入图片描述

    看到应用数不为0且点击应用墙如下即监控成功

    在这里插入图片描述

    Spring Boot Admin 页面监控的信息

    在这里插入图片描述

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

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

相关文章

【fast2021论文导读】 Learning Cache Replacement with Cacheus

文章:Learning Cache Replacement with Cacheus 导读摘要: 机器学习的最新进展为解决计算系统中的经典问题开辟了新的、有吸引力的方法。对于存储系统,缓存替换是一个这样的问题,因为它对性能有巨大的影响。 本文第一个贡献,确定了与缓存相关的特征,特别是,四种工作负载…

JSP运行环境搭建

将安装JSP引擎的计算机称作一个支持JSP的Web服务器。这个服务器负责运行JSP&#xff0c;并将运行结果返回给用户。 JSP的核心内容之一就是编写JSP页面,JSP页面是Web应用程序的重要组成部分之一。一个简单Web应用程序可能只有一个JSP页面,而一个复杂的Web应用程序可能由许多JSP…

CnosDB 狂欢!全面支持 Helm 部署,轻松搞定你的分布式时序数据库!

大家好&#xff01;今天有个热辣新闻要和大家分享——CnosDB 狂欢时刻来啦&#xff0c;全面支持 Helm 部署&#xff01;如果你是物联网、工业互联网、车联网或者IT运维的粉丝&#xff0c;那你绝对不能错过这个重磅消息&#xff01; CnosDB Helm Chart 究竟是啥&#xff1f; 别…

网络通讯基础

Socket Socket是应用层与TCP/IP协议簇通信的中间软件抽象层&#xff0c;它是一组接口。Socket通常用于实现客户端和服务器之间的通信。它允许客户端应用程序与服务器应用程序建立连接&#xff0c;并通过网络传输数据。 Socket包含了网络通讯必须的5种信息 Socket例子 { 协议: …

计算机毕业设计 基于Vue篮球联盟管理系统的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍&#xff1a;✌从事软件开发10年之余&#xff0c;专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精…

vue:实现顶部消息横向滚动通知

前言 最近有个需求&#xff0c;是在系统顶部展示一个横向滚动的消息通知。需求很简单&#xff0c;就是消息内容从右往左一直滚动。 效果如下&#xff1a; 因为我的需求很简单&#xff0c;功能就这样。如果有什么其他需求&#xff0c;可以再继续修改。 代码 使用 <noti…

《深入理解计算机系统》书籍学习笔记 - 第二课 - 位,字节和整型

Lecture 02 Bits,Bytes, and Integer 位&#xff0c;字节和整型 文章目录 Lecture 02 Bits,Bytes, and Integer 位&#xff0c;字节和整型Byte 字节位操作布尔代数集合的表现形式和操作C语言的逻辑操作 位移操作整型数值范围无符号与有符号数值无符号与有符号在C中 拓展和截断拓…

2023年【电工(初级)】考试内容及电工(初级)复审模拟考试

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 电工&#xff08;初级&#xff09;考试内容是安全生产模拟考试一点通总题库中生成的一套电工&#xff08;初级&#xff09;复审模拟考试&#xff0c;安全生产模拟考试一点通上电工&#xff08;初级&#xff09;作业手…

C++语言的广泛应用领域

目录 1. 系统级编程 2. 游戏开发 3. 嵌入式系统 4. 大数据处理 5. 金融和量化分析 6. 人工智能和机器学习 7. 网络和通信 结语 C是一种多范式编程语言&#xff0c;具有高性能、中级抽象能力和面向对象的特性。由Bjarne Stroustrup于1979年首次设计并实现&#xff0c;C在…

电路综合-基于简化实频的SRFT集总参数切比雪夫低通滤波器设计

电路综合-基于简化实频的SRFT集总参数切比雪夫低通滤波器设计 6、电路综合-基于简化实频的SRFT微带线切比雪夫低通滤波器设计中介绍了使用微带线进行切比雪夫滤波器的设计方法&#xff0c;在此对集总参数的切比雪夫响应进行分析。 SRFT集总参数切比雪夫低通滤波器综合不再需要…

SpringBootWeb案例——Tlias智能学习辅助系统(3)——登录校验

前一节已经实现了部门管理、员工管理的基本功能。但并没有登录&#xff0c;就直接访问到了Tlias智能学习辅助系统的后台&#xff0c;这节来实现登录认证。 目录 登录功能登录校验(重点)会话技术会话跟踪方案一 Cookie&#xff08;客户端会话跟踪技术&#xff09;会话跟踪方案二…

Django(三、数据的增删改查、Django生命周期流程图)

文章目录 一、 基于ORM进行的CURDuser_list&#xff1a;作为主页使用路由文件urls.py配置如下&#xff1a;add.html&#xff1a;用于新增用户的数据页add页面视图函数如下:edit.html&#xff1a;修改数据的页面那么来总结一下上序所操作所用到的内容。 导入已存在的表其方式有两…

某手游完整性校验分析

前言 只是普通的单机手游&#xff0c;广告比较多&#xff0c;所以分析处理了下&#xff0c;校验流程蛮有意思的&#xff0c;所以就分享出来了 1.重打包崩溃处理 样本进行了加固&#xff0c;对其dump出dex后重打包出现崩溃 ida分析地址发现为jni函数引起 利用Xposed直接替换…

Java学习

Java的三大版本 Write Once、Run Anywhere JavaSE:标准版&#xff08;桌面程序,控制台开发…) JavaME:嵌入式开发(手机,小家电…) JavaEE: E企业级开发(web端&#xff0c;服务器开发…) JDK : Java Development Kit&#xff0c;Java开发者工具&#xff0c;在JRE之上扩充了一些…

算法进阶指南图论 通信线路

通信线路 思路&#xff1a;我们考虑需要升级的那条电缆的花费&#xff0c;若其花费为 w &#xff0c;那么从 1 到 n 的路径上&#xff0c;至多存在 k 条路径的价值大于 w &#xff0c;这具有一定的单调性&#xff0c;当花费 w 越大&#xff0c;我们路径上价值大于 w 的花费会越…

Unity 使用INI文件存储数据或配置参数预设

法1&#xff1a;调用外部Capi库 具体使用&#xff1a; public class Ini{//读取INI文件需要调用C的APP[System.Runtime.InteropServices.DllImport("kernel32")]private static extern long WritePrivateProfileString(string section, string key, string val, st…

STM32--系统滴答SysTick

一、SysTick是什么&#xff1f; Systick定时器是一个24bit的倒计时&#xff08;向下计数&#xff09;定时器&#xff0c;功能就是实现简单的延时。 SysTick 是一种系统定时器&#xff0c;通常在嵌入式系统中使用。它是 ARM Cortex-M 处理器的一个特殊定时器&#xff0c;用于提…

7.运算符

目录 一.算数运算符 1、算术运算符 2、比较运算符 1、等号()用来判断数字、字符串和表达式是否相等。 2、安全等于运算符(<>) 3、不等于运算符(<>或者!) 4、小于或等于运算符(<) 5、小于运算符(<) 6、IS NULL(IS NULL)&#xff0c;IS NOT NULL 运算…

[MySQL] MySQL表的基础操作

文章目录 一、创建表 1、1 SQL语法 1、2 实例演示 二、查询表 三、修改表 3、1 修改表名字 3、2 新增列&#xff08;字段&#xff09; 3、3 修改列类型 3、4 修改列名 3、5 删除表 四、总结 &#x1f64b;‍♂️ 作者&#xff1a;Ggggggtm &#x1f64b;‍♂️ &#x1f440; 专…

【MySQL日志与备份篇】数据库备份与恢复

数据库备份与恢复 文章目录 数据库备份与恢复1. 物理备份与逻辑备份2. mysqldump实现逻辑备份2.1 备份一个数据库2.2 备份全部数据库2.3 备份部分数据库2.4 备份部分表2.5 备份单表的部分数据2.6 排除某些表的备份2.7 只备份结构或只备份数据2.8 备份中包含存储过程、函数、事件…