【官网快速上手地址】

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. kettle从入门到精通 第四十五课 ETL之 kettle redis

    1.kettle 9.3/9.4 spoon客户端中默认是没有redis步骤的,首先想到在kettle的插件市场进行下载redis步骤. 2.可能因为网络原因,直接下载失败了.索性放弃redis原有插 ...

  2. kettle从入门到精通 第十七课 kettle Transformation executor

    Transformation executor步骤是一个流程控件,和映射控件类似却又不一样. 1.子转换需要配合使用从结果获取记录和复制记录到结果两个步骤,而子映射需要配合映射输入规范和映射输出规范使 ...

  3. Keil一键添加.c文件和头文件路径脚本--可遍历添加整个文件夹

    最近想移植个LVGL玩玩,发现文件实在是太多了,加的手疼都没搞完,实在不想搞了就去找脚本和工具,基本没找到一个...... 主要是自己也懒得去研究写脚本,偶然搜到了一个博主写的脚本,原博客地址:htt ...

  4. ctfshow-超详细通关教程-web(1~8)

    快捷目录 web1 web2 web3 web4 web5 web6 web7 web8 1.web签到题 打开网址后出现如下界面. 查看一下网站源码 将Y3Rmc2hvd3s1ZjkxNTc3Yy0 ...

  5. golang sync.Once 保证某个动作仅执行一次的机制

    type Once struct { done atomic.Uint32 m Mutex } 这段代码是 Go 语言标准库中 sync 包的一部分,定义了一个 Once 类型.Once 类型用于确保 ...

  6. Spring扩展——Aware接口

    Aware接口 在Spring中有许多的Aware接口,提供给应用开发者使用,通过Aware接口,我们可以通过set的方式拿到我们需要的bean对象(包括容器中提供的一些对象,ApplicationC ...

  7. 支付宝APP支付 订单已付款成功,请勿重复提交 和 微信H5支付 INVALID_REQUEST 201 商户订单号重复

    支付宝APP支付 返回请求给前端SDK 提示报错"订单已付款成功,请勿重复提交" 产生原因:存在商家订单号已经支付成功,重复再次请求的情况.每一笔的支付项目商家订单号是唯一的,如果 ...

  8. cuda性能优化-2.访存优化

    简介 在CUDA程序中, 访存优化个人认为是最重要的优化项. 往往kernel会卡在数据传输而不是计算上, 为了最大限度利用GPU的计算能力, 我们需要根据GPU硬件架构对kernel访存进行合理的编 ...

  9. 前端使用 Konva 实现可视化设计器(16)- 旋转对齐、触摸板操作的优化

    这一章解决两个缺陷,一是调整一些快捷键,使得 Mac 触摸板可以正常操作:二是修复一个 Issue,使得即使素材节点即使被旋转之后,也能正常触发磁贴对齐效果,有个小坑需要注意. 请大家动动小手,给我一 ...

  10. Asp.net core Swashbuckle Swagger 的常用配置

    背景 .net core Swashbuckle Swagger 官方文档:https://github.com/domaindrivendev/Swashbuckle.AspNetCore 我们发现 ...