【官网快速上手地址】

https://mp.baomidou.com/guide/quick-start.html#%E5%88%9D%E5%A7%8B%E5%8C%96%E5%B7%A5%E7%A8%8B

创建一个空的数据库,并插入user表和数据:

DROP TABLE IF EXISTS user;

CREATE TABLE user
(
id BIGINT(20) NOT NULL COMMENT '主键ID',
name VARCHAR(30) NULL DEFAULT NULL COMMENT '姓名',
age INT(11) NULL DEFAULT NULL COMMENT '年龄',
email VARCHAR(50) NULL DEFAULT NULL COMMENT '邮箱',
PRIMARY KEY (id)
); DELETE FROM user; INSERT INTO user (id, name, age, email) VALUES
(1, 'Jone', 18, 'test1@baomidou.com'),
(2, 'Jack', 20, 'test2@baomidou.com'),
(3, 'Tom', 28, 'test3@baomidou.com'),
(4, 'Sandy', 21, 'test4@baomidou.com'),
(5, 'Billie', 24, 'test5@baomidou.com');

然后使用IDEA创建SpringBoot项目,不需要点击任何工具选项:

进入项目导入pom坐标:

        <!-- JDBC -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency> <!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency> <!-- mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.2</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

【application.properties】

配置连接参数:

spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://49.234.116.100:3306/mybatis_plus?serverTimezone=GMT
spring.datasource.username = root
spring.datasource.password = 123456

编写实体类:

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
private Integer id;
private String name;
private Integer age;
private String email;
}

编写User的Mapper接口,使用Mybatis-Plus,将接口继承BaseMapper

public interface UserMapper extends BaseMapper<User> {

}

【回顾我的阶段一项目,当时就这么写过一个基本的BaseDao接口...】

CRUD的代码已经由mybatis-plus帮助我们完成了

BaseMapper接口的源码:

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
// package com.baomidou.mybatisplus.core.mapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param; public interface BaseMapper<T> extends Mapper<T> {
int insert(T entity); int deleteById(Serializable id); int deleteByMap(@Param("cm") Map<String, Object> columnMap); int delete(@Param("ew") Wrapper<T> wrapper); int deleteBatchIds(@Param("coll") Collection<? extends Serializable> idList); int updateById(@Param("et") T entity); int update(@Param("et") T entity, @Param("ew") Wrapper<T> updateWrapper); T selectById(Serializable id); List<T> selectBatchIds(@Param("coll") Collection<? extends Serializable> idList); List<T> selectByMap(@Param("cm") Map<String, Object> columnMap); T selectOne(@Param("ew") Wrapper<T> queryWrapper); Integer selectCount(@Param("ew") Wrapper<T> queryWrapper); List<T> selectList(@Param("ew") Wrapper<T> queryWrapper); List<Map<String, Object>> selectMaps(@Param("ew") Wrapper<T> queryWrapper); List<Object> selectObjs(@Param("ew") Wrapper<T> queryWrapper); <E extends IPage<T>> E selectPage(E page, @Param("ew") Wrapper<T> queryWrapper); <E extends IPage<Map<String, Object>>> E selectMapsPage(E page, @Param("ew") Wrapper<T> queryWrapper);
}

别忘了加持久层注解

在Main方法的类上面添加Mapper扫描注解

测试类:

@SpringBootTest
class MybatisPlusApplicationTests { @Autowired // 自动装配
private UserMapper userMapper; @Test
void contextLoads() {
// wrapper 是一个封装查询条件的对象,如果不需要条件不就是null
List<User> userList = userMapper.selectList(null);
// lambda表达式
userList.forEach(System.out::print);
} }

执行结果:

