当前位置: 首页 > news >正文

Swagger2 自定义排序

分享一下Spring+Swagger2在线文档自定义排序的代码。

这里参考swagger2 接口排序_swagger接口排序-CSDN博客提供的思路,并在此基础上做了优化。

1、引用pom信息

        <!--swagger依赖(pojo注解)--><dependency><groupId>io.swagger</groupId><artifactId>swagger-annotations</artifactId><version>1.5.20</version></dependency><!--生成后端开发文档--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.7.0</version><exclusions><exclusion><artifactId>jackson-annotations</artifactId><groupId>com.fasterxml.jackson.core</groupId></exclusion></exclusions></dependency><!--第三方生成后端开发文档页面UI--><dependency><groupId>com.github.xiaoymin</groupId><artifactId>swagger-bootstrap-ui</artifactId><version>1.9.6</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency>

2、未排序效果

现有3个接口模块

@Api(tags = "用户:用户相关接口")
@RestController
@RequestMapping("/system/user")
public class UserController{/** 列表 */@ApiOperation(value = "列表", notes = "")@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "pageSize", value = "页面大小", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "type", value = "标签类型", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "name", value = "标签名称", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "invalid", value = "状态", dataType = "int", paramType = "query"),})@PostMapping("/list")public ReturnMap list(Integer pageNum, Integer pageSize, String type, String name, Integer invalid, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();Map<String, Object> data = new HashMap<String, Object>();returnMap.setData(data);returnMap.success();return returnMap;}@ApiOperation(value = "新增用户", notes = "")@ApiImplicitParams({})@PostMapping("/addUser")public ReturnMap addUser(@RequestBody User user, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();returnMap.success();return returnMap;}}
@Api(tags = "系统:字典相关接口")
@RestController
@RequestMapping("/system/dict")
public class DictController{/** 列表 */@ApiOperation(value = "列表", notes = "")@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "pageSize", value = "页面大小", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "type", value = "标签类型", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "name", value = "标签名称", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "invalid", value = "状态", dataType = "int", paramType = "query"),})@PostMapping("/list")public ReturnMap list(Integer pageNum, Integer pageSize, String type, String name, Integer invalid, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();Map<String, Object> data = new HashMap<String, Object>();returnMap.setData(data);returnMap.success();return returnMap;}//更新角色@ApiOperation(value = "新增字典", notes = "")@ApiImplicitParams({})@PostMapping("/addDict")public ReturnMap addDict(@RequestBody Dict dict, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();returnMap.success();return returnMap;}}
@Api(tags = "系统:字典类型相关接口")
@RestController
@RequestMapping("/system/dictType")
public class DictTypeController{/** 列表 */@ApiOperation(value = "列表", notes = "")@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "pageSize", value = "页面大小", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "type", value = "标签类型", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "name", value = "标签名称", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "invalid", value = "状态", dataType = "int", paramType = "query"),})@PostMapping("/list")public ReturnMap list(Integer pageNum, Integer pageSize, String type, String name, Integer invalid, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();Map<String, Object> data = new HashMap<String, Object>();returnMap.setData(data);returnMap.success();return returnMap;}//新增角色@ApiOperation(value = "新增字典类型", notes = "")@ApiImplicitParams({})@PostMapping("/addDictType")public ReturnMap addDictType(@RequestBody DictType dictType, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();returnMap.success();return returnMap;}}

Swagger2显示如下:

期望展示顺序如下:

3、自定义排序改造

3.1 添加配置类Swagger2CustomSort并继承ServiceModelToSwagger2MapperImpl

API模块的排序,使用tag名称排序,在名称前加上前缀0X0X_##_,即在名称就加上"0101_##_"、"0102_##_"、"0201_##_"、"0202_##_"。但为了页面展示效果,在排序后把前缀进行处理。

接口的排序,使用@ApiOperation的position实现。

