mybatis-flex探索
mybatis古今未来
最近无意之中发现了一个非常棒的持久层框架mybatis-flex,迫不及待研究了一下
发现简直就是我的梦中情框,之前写ibatis,后来写mybatis,接着写mybatis-plus,接着研究mybatis-flex
ibatis
ibatis是apache开源的,当时是一款轻量级的数据据持久层的半自动式开发框架
它简化直接用jdbc开发的60%以上的代码量,并且支持将sql写入xml中,使结构变得非常清晰,而且能灵活配置,从此进入了ibatis的时代,受到当时大量的开发人员的喜爱
优点:
- 简化了直接使用jdbc产生的大量代码
- 定义xml映射器,将sql语句与java代码分离,维护更轻松
- 查询能将结果集反映射到java对象中
- 提供了事物管理和连接池管理
- 。。。。
缺点:
- 结果集封装单一,不够灵活
- 增删改查,入参有限制,只有一个
- 配置关系太多
- 不够优化,大量的单表操作仍旧需要手动写增删改查等sql
- 复杂查询逻辑会出现嵌套查询 n+1的情况,造成资源抢占,拥护,卡顿
- 。。。。
mybatis:
它就是千锤百炼锻造出来的,它的前身就是ibatis
优点:
- 前身是ibatis,所以它有ibatis的一切优点
- 借助jdk的泛型和注解特性进一步做了简化
- 实现了接口绑定,自动生成接口的具体实现,简化了ibatis在dao与xml的映射关系需要指定的操作
- 对象关系映射改进,效率更高
- 性能高:提供了缓存机制提高性能,存储过程等
- 。。。。
缺点
- sql编写工作量较大,大量的单表操作仍旧需要写常规的sql语句
- 配置关系仍旧太多
- 复杂的查询操作需要自己编写sql语句
- 缓存使用不当,容易产生脏数据
- 。。。
mybatis-plus
它是mybatis的增强工具,在mybatis的基础上只做增强不做改变
优点:
- 它只是增强mybatis,所以mybatis一切优点它全都继承了过来
- 依赖少,仅仅依赖 Mybatis 以及 Mybatis-Spring 。
- 预防sql注入,内置sql注入剥离器,可以很好的防止sql注入
- 内置多种主键策略
- 单表增删改查等业务可以不用写sql
- 强大的条件构造器可以满足各种使用需求
- 支持Lambda形式调用
- 。。。。
缺点:
- 分页查询无sql解析设计
- 不支持多表查询
- 不支持多主键,复合主键
- 。。。。
MyBatis-Flex
它也是在mybatis上做了增强
- 拥有mybatis所有的优点
- 仅依赖mybatis,体积更小更轻量
- 支持多表查询
- 支持多主键,复合主键
- 。。。。。
我的要求:
- 不用写重复性单表增删改查的业务,
- 能支持分页查询
- 支持多表查询
- 支持rpc远程调用
mybatis-flex满足了我所有的要求,所以我觉得自己很有必要去了解一下
例子截图