11:02:18.166 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
11:02:18.185 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
11:02:18.231 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [cn.echo42.MybatisPlusApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
11:02:18.257 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.echo42.MybatisPlusApplicationTests], using SpringBootContextLoader
11:02:18.263 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [cn.echo42.MybatisPlusApplicationTests]: class path resource [cn/echo42/MybatisPlusApplicationTests-context.xml] does not exist
11:02:18.263 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [cn.echo42.MybatisPlusApplicationTests]: class path resource [cn/echo42/MybatisPlusApplicationTestsContext.groovy] does not exist
11:02:18.264 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [cn.echo42.MybatisPlusApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
11:02:18.265 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [cn.echo42.MybatisPlusApplicationTests]: MybatisPlusApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
11:02:18.329 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [cn.echo42.MybatisPlusApplicationTests]
11:02:18.456 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\Users\User-Dai\IdeaProjects\Mybatis-Plus\target\classes\cn\echo42\MybatisPlusApplication.class]
11:02:18.457 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration cn.echo42.MybatisPlusApplication for test class cn.echo42.MybatisPlusApplicationTests
11:02:18.630 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [cn.echo42.MybatisPlusApplicationTests]: using defaults.
11:02:18.631 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
11:02:18.660 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@437da279, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@23c30a20, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@1e1a0406, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@3cebbb30, org.springframework.test.context.support.DirtiesContextTestExecutionListener@12aba8be, org.springframework.test.context.transaction.TransactionalTestExecutionListener@290222c1, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@67f639d3, org.springframework.test.context.event.EventPublishingTestExecutionListener@6253c26, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@49049a04, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@71a8adcf, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@27462a88, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@82de64a, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@659499f1, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@51e69659]
11:02:18.667 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@d9345cd testClass = MybatisPlusApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@2d710f1a testClass = MybatisPlusApplicationTests, locations = '{}', classes = '{class cn.echo42.MybatisPlusApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@1f0f1111, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6e0dec4a, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@47d90b9e, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3d680b5a, org.springframework.boot.test.context.SpringBootTestArgs@1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
11:02:18.725 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true} . ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.1.RELEASE) 2020-07-20 11:02:19.217 INFO 17456 --- [ main] cn.echo42.MybatisPlusApplicationTests : Starting MybatisPlusApplicationTests on DESKTOP-SDT4NG3 with PID 17456 (started by User-Dai in C:\Users\User-Dai\IdeaProjects\Mybatis-Plus)
2020-07-20 11:02:19.220 INFO 17456 --- [ main] cn.echo42.MybatisPlusApplicationTests : No active profile set, falling back to default profiles: default
2020-07-20 11:02:21.126 INFO 17456 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
_ _ |_ _ _|_. ___ _ | _
| | |\/|_)(_| | |_\ |_)||_|_\
/ |
3.3.2
2020-07-20 11:02:22.667 INFO 17456 --- [ main] cn.echo42.MybatisPlusApplicationTests : Started MybatisPlusApplicationTests in 3.924 seconds (JVM running for 5.415) 2020-07-20 11:02:23.043 INFO 17456 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-07-20 11:02:26.071 INFO 17456 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
User(id=1, name=Jone, age=18, email=test1@baomidou.com)User(id=2, name=Jack, age=20, email=test2@baomidou.com)User(id=3, name=Tom, age=28, email=test3@baomidou.com)User(id=4, name=Sandy, age=21, email=test4@baomidou.com)User(id=5, name=Billie, age=24, email=test5@baomidou.com)
2020-07-20 11:02:26.215 INFO 17456 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-07-20 11:02:26.472 INFO 17456 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-07-20 11:02:26.473 INFO 17456 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' Process finished with exit code 0

可以看到这里控制台的输出是没有打印SQL执行的,

所以我们需要配置日志输出

【application.properties】

# 日志配置
mybatis-plus.configuration.log-impl = org.apache.ibatis.logging.stdout.StdOutImpl