import com.google.common.base.Optional;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import io.swagger.models.Operation;
import io.swagger.models.Path;
import io.swagger.models.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.builders.BuilderDefaults;
import springfox.documentation.service.ApiDescription;
import springfox.documentation.service.ApiListing;
import springfox.documentation.swagger2.mappers.ServiceModelToSwagger2MapperImpl;
import springfox.documentation.swagger2.mappers.VendorExtensionsMapper;import java.util.*;/*** 自定义排序** 经过代码跟踪分析,总结如下:* 1.API模块的排序是依据tag 的名称进行的,虽然@Api里保留有position属性,但是已经完全弃用。* 2.接口的排序也是依据@ApiOperation里value的值进行的,position属性虽然废弃,但是仍可以进行设置取值。** 解决办法如下:* 1.API模块的排序,使用tag名称排序,在名称前加上前缀0X0X_##_,即在名称就加上"0101_##_"、"0102_##_"、"0201_##_"、"0202_##_"。但为了页面展示效果,在排序后把前缀进行处理;* 2.接口的排序,使用@ApiOperation的position实现。** @author https://blog.csdn.net/jinhf10/article/details/103684895*/
@Primary //同一个接口,可能会有几种不同的实现类,而默认只会采取其中一种的情况下
@Component("ServiceModelToSwagger2Mapper")
@Order(Ordered.HIGHEST_PRECEDENCE)
public class Swagger2CustomSort extends ServiceModelToSwagger2MapperImpl {//API接口排序序号识别private static final String API_SORT_PREFIX = "_##_";@Autowiredprivate VendorExtensionsMapper vendorExtensionsMapper;protected Map<String, Path> mapApiListings(Multimap<String, ApiListing> apiListings) {Map<String, Path> paths = Maps.newTreeMap();Iterator var3 = apiListings.values().iterator();while (var3.hasNext()) {ApiListing each = (ApiListing) var3.next();List<ApiDescription> list = each.getApis();Iterator var5 = each.getApis().iterator();while (var5.hasNext()) {ApiDescription api = (ApiDescription) var5.next();String position = api.getOperations().get(0).getPosition()+"";while(position.length() < 32){position = "0"+position;}paths.put(position + "-" + api.getPath(), this.mapOperations(api, Optional.fromNullable(paths.get(api.getPath()))));}}Map<String, Path> paths2 = new LinkedHashMap<>();for (String key : paths.keySet()) {paths2.put(key.substring(key.indexOf("-") + 1), paths.get(key));}return paths2;}private Path mapOperations(ApiDescription api, Optional<Path> existingPath) {Path path = (Path) existingPath.or(new Path());Iterator var4 = BuilderDefaults.nullToEmptyList(api.getOperations()).iterator();while (var4.hasNext()) {springfox.documentation.service.Operation each = (springfox.documentation.service.Operation) var4.next();Operation operation = this.mapOperation(each);path.set(each.getMethod().toString().toLowerCase(), operation);}return path;}protected Operation mapOperation(springfox.documentation.service.Operation from) {if (from == null) {return null;} else {Operation operation = new Operation();operation.setSecurity(this.mapAuthorizations(from.getSecurityReferences()));operation.setVendorExtensions(this.vendorExtensionsMapper.mapExtensions(from.getVendorExtensions()));operation.setDescription(from.getNotes());String position = from.getPosition()+"";while(position.length() < 32){position = "0"+position;}operation.setOperationId(position + from.getUniqueId());operation.setResponses(this.mapResponseMessages(from.getResponseMessages()));operation.setSchemes(this.stringSetToSchemeList(from.getProtocol()));Set<String> set = from.getTags();if (set != null) {Iterator<String> it= set.iterator();Set<String> rset= new HashSet<>();while (it.hasNext()){String tagName= it.next();if(API_SORT_PREFIX!=null && !"".equals(API_SORT_PREFIX)){if(tagName!=null && !"".equals(tagName) && tagName.indexOf(API_SORT_PREFIX)>=0){rset.add(tagName.substring(tagName.indexOf(API_SORT_PREFIX) + API_SORT_PREFIX.length()));}else{rset.add(tagName);}}else{rset.add(tagName);}}operation.setTags(new ArrayList(rset));} else {operation.setTags((List) null);}operation.setSummary(from.getSummary());Set<String> set1 = from.getConsumes();if (set1 != null) {operation.setConsumes(new ArrayList(set1));} else {operation.setConsumes((List) null);}Set<String> set2 = from.getProduces();if (set2 != null) {operation.setProduces(new ArrayList(set2));} else {operation.setProduces((List) null);}operation.setParameters(this.parameterListToParameterList(from.getParameters()));if (from.getDeprecated() != null) {operation.setDeprecated(Boolean.parseBoolean(from.getDeprecated()));}return operation;}}@Overrideprotected List<Tag> tagSetToTagList(Set<springfox.documentation.service.Tag> set) {List<Tag> tlist = super.tagSetToTagList(set);Collections.sort(tlist, new Comparator<Tag>() {@Overridepublic int compare(Tag t1, Tag t2) {return t1.getName().compareTo(t2.getName());}});List<Tag> result = new LinkedList<>();Iterator<Tag> it = tlist.iterator();while (it.hasNext()) {Tag tag = it.next();Tag tt = new Tag();if(API_SORT_PREFIX!=null && !"".equals(API_SORT_PREFIX)){if(tag.getName()!=null && !"".equals(tag.getName()) && tag.getName().indexOf(API_SORT_PREFIX)>=0){tt.setName(tag.getName().substring(tag.getName().indexOf(API_SORT_PREFIX) + API_SORT_PREFIX.length()));}else{tt.setName(tag.getName());}}else{tt.setName(tag.getName());}tt.setDescription(tag.getDescription());result.add(tt);}return result;}
}