代码部分
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.1.2</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.zxs</groupId><artifactId>springboot-mybatis-flex</artifactId><version>0.0.1-SNAPSHOT</version><name>springboot-mybatis-flex</name><description>springboot-mybatis-flex</description><properties><java.version>17</java.version><mybatis-flex.version>1.5.6</mybatis-flex.version><fastjson.version>1.2.47</fastjson.version></properties><dependencyManagement><dependencies><dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-dependencies</artifactId><version>4.1.0</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId></dependency><dependency><groupId>com.mysql</groupId><artifactId>mysql-connector-j</artifactId><scope>runtime</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId></dependency><dependency><groupId>com.mybatis-flex</groupId><artifactId>mybatis-flex-spring-boot-starter</artifactId><version>${mybatis-flex.version}</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>${fastjson.version}</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build></project>
spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/testusername: rootpassword: zkb.comtype: com.zaxxer.hikari.HikariDataSourcehikari:connection-timeout: 30000idle-timeout: 600000max-lifetime: 1800000maximum-pool-size: 100minimum-idle: 10pool-name: HikaraPool-1
springdoc:swagger-ui:path: /swagger-ui.htmltags-sorter: alphaapi-docs:path: /v3/api-docsgroup-configs:- group: '查询接口'paths-to-match: '/**'packages-to-scan: com.zxs.springbootmybatisflex.controller.sys- group: '增删改接口'paths-to-match: '/**'packages-to-scan: com.zxs.springbootmybatisflex.controller.clientdefault-flat-param-object: trueknife4j:enable: true
package com.zxs.springbootmybatisflex.config;import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
@EnableKnife4j
public class SwaggerConfig {// 设置 openapi 基础参数@Beanpublic OpenAPI customOpenAPI() {return new OpenAPI().info(new Info().title("zxs API 管理").version("1.0").description("探索mybatis-flex demo").license(new License().name("Apache 2.0")));}
}
package com.zxs.springbootmybatisflex.controller.client;import com.mybatisflex.core.query.QueryCondition;
import com.mybatisflex.core.query.QueryWrapper;
import com.zxs.springbootmybatisflex.entity.User;
import com.zxs.springbootmybatisflex.service.UserService;
import com.zxs.springbootmybatisflex.uitl.DataResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;import static com.zxs.springbootmybatisflex.entity.table.UserTableDef.USER;@RestController
@Tag(name="用户增删改")
@RequestMapping("/suser")
public class SuserController {@AutowiredUserService userService;@Operation(summary = "根据id删除用户",description = "方式一")@GetMapping("/deleteUser/{id}")public DataResult<User> deleteUser(@PathVariable(value = "id") Long id){DataResult<User> result = DataResult.success();userService.deleteUser(id);return result;}@Operation(summary = "根据id删除用户",description = "方式二")@GetMapping("/deleteUser2/{id}")public DataResult<User> deleteUser2(@PathVariable(value = "id") Long id){DataResult<User> result = DataResult.success();userService.removeById(id);return result;}@Operation(summary = "根据id删除用户",description = "方式三")@GetMapping("/deleteUser3/{id}")public DataResult<User> deleteUser3(@PathVariable(value = "id") Long id){DataResult<User> result = DataResult.success();userService.deleteUser3(id);return result;}@Operation(summary = "根据id删除用户",description = "方式四")@GetMapping("/deleteUser4/{id}")public DataResult<User> deleteUser4(@PathVariable(value = "id") Long id){DataResult<User> result = DataResult.success();QueryCondition queryCondition =USER.ID.eq(id);userService.remove(queryCondition);return result;}@Operation(summary = "增加用户",description = "方式一")@PostMapping("/addUser1")public DataResult<User> addUser1(@RequestBody User user){DataResult<User> result = DataResult.success();userService.save(user);return result;}@Operation(summary = "修改用户",description = "方式一")@PostMapping("/updateUser1")public DataResult<User> updateUser1(@RequestBody User user){DataResult<User> result = DataResult.success();QueryWrapper queryWrapper = QueryWrapper.create().where(USER.USERNAME.eq(user.getUsername())).and(USER.PASSWORD.eq(user.getPassword()));userService.update(user,queryWrapper);return result;}@Operation(summary = "修改用户",description = "方式二")@PostMapping("/updateUser2")public DataResult<User> updateUser2(@RequestBody User user){DataResult<User> result = DataResult.success();QueryWrapper queryWrapper = QueryWrapper.create().where(USER.USERNAME.eq(user.getUsername())).and(USER.PASSWORD.eq(user.getPassword()));userService.update(user,queryWrapper);return result;}}
package com.zxs.springbootmybatisflex.controller.sys;import com.zxs.springbootmybatisflex.entity.User;
import com.zxs.springbootmybatisflex.service.UserService;
import com.zxs.springbootmybatisflex.uitl.DataResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.List;@RestController
@Tag(name="用户查询")
@RequestMapping("/user")
public class UserController {@AutowiredUserService userService;@Operation(summary = "获取全部用户",description="获取全部用户")@GetMapping("/selectUsers")public DataResult<List<User>> selectUsers(){DataResult<List<User>> result = DataResult.success();List<User> list = userService.list();result.setData(list);return result;}@Operation(summary = "根据id获取用户",description = "方式一")@GetMapping("/selectUser/{id}")public DataResult<User> selectUser(@PathVariable(value = "id") Long id){DataResult<User> result = DataResult.success();User user = userService.selectUserById(id);result.setData(user);return result;}@Operation(summary = "根据id获取用户",description = "方式二")@GetMapping("/selectUser2/{id}")public DataResult<User> selectUser2(@PathVariable(value = "id") Long id){DataResult<User> result = DataResult.success();User user = userService.getById(id);result.setData(user);return result;}@Operation(summary = "根据id获取用户",description = "方式三")@GetMapping("/selectUser3/{id}")public DataResult<User> selectUser3(@PathVariable(value = "id") Long id){DataResult<User> result = DataResult.success();User user = userService.selectUserById2(id);result.setData(user);return result;}
}
package com.zxs.springbootmybatisflex.entity;import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;import java.util.Date;@Data
@EqualsAndHashCode(callSuper = false)
@Tag(name = "用户", description = "用户实体类")
@Table("user")
public class User{@Schema(description="用户id")@JsonSerialize(using = ToStringSerializer.class)@Id(keyType = KeyType.Auto)private Long id;/*** 用户名*/@Schema(description="用户名")private String username;/*** 密码*/@Schema(description="密码")private String password;/*** 名称*/@Schema(description="名称")private String name;/*** 邮箱*/@Schema(description="邮箱")private String email;/*** 联系方式*/@Schema(description="手机号")private String phone;/*** 用户状态:1有效; 2删除*/@Schema(description="状态")private Integer status;/*** 创建时间*/@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")@Column("createTime")private Date createTime;/*** 用户类型*/@Schema(description="登录次数")private Integer logins;}
package com.zxs.springbootmybatisflex.exception.code;public enum BaseResponseCode implements ResponseCodeInterface {/*** 这个要和前段约定好* 引导用户去登录界面的* code=401001 引导用户重新登录* code=401002 token 过期刷新token* code=401008 无权限访问*/SUCCESS(200,"操作成功"),SYSTEM_BUSY(500001, "系统繁忙,请稍候再试"),OPERATION_ERRO(500002,"操作失败"),METHODARGUMENTNOTVALIDEXCEPTION(500003, "方法参数校验异常"),;/*** 错误码*/private final int code;/*** 错误消息*/private final String msg;BaseResponseCode(int code, String msg) {this.code = code;this.msg = msg;}@Overridepublic int getCode() {return code;}@Overridepublic String getMsg() {return msg;}
}
package com.zxs.springbootmybatisflex.exception.code;public interface ResponseCodeInterface {int getCode();String getMsg();
}
package com.zxs.springbootmybatisflex.exception.handler;import com.zxs.springbootmybatisflex.exception.BusinessException;
import com.zxs.springbootmybatisflex.exception.code.BaseResponseCode;
import com.zxs.springbootmybatisflex.uitl.DataResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;import java.util.List;@RestControllerAdvice
@Slf4j
public class RestExceptionHandler {@ExceptionHandler(Exception.class)public <T> DataResult<T> handleException(Exception e){log.error("Exception,exception:{}", e);return DataResult.getResult(BaseResponseCode.SYSTEM_BUSY);}@ExceptionHandler(value = BusinessException.class)<T> DataResult<T> businessExceptionHandler(BusinessException e) {log.error("BusinessException,exception:{}", e);return new DataResult<>(e.getMessageCode(),e.getDetailMessage());}@ExceptionHandler(MethodArgumentNotValidException.class)<T> DataResult<T> methodArgumentNotValidExceptionHandler(MethodArgumentNotValidException e) {log.error("methodArgumentNotValidExceptionHandler bindingResult.allErrors():{},exception:{}", e.getBindingResult().getAllErrors(), e);List<ObjectError> errors = e.getBindingResult().getAllErrors();return createValidExceptionResp(errors);}private <T> DataResult<T> createValidExceptionResp(List<ObjectError> errors) {String[] msgs = new String[errors.size()];int i = 0;for (ObjectError error : errors) {msgs[i] = error.getDefaultMessage();log.info("msg={}",msgs[i]);i++;}return DataResult.getResult(BaseResponseCode.METHODARGUMENTNOTVALIDEXCEPTION.getCode(), msgs[0]);}
}
package com.zxs.springbootmybatisflex.exception;import com.zxs.springbootmybatisflex.exception.code.ResponseCodeInterface;public class BusinessException extends RuntimeException{/*** 异常编号*/private final int messageCode;/*** 对messageCode 异常信息进行补充说明*/private final String detailMessage;public BusinessException(int messageCode,String message) {super(message);this.messageCode = messageCode;this.detailMessage = message;}/*** 构造函数* @param code 异常码*/public BusinessException(ResponseCodeInterface code) {this(code.getCode(), code.getMsg());}public int getMessageCode() {return messageCode;}public String getDetailMessage() {return detailMessage;}
}
package com.zxs.springbootmybatisflex.exception;import com.zxs.springbootmybatisflex.exception.code.ResponseCodeInterface;public class RoleSaveException extends RuntimeException{/*** 异常编号*/private final int messageCode;/*** 对messageCode 异常信息进行补充说明*/private final String detailMessage;public RoleSaveException(int messageCode, String message) {super(message);this.messageCode = messageCode;this.detailMessage = message;}/*** 构造函数* @param code 异常码*/public RoleSaveException(ResponseCodeInterface code) {this(code.getCode(), code.getMsg());}public int getMessageCode() {return messageCode;}public String getDetailMessage() {return detailMessage;}
}
package com.zxs.springbootmybatisflex.mapper;import com.mybatisflex.core.BaseMapper;
import com.zxs.springbootmybatisflex.entity.User;
import org.apache.ibatis.annotations.Mapper;@Mapper
public interface UserMapper extends BaseMapper<User> {
}
package com.zxs.springbootmybatisflex.service.impl;import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.zxs.springbootmybatisflex.entity.User;
import com.zxs.springbootmybatisflex.mapper.UserMapper;
import com.zxs.springbootmybatisflex.service.UserService;
import org.springframework.stereotype.Service;import static com.zxs.springbootmybatisflex.entity.table.UserTableDef.USER;@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {@Overridepublic User selectUserById(Long id) {return getById(id);}@Overridepublic User selectUserById2(Long id) {QueryWrapper queryWrapper = QueryWrapper.create().where(USER.ID.eq(id));return getOne(queryWrapper);}@Overridepublic void deleteUser(Long id) {removeById(id);}@Overridepublic void deleteUser3(Long id) {QueryWrapper queryWrapper = QueryWrapper.create().where(USER.ID.eq(id));remove(queryWrapper);}
}
package com.zxs.springbootmybatisflex.service;import com.mybatisflex.core.service.IService;
import com.zxs.springbootmybatisflex.entity.User;public interface UserService extends IService<User> {User selectUserById(Long id);User selectUserById2(Long id);void deleteUser(Long id);void deleteUser3(Long id);
}
package com.zxs.springbootmybatisflex.uitl;import com.zxs.springbootmybatisflex.exception.code.BaseResponseCode;
import com.zxs.springbootmybatisflex.exception.code.ResponseCodeInterface;
import lombok.Data;@Data
public class DataResult<T>{/*** 请求响应code,0为成功 其他为失败*/private int code;/*** 响应异常码详细信息*/private String msg;/*** 响应内容 , code 0 时为 返回 数据*/private T data;public DataResult(int code, T data) {this.code = code;this.data = data;this.msg=null;}public DataResult(int code, String msg, T data) {this.code = code;this.msg = msg;this.data = data;}public DataResult(int code, String msg) {this.code = code;this.msg = msg;this.data=null;}public DataResult() {this.code= BaseResponseCode.SUCCESS.getCode();this.msg=BaseResponseCode.SUCCESS.getMsg();this.data=null;}public DataResult(T data) {this.data = data;this.code=BaseResponseCode.SUCCESS.getCode();this.msg=BaseResponseCode.SUCCESS.getMsg();}public DataResult(ResponseCodeInterface responseCodeInterface) {this.data = null;this.code = responseCodeInterface.getCode();this.msg = responseCodeInterface.getMsg();}public DataResult(ResponseCodeInterface responseCodeInterface, T data) {this.data = data;this.code = responseCodeInterface.getCode();this.msg = responseCodeInterface.getMsg();}public static <T>DataResult success(){return new <T>DataResult();}public static <T>DataResult success(T data){return new <T>DataResult(data);}public static <T>DataResult getResult(int code,String msg,T data){return new <T>DataResult(code,msg,data);}public static <T>DataResult getResult(int code,String msg){return new <T>DataResult(code,msg);}public static <T>DataResult getResult(BaseResponseCode responseCode){return new <T>DataResult(responseCode);}public static <T>DataResult getResult(BaseResponseCode responseCode,T data){return new <T>DataResult(responseCode,data);}
}
package com.zxs.springbootmybatisflex;import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
@MapperScan("com.zxs.springbootmybatisflex.mapper")
public class SpringbootMybatisFlexApplication {public static void main(String[] args) {SpringApplication.run(SpringbootMybatisFlexApplication.class, args);}}

相关文章:
mybatis-flex探索
mybatis古今未来 最近无意之中发现了一个非常棒的持久层框架mybatis-flex,迫不及待研究了一下 发现简直就是我的梦中情框,之前写ibatis,后来写mybatis,接着写mybatis-plus,接着研究mybatis-flex ibatis ibatis是apa…...
用ClickHouse 文件表引擎快速查询分析文件数据
有时我们需要快速查询分析文件数据,正常流程需要在数据库中创建表,然后利用工具或编码导入数据,这时才能在数据库中查询分析。利用ClickHouse文件引擎可以快速查询文件数据。本文首先介绍ClickHouse文件引擎,然后介绍如何快速实现…...
esp8266httpclient_get_post使用
esp8266httpclient_get_post使用 #include<ESP8266WiFi.h> #include <ESP8266HTTPClient.h>//const char *ssid "AxxxIFI"; const char *password "xxxs879xxx68";const char* ssid "IT-nxxxang";const char* URL "http://…...
【Spring】创建一个Spring项目与Bean对象的存储
目录 一、创建Spring项目 1、创建Maven项目 2、配置maven国内源 3、引入spring依赖 4、添加启动类 二、将Bean对象存储到Spring(IoC容器) 1、创建Bean对象 2、将Bean存储到spring(容器)中 3、获取Bean对象 3.1、Applicatio…...
Docker的入门与使用
什么是Docker? docker官网 简介与概述 Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从 Apache2.0 协议开源。 Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上&#x…...
Smart HTML Elements 16.1 Crack
Smart HTML Elements 是一个现代 Vanilla JS 和 ES6 库以及下一代前端框架。企业级 Web 组件包括辅助功能(WAI-ARIA、第 508 节/WCAG 合规性)、本地化、从右到左键盘导航和主题。与 Angular、ReactJS、Vue.js、Bootstrap、Meteor 和任何其他框架集成。 智…...
[分享]STM32G070 串口 乱码 解决方法
硬件 NUCLEO-G070RB 工具 cubemx 解决方法 7bit 改为 8bit printf 配置方法 添加头文件 #include <stdio.h> 添加重定向代码 #ifdef __GNUC__#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)#else#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)#endi…...
[代码案例]学会python读写各类文件的操作(excel,txt,mat)
简介 python读写三类文件 excel文件 txt文件 mat文件 代码 """Description: python 读写各类文件 操作 """ import scipy as scipy from scipy.io import loadmat import xlwt import xlrd 读写excel文件workbook xlrd.open_workbook(test1.…...
【LeetCode】练习习题集【4月 - 7 月】
LEETCODE习题集【4月-7月总结】 简单 数组部分 1.重复数 题目: 在一个长度u为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中…...
C# 子类强制转换为父类异常,引出的C#Dll加载机制,以及同类名同命名空间同dll程序集在C#中是否为同一个类的研究。
已知,子类B继承自父类A,但是在代码运行时,B类强制转换为A类,却报代码转换异常。 很奇怪的问题吧,不过这个也是难得机会,去研究C#运行的底层原理。 下面是报错的代码片段。 string className _shapeRefle…...
Go语言进阶
个人笔记,大量摘自Go语言高级编程、Go|Dave Cheney等 更新 go get -u all 在非go目录运行go install golang.org/x/tools/goplslatest更新go tools:在go目录运行go get -u golang.org/x/tools/...,会更新bin目录下的应用; 运行…...
Java的枚举
枚举 对应英文(enumeration, 简写enum) 枚举是一组常量的集合,属于一种特殊的类,里面只包含一组有限的特定的对象。 自定义类实现枚举 1.不需要提供setXxx方法,因为枚举对象值通常为只读. 2.对枚举对象/属性使用 final static共同修饰…...
Pytest测试框架3
目录: pytest结合数据驱动-yamlpytest结合数据驱动-excelpytest结合数据驱动-csvpytest结合数据驱动-jsonpytest测试用例生命周期管理(一)pytest测试用例生命周期管理(二)pytest测试用例生命周期管理(三&a…...
【数学建模】-- Matlab中图的最短路径
前言: 图的基本概念: 若想简单绘制图可以利用此网站: 左上角Undirected/Directed是无向图/有向图 左边 0-index ,1-index为0下标,1下标。 Node Count为节点个数 Graph Data:最初尾节点的名称ÿ…...
中国月入过万的人多不多
Q:中国月入过万的人多不多 单从这个问题来看,这是个费米问题啊: 估算中国月入过万的有多少人? 要解决费米问题,其实也很好办,就是逻辑拆解,这篇文章也分为3个部分,先从公开数据中估…...
苹果电脑图像元数据编辑器:MetaImage for Mac
MetaImage for Mac是一款功能强大的照片元数据编辑器,它可以帮助用户编辑并管理照片的元数据信息,包括基本信息和扩展信息。用户可以根据需要进行批量处理,方便快捷地管理大量照片。 MetaImage for Mac还提供了多种导入和导出格式࿰…...
BeanUtils.copyProperties() 详解
BeanUtils.copyProperties会进行类型转换; BeanUtils.copyProperties方法简单来说就是将两个字段相同的对象进行属性值的复制。如果 两个对象之间存在名称不相同的属性,则 BeanUtils 不对这些属性进行处理,需要程序手动处理。 这两个类在不同…...
基于CentOS 7构建LVS-DR集群
DIPVIPRIPClient192.169.41.139 LVS 192.168.41.134192.169.41.10RS1192.168.41.135RS2192.168.41.138 要求: node4为客户端,node2为LVS,node3和node4为RS。 1.配置DNS解析(我这里使用本地解析) 192.168.41.134 www.y…...
openEuler-OECA考试报名火热开启,尊享半价优惠 作者:HopeInfra 发布时间:2023-08-10
近日,润和软件人才评定报名系统已成功上线运行,现openEuler-OECA人才评定考试报名优惠活动火热开启,欢迎大家报名咨询! 关于openEuler人才评定 随着openEuler及其发行版本在各个行业使用量逐年增多,相关人才的评定诉求…...
侯捷 C++面向对象编程笔记——10 继承与虚函数
10 继承与虚函数 10.1 Inheritance 继承 语法::public base_class_name public 只是一种继承的方式,还有protect,private 子类会拥有自己的以及父类的数据 10.1.1 继承下的构造和析构 与复合下的构造和析构相似 构造是由内而外 Container …...
第19节 Node.js Express 框架
Express 是一个为Node.js设计的web开发框架,它基于nodejs平台。 Express 简介 Express是一个简洁而灵活的node.js Web应用框架, 提供了一系列强大特性帮助你创建各种Web应用,和丰富的HTTP工具。 使用Express可以快速地搭建一个完整功能的网站。 Expre…...
React Native 导航系统实战(React Navigation)
导航系统实战(React Navigation) React Navigation 是 React Native 应用中最常用的导航库之一,它提供了多种导航模式,如堆栈导航(Stack Navigator)、标签导航(Tab Navigator)和抽屉…...
React第五十七节 Router中RouterProvider使用详解及注意事项
前言 在 React Router v6.4 中,RouterProvider 是一个核心组件,用于提供基于数据路由(data routers)的新型路由方案。 它替代了传统的 <BrowserRouter>,支持更强大的数据加载和操作功能(如 loader 和…...
vscode(仍待补充)
写于2025 6.9 主包将加入vscode这个更权威的圈子 vscode的基本使用 侧边栏 vscode还能连接ssh? debug时使用的launch文件 1.task.json {"tasks": [{"type": "cppbuild","label": "C/C: gcc.exe 生成活动文件"…...
现代密码学 | 椭圆曲线密码学—附py代码
Elliptic Curve Cryptography 椭圆曲线密码学(ECC)是一种基于有限域上椭圆曲线数学特性的公钥加密技术。其核心原理涉及椭圆曲线的代数性质、离散对数问题以及有限域上的运算。 椭圆曲线密码学是多种数字签名算法的基础,例如椭圆曲线数字签…...
sipsak:SIP瑞士军刀!全参数详细教程!Kali Linux教程!
简介 sipsak 是一个面向会话初始协议 (SIP) 应用程序开发人员和管理员的小型命令行工具。它可以用于对 SIP 应用程序和设备进行一些简单的测试。 sipsak 是一款 SIP 压力和诊断实用程序。它通过 sip-uri 向服务器发送 SIP 请求,并检查收到的响应。它以以下模式之一…...
人工智能--安全大模型训练计划:基于Fine-tuning + LLM Agent
安全大模型训练计划:基于Fine-tuning LLM Agent 1. 构建高质量安全数据集 目标:为安全大模型创建高质量、去偏、符合伦理的训练数据集,涵盖安全相关任务(如有害内容检测、隐私保护、道德推理等)。 1.1 数据收集 描…...
AI语音助手的Python实现
引言 语音助手(如小爱同学、Siri)通过语音识别、自然语言处理(NLP)和语音合成技术,为用户提供直观、高效的交互体验。随着人工智能的普及,Python开发者可以利用开源库和AI模型,快速构建自定义语音助手。本文由浅入深,详细介绍如何使用Python开发AI语音助手,涵盖基础功…...
Linux部署私有文件管理系统MinIO
最近需要用到一个文件管理服务,但是又不想花钱,所以就想着自己搭建一个,刚好我们用的一个开源框架已经集成了MinIO,所以就选了这个 我这边对文件服务性能要求不是太高,单机版就可以 安装非常简单,几个命令就…...
FFmpeg avformat_open_input函数分析
函数内部的总体流程如下: avformat_open_input 精简后的代码如下: int avformat_open_input(AVFormatContext **ps, const char *filename,ff_const59 AVInputFormat *fmt, AVDictionary **options) {AVFormatContext *s *ps;int i, ret 0;AVDictio…...