二次执行:

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1687eb01] was not registered for synchronization because synchronization is not active
2020-07-20 11:07:10.780 INFO 25940 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-07-20 11:07:12.318 INFO 25940 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
JDBC Connection [HikariProxyConnection@1674550752 wrapping com.mysql.cj.jdbc.ConnectionImpl@594d9f07] will not be managed by Spring
==> Preparing: SELECT id,name,age,email FROM user
==> Parameters:
<== Columns: id, name, age, email
<== Row: 1, Jone, 18, test1@baomidou.com
<== Row: 2, Jack, 20, test2@baomidou.com
<== Row: 3, Tom, 28, test3@baomidou.com
<== Row: 4, Sandy, 21, test4@baomidou.com
<== Row: 5, Billie, 24, test5@baomidou.com
<== Total: 5
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1687eb01]
User(id=1, name=Jone, age=18, email=test1@baomidou.com)User(id=2, name=Jack, age=20, email=test2@baomidou.com)User(id=3, name=Tom, age=28, email=test3@baomidou.com)User(id=4, name=Sandy, age=21, email=test4@baomidou.com)User(id=5, name=Billie, age=24, email=test5@baomidou.com)
2020-07-20 11:07:12.506 INFO 25940 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-07-20 11:07:12.891 INFO 25940 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-07-20 11:07:12.892 INFO 25940 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' Process finished with exit code 0

【CRUD基操】

执行插入测试:

    @Test
void insertUser() {
int insert = userMapper.insert(
new User(
null,
"啊啊啊",
22,
"1791255334@qq.com"
)
);
}

插入失败:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'id' of 'class cn.echo42.pojo.User' with value '1285049463613612034' Cause: java.lang.IllegalArgumentException: argument type mismatch

最终原因是因为类型不匹配:

java.lang.IllegalArgumentException: argument type mismatch

在我们User对象id属性设置null进行插入时,mybatis会自动生成一个UID插入

但是显然超出Integer的范围,所以改用Long试试

private Long id;

测试结果果然成功:

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@237f7970] was not registered for synchronization because synchronization is not active
2020-07-20 11:16:52.830 INFO 19932 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-07-20 11:16:54.222 INFO 19932 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
JDBC Connection [HikariProxyConnection@441867003 wrapping com.mysql.cj.jdbc.ConnectionImpl@2fd64b11] will not be managed by Spring
==> Preparing: INSERT INTO user ( id, name, age, email ) VALUES ( ?, ?, ?, ? )
==> Parameters: 1285051019587166210(Long), 啊啊啊(String), 22(Integer), 1791255334@qq.com(String)
<== Updates: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@237f7970] 2020-07-20 11:16:54.371 INFO 19932 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-07-20 11:16:54.707 INFO 19932 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-07-20 11:16:54.709 INFO 19932 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' Process finished with exit code 0

数据库查看:

【主键生成策略】

自增
uuid
redis
zookeeper
snowflake 雪花算法

似乎Mybatis-Plus默认采用的生成策略是雪花算法

如果要更改策略的话使用@TableId注解更改

可以打开看看这个type的枚举类

package com.baomidou.mybatisplus.annotation;

public enum IdType {
AUTO(0),
NONE(1),
INPUT(2),
ASSIGN_ID(3),
ASSIGN_UUID(4),
/** @deprecated */
@Deprecated
ID_WORKER(3),
/** @deprecated */
@Deprecated
ID_WORKER_STR(3),
/** @deprecated */
@Deprecated
UUID(4); private final int key; private IdType(int key) {
this.key = key;
} public int getKey() {
return this.key;
}
}