3.2 接口Controller调整

做如下调整:

具体代码如下:

@Api(tags = "00101_##_用户:用户相关接口")
@RestController
@RequestMapping("/system/user")
public class UserController{/** 列表 */@ApiOperation(value = "列表", notes = "", position = 1)@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "pageSize", value = "页面大小", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "type", value = "标签类型", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "name", value = "标签名称", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "invalid", value = "状态", dataType = "int", paramType = "query"),})@PostMapping("/list")public ReturnMap list(Integer pageNum, Integer pageSize, String type, String name, Integer invalid, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();Map<String, Object> data = new HashMap<String, Object>();returnMap.setData(data);returnMap.success();return returnMap;}@ApiOperation(value = "新增用户", notes = "", position = 2)@ApiImplicitParams({})@PostMapping("/addUser")public ReturnMap addUser(@RequestBody User user, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();returnMap.success();return returnMap;}}
@Api(tags = "00202_##_系统:字典相关接口")
@RestController
@RequestMapping("/system/dict")
public class DictController{/** 列表 */@ApiOperation(value = "列表", notes = "", position = 1)@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "pageSize", value = "页面大小", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "type", value = "标签类型", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "name", value = "标签名称", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "invalid", value = "状态", dataType = "int", paramType = "query"),})@PostMapping("/list")public ReturnMap list(Integer pageNum, Integer pageSize, String type, String name, Integer invalid, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();Map<String, Object> data = new HashMap<String, Object>();returnMap.setData(data);returnMap.success();return returnMap;}//更新角色@ApiOperation(value = "新增字典", notes = "", position = 2)@ApiImplicitParams({})@PostMapping("/addDict")public ReturnMap addDict(@RequestBody Dict dict, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();returnMap.success();return returnMap;}}
@Api(tags = "00201_##_系统:字典类型相关接口")
@RestController
@RequestMapping("/system/dictType")
public class DictTypeController{/** 列表 */@ApiOperation(value = "列表", notes = "", position = 1)@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "pageSize", value = "页面大小", dataType = "int", paramType = "query"),@ApiImplicitParam(name = "type", value = "标签类型", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "name", value = "标签名称", dataType = "String", paramType = "query"),@ApiImplicitParam(name = "invalid", value = "状态", dataType = "int", paramType = "query"),})@PostMapping("/list")public ReturnMap list(Integer pageNum, Integer pageSize, String type, String name, Integer invalid, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();Map<String, Object> data = new HashMap<String, Object>();returnMap.setData(data);returnMap.success();return returnMap;}//新增角色@ApiOperation(value = "新增字典类型", notes = "", position = 2)@ApiImplicitParams({})@PostMapping("/addDictType")public ReturnMap addDictType(@RequestBody DictType dictType, HttpServletRequest request, HttpServletResponse response){ReturnMap returnMap = new ReturnMap();returnMap.success();return returnMap;}}

4、自定义排序效果

重新编译运行后,Swagger2显示如下:

相关文章:

Swagger2 自定义排序

分享一下SpringSwagger2在线文档自定义排序的代码。 这里参考swagger2 接口排序_swagger接口排序-CSDN博客提供的思路&#xff0c;并在此基础上做了优化。 1、引用pom信息 <!--swagger依赖(pojo注解)--><dependency><groupId>io.swagger</groupId>&l…...

sentinel的限流原理

Sentinel 的限流原理基于 流量统计 和 流量控制策略&#xff0c;通过动态规则对系统资源进行保护。其核心设计包括以下几个关键点&#xff1a; 流量统计模型&#xff1a;滑动时间窗口 Sentinel 使用 滑动时间窗口算法 统计单位时间内的请求量&#xff0c;相比传统的固定时间窗…...

Mac 部署Ollama + OpenWebUI完全指南

文章目录 &#x1f4bb; 环境说明&#x1f6e0;️ Ollama安装配置1. 安装[Ollama](https://github.com/ollama/ollama)2. 启动Ollama3. 模型存储位置4. 配置 Ollama &#x1f310; OpenWebUI部署1. 安装Docker2. 部署[OpenWebUI](https://www.openwebui.com/)&#xff08;可视化…...

C/C++ 面试智能指针

说下你对智能指针的理解 回答1: 因为C使用内存的时候很容易出现野指针、悬空指针、内存泄露的问题。所以C11引入了智能指针来管理内存。有四种&#xff1a; auto_ptr&#xff1a;已经不用了unique_ptr&#xff1a;独占式指针&#xff0c;同一时刻只能有一个指针指向同一个对…...

Halcon缓存?内存泄漏?

目录 1、前言 2、图片缓存 3、全局内存缓存 4、临时内存缓存 5、处理 HALCON 中的疑似内存泄漏 6、其他 1、前言 除⾮必要,否则不建议修改 HALCON 自带的缓存设置。 2、图片缓存 图像通常需要大量内存,而分配大块内存的过程较慢。因此,当释放图像时,HALCON并…...

升级 SpringBoot3 全项目讲解 — 周边店铺展示功能如何实现

学会这款 &#x1f525;全新设计的 Java 脚手架 &#xff0c;从此面试不再怕&#xff01; 1. 升级 Spring Boot 到 3.x 在升级 Spring Boot 之前&#xff0c;我们需要确保项目的依赖和配置与新版本兼容。以下是升级的主要步骤&#xff1a; 1.1 更新 pom.xml 文件 首先&#…...

Git(分布式版本控制系统)系统学习笔记【并利用腾讯云的CODING和Windows上的Git工具来实操】

Git的概要介绍 1️⃣ Git 是什么&#xff1f; Git 是一个 分布式版本控制系统&#xff08;DVCS&#xff09;&#xff0c;用于跟踪代码的变更、协作开发和管理项目历史。 由 Linus Torvalds&#xff08;Linux 之父&#xff09;在 2005 年开发&#xff0c;主要用于 代码管理。…...

光学和光子学模拟工具在 AR/VR 中的作用

AR/VR 中的光学和光子学 增强现实 (AR) 和虚拟现实 (VR) 站在数字进化的前沿。光学和光子学这一复杂的科学深入研究了光的产生、检测和操控&#xff0c;在这一转变中发挥着至关重要的作用。 图 1 (a) 展示了 AR 系统的设计&#xff0c;强调了光学的关键作用。该图描绘了光的旅…...

大模型产品Deepseek(四)、本地安装部署(Ollama方式)

Ollama与DeepSeek的本地安装与部署教程(Windows/MacOS) 在许多AI应用场景中,您可能希望将智能模型本地化,以便更高效地处理数据并减少对外部云服务的依赖。本文将介绍如何在Windows和macOS上直接安装和配置Ollama,以及如何基于Ollama平台部署DeepSeek模型并进行本地交互。…...

visual studio安装