【Mybatis-Plus】01 快速上手的更多相关文章

  1. 快速上手Mybatis项目

    快速上手Mybatis项目 思路流程:搭建环境-->导入Mybatis--->编写代码--->测试 1.搭建实验数据库 CREATE DATABASE `mybatis`; USE ...

  2. ESFramework 4.0 快速上手(01) -- Rapid引擎

    (在阅读该文之前,请先阅读 ESFramework 4.0 概述 ,会对本文的理解更有帮助.) ESFramework/ESPlatform 4.0 的终极目标是为百万级的用户同时在线提供支持,因为强 ...

  3. intellij idea 13&14 插件推荐及快速上手建议 (已更新!)

    原文:intellij idea 13&14 插件推荐及快速上手建议 (已更新!) 早些年 在外企的时候,公司用的是intellij idea ,当时也是从eclipse.MyEclipse转 ...

  4. ESFramework 4.0 快速上手(06) -- Rapid引擎(续)

    <ESFramework 4.0 快速上手>系列介绍的都是如何使用Rapid引擎(快速引擎) -- RapidServerEngine 和 RapidPassiveEngine.其实,大家 ...

  5. Requests快速上手

    发送请求 使用 Requests 发送网络请求非常简单. 一开始要导入 Requests 模块: >>> import requests 然后,尝试获取某个网页.本例子中,我们来获取 ...

  6. [Full-stack] 快速上手开发 - React

    故事背景 [1] 博客笔记结合<React快速上手开发>再次系统地.全面地走一遍. [2] React JS Tutorials:包含了JS --> React --> Red ...

  7. python的requests快速上手、高级用法和身份认证

    https://blog.csdn.net/qq_25134989/article/details/78800209 快速上手 迫不及待了吗?本页内容为如何入门 Requests 提供了很好的指引.其 ...

  8. 想要快速上手 Spring Boot?看这些教程就足够了!| 码云周刊第 81 期

    原文:https://blog.gitee.com/2018/08/19/weekly-81/ 想要快速上手 Spring Boot?看这些教程就足够了!| 码云周刊第 81 期 码云周刊 | 201 ...

  9. 【opencv入门篇】 10个程序快速上手opencv【下】

    导言:本系列博客目的在于能够在vs快速上手opencv,理论知识涉及较少,大家有兴趣可以查阅其他博客深入了解相关的理论知识,本博客后续也会对图像方向的理论进一步分析,敬请期待:) 上篇传送:http: ...

  10. 三分钟快速上手TensorFlow 2.0 (上)——前置基础、模型建立与可视化

    本文学习笔记参照来源:https://tf.wiki/zh/basic/basic.html 学习笔记类似提纲,具体细节参照上文链接 一些前置的基础 随机数 tf.random uniform(sha ...

随机推荐

  1. cors解决跨域 服务器代理方式

    // cors 方法         // 后端程序员通过定义后端程序,让跨域访问,可以正常执行,可以获取响应体内容         // 前端程序员不需要做任何的调整         // 后端程序 ...

  2. P7448

    problem & 双倍经验 & blog 低配版本 没有 Ynoi 标志性算法卡常,这点差评. 拆解问题 定义 \(lst_i\) 为上一个和 \(i\) 号点相同的位置. 由于几个 ...

  3. django通过celery定时任务

    settings.py   # Broker配置,使用Redis作为消息中间件 BROKER_URL = 'redis://127.0.0.1:6379/0' # BACKEND配置,这里使用redi ...

  4. Mybatis-MySQL 中使用IFNUL

    Mybatis-MySQL 中使用IFNULL(p1,p2)函数但是有一些需要注意的地方. 假设数据 title: student id name age 1 Ann 18 2 Bom 19 3 He ...

  5. 项目管理--PMBOK 读书笔记(3)【项目经理的角色 】

    思维导图软件工具:https://www.xmind.cn/ 源文件地址:https://files-cdn.cnblogs.com/files/zj19940610/项目经理的角色.zip

  6. 网站_域名_DNS_端口_web访问过程

    网站基本概念 服务器:能够提供服务器的机器,取决于机器上所安装的服务软件 web服务器:提供web服务(网站访问),需要安装web服务软件,Apache,tomcat,iis等 域名 (Domain ...

  7. golang 所有关键字的列表及释义归类

    golang 所有关键字的列表及释义归类,截至1.18版本. [控制结构] if  : 条件语句,基于布尔表达式的值决定是否执行特定的代码块. else. else if     : 用在 if 语句 ...

  8. 给你的博客加上个Live2D看板娘吧

    Tips:当你看到这个提示的时候,说明当前的文章是由原emlog博客系统搬迁至此的,文章发布时间已过于久远,编排和内容不一定完整,还请谅解` 给你的博客加上个Live2D看板娘吧 日期:2017-12 ...

  9. Python中的属性

    Python中的属性主要分为类属性,对象属性. 1.类属性 类属性:类所有,所有的实例对象都能够共享,类定义时就直接指定的属性,能通过类名和实力对象名访问,当当前的类属性被实例对象通过对象名.属性名的 ...

  10. P6631 [ZJOI2020] 序列题解

    难度:困难 主要算法:贪心 题目链接:https://www.luogu.com.cn/problem/P6631 解题思路 简化问题:定义直线为覆盖ai,ai+1,ai+2 的操作,跳线为覆盖ai, ...