一、下载Visual Studio 访问Visual Studio官方网站。下载 Visual Studio Tools - 免费安装 Windows、Mac、Linux 在主页上找到并点击“下载 Visual Studio”按钮。 选择适合需求的版本&#xff0c;例如“Visual Studio Community”&#xff08;免费版本&#xff09;&#x…...

AI大模型——DeepSeek模型部署实战

摘要 文章主要介绍了DeepSeek大模型的本地部署方法、使用方式以及API接入相关内容。首先指出可通过下载Ollama来部署DeepSeek-R1模型&#xff0c;并给出了模型不同参数版本及存储信息。接着说明了如何通过Chatbox官网下载并接入DeepSeek API&#xff0c;以及如何接入本地部署模…...

音视频的文件封装——AVI、MP4、MKV

3.MKV (Matroska Video File) Matroska &#xff08;俄语&#xff1a; матроска &#xff09;是一种多媒体封装格式&#xff0c;可把多种不同编码的影像、不同格式的音频、不同语言的字幕封装到一个文件内。也是一种开放源代码的多媒体封装格式。 Matroska 支持多种文件…...

讯飞绘镜(ai生成视频)技术浅析(五):视频生成

讯飞绘镜(AI生成视频)是一种先进的AI视频生成技术,能够将静态的分镜画面转换为动态视频,并使画面中的元素按照一定的逻辑和动作进行动态展示。 一、讯飞绘镜视频生成技术概述 讯飞绘镜的视频生成技术主要包含以下几个核心模块: 1.视频生成模型:包括生成对抗网络(GAN)…...

【FPGA】 MIPS 12条整数指令 【3】

实现乘除 修改框架 EX&#xff1a;实现带符号乘除法和无符号乘除法 HiLo寄存器&#xff1a;用于存放乘法和除法的运算结果。Hi、Lo为32bit寄存器。电路描述与实现RegFile思想一致 仿真 代码 DataMem.v include "define.v"; module DataMem(input wire clk,input…...

【补充】RustDesk一键部署及账号登录配置

前言 之前分享的配置rustdesk的帖子只是搭建了一个简易服务器&#xff0c;仅能实现简单的远程桌面功能。在后续的使用中切换设备使用时无法看到之前连接的设备&#xff0c;必须知道每个设备的id号&#xff0c;才能在新设备上连接。数据无法在设备间迁移&#xff0c;感觉很麻烦…...

2025.2.6 数模AI智能体大更新,更专业的比赛辅导,同提示词效果优于gpt-o1/o3mini、deepseek-r1满血

本次更新重新梳理了回复逻辑规则&#xff0c;无任何工作流&#xff0c;一共3.2k字细节描述。具体效果可以看视频&#xff0c;同时也比对了gpt-o1、gpt-o3mini、deepseek-r1-67BI&#xff0c;从数学建模题目解答上来看&#xff0c;目前我的数模AI智能体具有明显优势。 AI智能体优…...

昇腾,Ascend,NPU,mindie,镜像,部署vllm:第3篇,补档,没事可以看看这个readme

文章目录 前言文件位置已改变atb model和mindie的关系前言 在之前的版本中,我们提到了一个帮助文档(Readme),这个文档告诉我们,当时的mindie版本不支持0.5b版本的通义千问2.5 我现在就很好奇,新版的mindie,是否支持0.5b的版本呢? 文件位置已改变 之前的文件位置: …...

PbootCMS 修改跳转提示,修改笑脸时间

在使用时&#xff0c;每次都提示这个&#xff1a; 修改方法&#xff1a; 修改跳转时间&#xff1a;找到 handle.php 文件编辑 &#xff0c;调整 setTimeout 函数的时间参数。 修改提示文字&#xff1a;编辑 handle.php 文件&#xff0c;修改提示文字的内容。 隐藏提示页面&am…...

Python办公笔记——将csv文件转Json

目录 专栏导读1、背景2、库的安装3、代码1—自定义表头4、代码2—全字段5、代码3—全字段总结 专栏导读 &#x1f338; 欢迎来到Python办公自动化专栏—Python处理办公问题&#xff0c;解放您的双手 &#x1f3f3;️‍&#x1f308; 博客主页&#xff1a;请点击——> 一晌…...

25/2/7 <机器人基础>雅可比矩阵计算 雅可比伪逆

雅可比矩阵计算 雅可比矩阵的定义 假设我们有一个简单的两个关节的平面机器人臂&#xff0c;其末端执行器的位置可以表示为&#xff1a; 其中&#xff1a; L1​ 和 L2 是机器人臂的长度。θ1​ 和 θ2是关节的角度。 计算雅可比矩阵 雅可比矩阵 JJ 的定义是将关节速度与末…...

流媒体缓存管理策略

缓存管理策略是指为了优化性能、资源使用和用户体验而对缓存数据进行管理的方法和规则。以下是一些常见的缓存管理策略&#xff1a; 1. LRU&#xff08;Least Recently Used&#xff0c;最近最少使用&#xff09; 原理&#xff1a;当缓存满了&#xff0c;需要腾出空间时&…...

【Sql Server】sql server 2019设置远程访问,外网服务器需要设置好安全组入方向规则

大家好&#xff0c;我是&#xff0c;欢迎来到《小5讲堂》。 这是《Sql Server》系列文章&#xff0c;每篇文章将以博主理解的角度展开讲解。 温馨提示&#xff1a;博主能力有限&#xff0c;理解水平有限&#xff0c;若有不对之处望指正&#xff01; 目录 前言1、无法链接2、数…...

阿里云 | DeepSeek人工智能大模型安装部署

ModelScope是阿里云人工智能大模型开源社区 ModelScope网络链接地址 https://www.modelscope.cn DeepSeek模型库网络链接地址 https://www.modelscope.cn/organization/deepseek-ai 如上所示&#xff0c;在阿里云人工智能大模型开源社区ModelScope中&#xff0c;使用阿里云…...

Spring Test 教程大纲

Spring Test 教程大纲 目标&#xff1a;基于 JUnit 5&#xff0c;系统学习 Spring Test 的核心原理、注解使用、测试框架集成及扩展开发。 第 1 章&#xff1a;Spring Test 简介与核心原理 1.1 Spring Test 的作用与优势 简化 Spring 应用的单元测试与集成测试。核心目标&am…...

MySQL数据库基础(创建/删除 数据库/表)

一、数据库的操作 1.1 显示当前数据库 语法&#xff1a;show databases&#xff1b; <1>show 是一个关键字&#xff0c;表示要执行的操作类型 <2>databases 是复数&#xff0c;表示显示所有数据库 上面的数据库中&#xff0c;除了java113&#xff0c;其它的数据库…...

Llama最新开源大模型Llama3.1

Meta公司于2024年7月23日发布了最新的开源大模型Llama 3.1&#xff0c;这是其在大语言模型领域的重要进展。以下是关于Llama 3.1的详细介绍&#xff1a; 参数规模与训练数据 Llama 3.1拥有4050亿&#xff08;405B&#xff09;参数&#xff0c;是目前开源领域中参数规模最大的…...

PHP 面向对象编程详解

PHP 面向对象编程详解 引言 PHP 作为一种广泛使用的服务器端脚本语言&#xff0c;自诞生以来就以其简洁、易学、高效的特点受到开发者的喜爱。随着互联网技术的不断发展&#xff0c;PHP 也在不断地进化&#xff0c;其中面向对象编程&#xff08;OOP&#xff09;已经成为 PHP …...

YOLOv11-ultralytics-8.3.67部分代码阅读笔记-files.py

files.py ultralytics\utils\files.py 目录 files.py 1.所需的库和模块 2.class WorkingDirectory(contextlib.ContextDecorator): 3.def spaces_in_path(path): 4.def increment_path(path, exist_okFalse, sep"", mkdirFalse): 5.def file_age(path__fi…...

安卓开发,打开PDF文件

1、把PDF文件复制到raw目录下 &#xff08;1&#xff09;新建一个Android Resource Directory (2)Resource type 改成 raw (3) 把PDF文件复制到raw目录下 2、activity_main.xml <?xml version"1.0" encoding"utf-8"?> <LinearLayoutxmlns:and…...

标准模版——添加蜂鸣器及继电器功能模块

一、peripheral.h代码 #include "STC15F2K60S2.H"void Set_Peripheral(unsigned char Buzzer_Status,unsigned char Relay_Status); 二、peripheral.c代码 #include "peripheral.h"void Set_Peripheral(unsigned char Buzzer_Status,unsigned char Rela…...

嵌入式工程师面试经验分享与案例解析

嵌入式工程师岗位受到众多求职者的关注。面试流程严格&#xff0c;技术要求全面&#xff0c;涵盖C/C编程、数据结构与算法、操作系统、嵌入式系统开发、硬件驱动等多个方向。本文将结合真实案例&#xff0c;深入剖析嵌入式工程师的面试流程、常见问题及应对策略&#xff0c;帮助…...

《云夹:高效便捷的书签管理利器》

在信息爆炸的时代&#xff0c;我们每天都会浏览大量的网页&#xff0c;遇到许多有价值的内容。如何高效地管理这些网页书签&#xff0c;以便随时快速访问&#xff0c;成为了一个重要的问题。云夹作为一款出色的书签管理工具&#xff0c;为我们提供了完美的解决方案。 强大的功能…...

ASP.NET Core标识框架Identity

目录 Authentication与Authorization 标识框架&#xff08;Identity&#xff09; Identity框架的使用 初始化 自定义属性 案例一&#xff1a;添加用户、角色 案例二&#xff1a;检查登录用户信息 案例三&#xff1a;实现密码的重置 步骤 Authentication与Authorizatio…...

Web - CSS3过渡与动画

过渡 基本使用 transition过渡属性是css3浓墨重彩的特性&#xff0c;过渡可以为一个元素在不同样式之间变化自动添加补间动画。 过渡从kIE10开始兼容&#xff0c;移动端兼容良好&#xff0c;网页上的动画特效基本都是由JavaScript定时器实现的&#xff0c;现在逐步改为css3过…...

css-根据不同后端返回值返回渲染不同的div样式以及公共组件设定

1.动态绑定 Vue: 使用计算属性 getClassName 来动态计算样式类名&#xff0c;并通过 :class 绑定到 div 元素上。 <template><div :class"getClassName">这是一个根据后端值动态设置样式的 div 元素。</div> </template><script> exp…...

ES6 Set 数据结构用法总结

1. Set 基本概念 Set 是 ES6 提供的新的数据结构&#xff0c;类似于数组&#xff0c;但成员的值都是唯一的&#xff0c;没有重复的值。Set 本身是一个构造函数&#xff0c;用来生成 Set 数据结构。 1.1 基本用法 // 创建一个空Set const set new Set();// 创建一个带有初始…...

Celery任务阻塞问题排查

笔者在工作中经常用到Celery&#xff0c;遇到了2个任务阻塞的问题&#xff0c;分享经验如下。 1 Celery原理 Celery是基于Python开发的分布式任务调度框架&#xff0c;可以将任务发送到若干台机器上&#xff0c;实现多并发调度和计算。Celery的架构主要包含生产者&#xff08…...

巧用DeepSeek,编写CAPL自动化测试脚本

文章目录 前言提问及回答小结 前言 蛇年伊始&#xff0c;火出圈的除了《哪吒2》登顶中国影史票房第一外&#xff0c;科技圈的DeepSeek国产大模型引爆全球&#xff0c;关于在DeepSeek上的提问无奇不有。就车载通信自动化测试&#xff0c;本文也来蹭蹭热度。作为CAN/LIN协议一致…...

【信息系统项目管理师】第21章:项目管理科学基础 详解

更多内容请见: 备考信息系统项目管理师-专栏介绍和目录 文章目录 21.1 工程经济学21.2 运筹学1.线性规划2.一般的运输问题3.指派问题4.动态规划法5.最小生成树6.博弈论7.决策每年管理科学在综合题里固定是5分,案例分析和论文不考。主要是科学管理相关内容,包括工程经济学、运…...

webpack配置语言之---ts

由于webpack本身不支持ts&#xff0c;如果需要编译ts文件&#xff0c;需要下载相应的loader对ts文件进行编译&#xff0c;以及配置tsconfig.json文件&#xff0c;配置ts的编译选项 1. 安装必要的依赖 首先&#xff0c;确保你已经安装了 Webpack 和 TypeScript。如果还没有安装…...

WPF 进度条(ProgressBar)示例一

本文讲述&#xff1a;WPF 进度条(ProgressBar)简单的样式修改和使用。 进度显示界面&#xff1a;使用UserControl把ProgressBar和进度值以及要显示的内容全部组装在UserControl界面中&#xff0c;方便其他界面直接进行使用。 <UserControl x:Class"DefProcessBarDemo…...

金蛇祈福,鸿运开年!广州白云皮具城2025开市大吉!

锣鼓一响&#xff0c;黄金万两&#xff01;2月6日大年初九&#xff0c;广州白云皮具城举行盛大的醒狮开市仪式&#xff01;象征吉祥如意的醒狮&#xff0c;将好运、财运传递给全体商户和八方来客。 醒狮点睛 金鼓一响黄金万两&#xff0c;十头醒狮登台&#xff0c;董事总经理刘…...

centos虚拟机迁移没有ip的问题

故事背景&#xff0c;我们的centos虚拟机本来是好好的&#xff0c;但是拷贝到其他电脑上就不能分配ip&#xff0c;我个人觉得这个vmware他们软件应该搞定这个啊&#xff0c;因为这个问题是每次都会出现的。 网络选桥接 网络启动失败 service network restart Restarting netw…...

【ESP32cam人脸识别开门及服务器端实战源码】

本项目实现了一个基于ESP32-CAM的实时人脸识别系统&#xff0c;能够通过WiFi进行视频流传输&#xff0c;并在检测到人脸时触发开门指令。系统由两个主要部分组成&#xff1a;video.py&#xff08;后端服务器&#xff09;和 ESP32-CAM.ino&#xff08;ESP32-CAM固件&#xff09;…...

【自开发工具介绍】SQLSERVER的ImpDp和ExpDp工具04

SQLSERVER的ImpDp和ExpDp工具演示 1、指定某些表作为导出对象外 (-exclude_table) 验证用&#xff1a;导出的表&#xff0c;导入到新的数据库 2、指定某些表作为导出对象外 (-exclude_table) 支持模糊检索&#xff0c;可以使用星号 以s开头的表作为导出对象外&#xff0c;…...

什么是中间件中间件有哪些

什么是中间件&#xff1f; 中间件&#xff08;Middleware&#xff09;是指在客户端和服务器之间的一层软件组件&#xff0c;用于处理请求和响应的过程。 中间件是指介于两个不同系统之间的软件组件&#xff0c;它可以在两个系统之间传递、处理、转换数据&#xff0c;以达到协…...

WebSocket connection failed 解决

WebSocket connection failed 解决 前言 这里如果是新手小白不知道 WebSocket 是什么的&#xff1f; 怎么使用的&#xff1f;或者想深入了解的 那可以 点击这里 几分钟带你快速了解并使用&#xff0c;已经一些进阶讲解&#xff1b; WebSocket&#xff0c;多应用于需要双向数据…...

C语言:取出32位数据的高十六位

目录 背景 目标 操作步骤 1. 右移 16 位 2. 掩码操作&#xff08;可选&#xff09; 代码实现 解释&#xff1a; 输出&#xff1a; 总结&#xff1a; 背景 假设我们有一个 32 位的无符号整数&#xff0c;通常它是由 4 个字节组成的。每个字节由 8 位构成&#xff0c;4…...

JUnit 5 条件测试注解详解

JUnit 5 条件测试注解详解 JUnit 5 提供了一系列条件测试注解&#xff0c;允许开发者根据运行时环境、配置或自定义逻辑动态决定是否执行测试。这些注解能有效减少误报&#xff0c;提升测试的灵活性和适应性。以下是所有条件测试注解的详细介绍及示例&#xff1a; 一、条件测试…...

1 Java 基础面试题(上)

文章目录 前言1. Java 中的序列化和反序列化是什么&#xff1f;1.1 序列化&#xff08;Serialization&#xff09;1.2 反序列化&#xff08;Deserialization&#xff09;1.3 serialVersionUID1.4 序列化的应用场景1.5 Transient 关键字 2. 为什么 Java 里面不支持多重继承&…...