springboot整合elasticsearch使用案例
引入依赖
<dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId>
</dependency>
添加注入
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;@MapperScan("cn.itcast.hotel.mapper")
@SpringBootApplication
public class HotelDemoApplication {public static void main(String[] args) {SpringApplication.run(HotelDemoApplication.class, args);}@Beanpublic RestHighLevelClient client(){return new RestHighLevelClient(RestClient.builder(HttpHost.create("http://43.139.59.28:9200")));}}
搜索和分页
完成关键字搜索和分页
model类
import lombok.Data;@Data
public class RequestParams {private String key;private Integer page;private Integer size;private String sortBy;
}
返回类
import lombok.Data;import java.util.List;@Data
public class PageResult {private Long total;private List<HotelDoc> hotels;public PageResult() {}public PageResult(Long total, List<HotelDoc> hotels) {this.total = total;this.hotels = hotels;}
}
controller类
@RestController
@RequestMapping("/hotel")
public class HotelController {@Autowiredprivate IHotelService hotelService;// 搜索酒店数据@PostMapping("/list")public PageResult search(@RequestBody RequestParams params){return hotelService.search(params);}
}
Service类
import cn.itcast.hotel.mapper.HotelMapper;
import cn.itcast.hotel.pojo.Hotel;
import cn.itcast.hotel.pojo.HotelDoc;
import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.io.IOException;
import java.util.ArrayList;
import java.util.List;@Service
public class HotelService extends ServiceImpl<HotelMapper, Hotel> implements IHotelService {@Autowiredprivate RestHighLevelClient client;@Overridepublic PageResult search(RequestParams params) {try {// 1.准备RequestSearchRequest request = new SearchRequest("hotel");// 2.准备DSL// 2.1.queryString key = params.getKey();if (key == null || "".equals(key)) {request.source().query(QueryBuilders.matchAllQuery());} else {request.source().query(QueryBuilders.matchQuery("all", key));}// 2.2.分页int page = params.getPage();int size = params.getSize();request.source().from((page - 1) * size).size(size);// 3.发送请求SearchResponse response = client.search(request, RequestOptions.DEFAULT);// 4.解析响应return handleResponse(response);} catch (IOException e) {throw new RuntimeException(e);}}// 结果解析private PageResult handleResponse(SearchResponse response) {// 4.解析响应SearchHits searchHits = response.getHits();// 4.1.获取总条数long total = searchHits.getTotalHits().value;// 4.2.文档数组SearchHit[] hits = searchHits.getHits();// 4.3.遍历List<HotelDoc> hotels = new ArrayList<>();for (SearchHit hit : hits) {// 获取文档sourceString json = hit.getSourceAsString();// 反序列化HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);// 放入集合hotels.add(hotelDoc);}// 4.4.封装返回return new PageResult(total, hotels);}
}
发出请求
结果过滤
添加品牌、城市、星级、价格等过滤功能
model类
import lombok.Data;@Data
public class RequestParams {private String key;private Integer page;private Integer size;private String sortBy;// 下面是新增的过滤条件参数private String city;private String brand;private String starName;private Integer minPrice;private Integer maxPrice;
}
service类
@Overridepublic PageResult search(RequestParams params) {try {// 1.准备RequestSearchRequest request = new SearchRequest("hotel");// 2.准备DSL// 2.1.querybuildBasicQuery(params,request);// 2.2.分页int page = params.getPage();int size = params.getSize();request.source().from((page - 1) * size).size(size);// 3.发送请求SearchResponse response = client.search(request, RequestOptions.DEFAULT);// 4.解析响应return handleResponse(response);} catch (IOException e) {throw new RuntimeException(e);}}private void buildBasicQuery(RequestParams params, SearchRequest request) {// 1.构建BooleanQueryBoolQueryBuilder boolQuery = QueryBuilders.boolQuery();// 2.关键字搜索String key = params.getKey();if (key == null || "".equals(key)) {boolQuery.must(QueryBuilders.matchAllQuery());} else {boolQuery.must(QueryBuilders.matchQuery("all", key));}// 3.城市条件if (params.getCity() != null && !params.getCity().equals("")) {boolQuery.filter(QueryBuilders.termQuery("city", params.getCity()));}// 4.品牌条件if (params.getBrand() != null && !params.getBrand().equals("")) {boolQuery.filter(QueryBuilders.termQuery("brand", params.getBrand()));}// 5.星级条件if (params.getStarName() != null && !params.getStarName().equals("")) {boolQuery.filter(QueryBuilders.termQuery("starName", params.getStarName()));}// 6.价格if (params.getMinPrice() != null && params.getMaxPrice() != null) {boolQuery.filter(QueryBuilders.rangeQuery("price").gte(params.getMinPrice()).lte(params.getMaxPrice()));}// 7.放入sourcerequest.source().query(boolQuery);}
发出请求
搜索附近
搜索我附近的酒店
model类
import lombok.Data;@Data
public class RequestParams {private String key;private Integer page;private Integer size;private String sortBy;private String city;private String brand;private String starName;private Integer minPrice;private Integer maxPrice;// 我当前的地理坐标private String location;
}
文档类
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@NoArgsConstructor
public class HotelDoc {private Long id;private String name;private String address;private Integer price;private Integer score;private String brand;private String city;private String starName;private String business;private String location;private String pic;// 排序时的 距离值private Object distance;public HotelDoc(Hotel hotel) {this.id = hotel.getId();this.name = hotel.getName();this.address = hotel.getAddress();this.price = hotel.getPrice();this.score = hotel.getScore();this.brand = hotel.getBrand();this.city = hotel.getCity();this.starName = hotel.getStarName();this.business = hotel.getBusiness();this.location = hotel.getLatitude() + ", " + hotel.getLongitude();this.pic = hotel.getPic();}
}
service类
import cn.itcast.hotel.mapper.HotelMapper;
import cn.itcast.hotel.pojo.Hotel;
import cn.itcast.hotel.pojo.HotelDoc;
import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.unit.DistanceUnit;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.io.IOException;
import java.util.ArrayList;
import java.util.List;@Service
public class HotelService extends ServiceImpl<HotelMapper, Hotel> implements IHotelService {@Autowiredprivate RestHighLevelClient client;@Overridepublic PageResult search(RequestParams params) {try {// 1.准备RequestSearchRequest request = new SearchRequest("hotel");// 2.准备DSL// 2.1.querybuildBasicQuery(params, request);// 2.2.分页int page = params.getPage();int size = params.getSize();request.source().from((page - 1) * size).size(size);// 2.3.排序String location = params.getLocation();if (location != null && !location.equals("")) {request.source().sort(SortBuilders.geoDistanceSort("location", new GeoPoint(location)).order(SortOrder.ASC).unit(DistanceUnit.KILOMETERS));}// 3.发送请求SearchResponse response = client.search(request, RequestOptions.DEFAULT);// 4.解析响应return handleResponse(response);} catch (IOException e) {throw new RuntimeException(e);}}private void buildBasicQuery(RequestParams params, SearchRequest request) {// 1.构建BooleanQueryBoolQueryBuilder boolQuery = QueryBuilders.boolQuery();// 2.关键字搜索String key = params.getKey();if (key == null || "".equals(key)) {boolQuery.must(QueryBuilders.matchAllQuery());} else {boolQuery.must(QueryBuilders.matchQuery("all", key));}// 3.城市条件if (params.getCity() != null && !params.getCity().equals("")) {boolQuery.filter(QueryBuilders.termQuery("city", params.getCity()));}// 4.品牌条件if (params.getBrand() != null && !params.getBrand().equals("")) {boolQuery.filter(QueryBuilders.termQuery("brand", params.getBrand()));}// 5.星级条件if (params.getStarName() != null && !params.getStarName().equals("")) {boolQuery.filter(QueryBuilders.termQuery("starName", params.getStarName()));}// 6.价格if (params.getMinPrice() != null && params.getMaxPrice() != null) {boolQuery.filter(QueryBuilders.rangeQuery("price").gte(params.getMinPrice()).lte(params.getMaxPrice()));}// 7.放入sourcerequest.source().query(boolQuery);}// 结果解析private PageResult handleResponse(SearchResponse response) {// 4.解析响应SearchHits searchHits = response.getHits();// 4.1.获取总条数long total = searchHits.getTotalHits().value;// 4.2.文档数组SearchHit[] hits = searchHits.getHits();// 4.3.遍历List<HotelDoc> hotels = new ArrayList<>();for (SearchHit hit : hits) {// 获取文档sourceString json = hit.getSourceAsString();// 反序列化HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);// 获取排序值Object[] sortValues = hit.getSortValues();if (sortValues.length > 0) {Object sortValue = sortValues[0];hotelDoc.setDistance(sortValue);}// 放入集合hotels.add(hotelDoc);}// 4.4.封装返回return new PageResult(total, hotels);}
}
发送请求
竞价排名
让指定的酒店在搜索结果中排名置顶
修改索引库
添加isAD字段
PUT /hotel/_mapping
{"properties":{"isAD":{"type":"boolean"}}
}
修改文档
POST /hotel/_update/1393017952
{"doc": {"isAD": true}
}
model类
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@NoArgsConstructor
public class HotelDoc {private Long id;private String name;private String address;private Integer price;private Integer score;private String brand;private String city;private String starName;private String business;private String location;private String pic;private Object distance;// 添加广告标记private Boolean isAD;public HotelDoc(Hotel hotel) {this.id = hotel.getId();this.name = hotel.getName();this.address = hotel.getAddress();this.price = hotel.getPrice();this.score = hotel.getScore();this.brand = hotel.getBrand();this.city = hotel.getCity();this.starName = hotel.getStarName();this.business = hotel.getBusiness();this.location = hotel.getLatitude() + ", " + hotel.getLongitude();this.pic = hotel.getPic();}
}
service类
import cn.itcast.hotel.mapper.HotelMapper;
import cn.itcast.hotel.pojo.Hotel;
import cn.itcast.hotel.pojo.HotelDoc;
import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.unit.DistanceUnit;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.io.IOException;
import java.util.ArrayList;
import java.util.List;@Service
public class HotelService extends ServiceImpl<HotelMapper, Hotel> implements IHotelService {@Autowiredprivate RestHighLevelClient client;@Overridepublic PageResult search(RequestParams params) {try {// 1.准备RequestSearchRequest request = new SearchRequest("hotel");// 2.准备DSL// 2.1.querybuildBasicQuery(params, request);// 2.2.分页int page = params.getPage();int size = params.getSize();request.source().from((page - 1) * size).size(size);// 2.3.排序String location = params.getLocation();if (location != null && !location.equals("")) {request.source().sort(SortBuilders.geoDistanceSort("location", new GeoPoint(location)).order(SortOrder.ASC).unit(DistanceUnit.KILOMETERS));}// 3.发送请求SearchResponse response = client.search(request, RequestOptions.DEFAULT);// 4.解析响应return handleResponse(response);} catch (IOException e) {throw new RuntimeException(e);}}private void buildBasicQuery(RequestParams params, SearchRequest request) {// 1.构建BooleanQueryBoolQueryBuilder boolQuery = QueryBuilders.boolQuery();// 关键字搜索String key = params.getKey();if (key == null || "".equals(key)) {boolQuery.must(QueryBuilders.matchAllQuery());} else {boolQuery.must(QueryBuilders.matchQuery("all", key));}// 城市条件if (params.getCity() != null && !params.getCity().equals("")) {boolQuery.filter(QueryBuilders.termQuery("city", params.getCity()));}// 品牌条件if (params.getBrand() != null && !params.getBrand().equals("")) {boolQuery.filter(QueryBuilders.termQuery("brand", params.getBrand()));}// 星级条件if (params.getStarName() != null && !params.getStarName().equals("")) {boolQuery.filter(QueryBuilders.termQuery("starName", params.getStarName()));}// 价格if (params.getMinPrice() != null && params.getMaxPrice() != null) {boolQuery.filter(QueryBuilders.rangeQuery("price").gte(params.getMinPrice()).lte(params.getMaxPrice()));}// 2.算分控制FunctionScoreQueryBuilder functionScoreQuery =QueryBuilders.functionScoreQuery(// 原始查询,相关性算分的查询boolQuery,// function score的数组new FunctionScoreQueryBuilder.FilterFunctionBuilder[]{// 其中的一个function score 元素new FunctionScoreQueryBuilder.FilterFunctionBuilder(// 过滤条件QueryBuilders.termQuery("isAD", true),// 算分函数ScoreFunctionBuilders.weightFactorFunction(10))});request.source().query(functionScoreQuery);}// 结果解析private PageResult handleResponse(SearchResponse response) {// 4.解析响应SearchHits searchHits = response.getHits();// 4.1.获取总条数long total = searchHits.getTotalHits().value;// 4.2.文档数组SearchHit[] hits = searchHits.getHits();// 4.3.遍历List<HotelDoc> hotels = new ArrayList<>();for (SearchHit hit : hits) {// 获取文档sourceString json = hit.getSourceAsString();// 反序列化HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);// 获取排序值Object[] sortValues = hit.getSortValues();if (sortValues.length > 0) {Object sortValue = sortValues[0];hotelDoc.setDistance(sortValue);}// 放入集合hotels.add(hotelDoc);}// 4.4.封装返回return new PageResult(total, hotels);}
}
发送请求
相关文章:
![](https://img-blog.csdnimg.cn/001dfa2c075c41b1b130f7c0849c9f47.png)
springboot整合elasticsearch使用案例
引入依赖 <dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId> </dependency> 添加注入 import org.apache.http.HttpHost; import org.elasticsearch.client.Res…...
![](https://img-blog.csdnimg.cn/e21912186ee044b99b8d5cf7f26bbf8e.png#pic_center)
Unity制作下雨中的地面效果
Unity引擎制作下雨效果 大家好,我是阿赵。 之前介绍了Unity引擎里面通过UV偏移做序列帧动画的做法,这里再介绍一个进阶的用法,模拟地面下雨的雨点效果。 一、原理 最基本的原理,还是基于这个序列帧动画的做法。不过这里做一点…...
![](https://img-blog.csdnimg.cn/0809f14f5b4b4eabafbb5a3e40706058.png)
windows从0搭建python3开发环境与开发工具
文章目录 一、python3下载安装1、下载2、安装3、测试 二、安装VS Code1、安装2、安装python插件3、测试 三、pip命令的使用1、基本命令2、修改pip下载源 一、python3下载安装 1、下载 打开 WEB 浏览器访问 https://www.python.org/downloads/windows/ ,一般就下载…...
![](https://img-blog.csdnimg.cn/958caba4b3074cefb6752a57bedb0678.png)
centos中得一些命令 记录
redis命令 链接redis数据库的命令 redis-cli如果 Redis 服务器在不同的主机或端口上运行,你需要提供相应的主机和端口信息。例如: redis-cli -h <hostname> -p <port>连接成功后,你将看到一个类似于以下的提示符,表…...
![](https://img-blog.csdnimg.cn/b0ff4b9da2ef40d4991cc73341c8d214.png)
Python实现Word、Excel、PPT批量转为PDF
今天看见了一个有意思的脚本Python批量实现Word、EXCLE、PPT转PDF文件。 因为我平时word用的比较的多,所以深有体会,具体怎么实现的我们就不讨论了,因为这个去学了也没什么提升,不然也不会当作脚本了。这里我将其放入了pyzjr库中…...
![](https://img-blog.csdnimg.cn/45f9e0475a894e2a8efb0478e5fd530a.png)
LLM大模型推理加速 vLLM
参考: https://github.com/vllm-project/vllm https://zhuanlan.zhihu.com/p/645732302 https://vllm.readthedocs.io/en/latest/getting_started/quickstart.html ##文档 加速原理: PagedAttention,主要是利用kv缓存 使用: #…...
![](https://img-blog.csdnimg.cn/69add901f5e849ccb22e8b8f05a3a536.png)
Python|小游戏之猫捉老鼠!!!
最近闲(mang)来(dao)无(fei)事(qi),喜欢研究一些小游戏,本篇文章我主要介绍使用 turtle 写的一个很简单的猫捉老鼠的小游戏,主要是通过鼠标控制老鼠(Tom)的移动,躲避通过电脑控制的猫(Jerry)的追捕。 游戏主体思考逻辑࿱…...
![](https://img-blog.csdnimg.cn/img_convert/c94e2737d05318016d0b279463e80883.gif)
万里路,咫尺间:汽车与芯片的智能之遇
目前阶段,汽车产业有两个最闪耀的关键词,就是智能与低碳。 在践行双碳目标与产业智能化的大背景下,汽车已经成为了能源技术、交通技术、先进制造以及通信、数字化、智能化技术的融合体。汽车的产品形态与产业生态都在发生着前所未有的巨大变革…...
![](https://img-blog.csdnimg.cn/3b80faee2ba244c5bf131f0935e356f6.png)
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置 1、先上效果,可以根据mysql中mosquitto数据库的不同users角色登陆mosquitto: SELECT * FROM mosquitto.users; id,username,pw,super 1,jjolie,PBKDF2$sha256$901$yZnELWKK4NnaNNJl…...
![](https://img-blog.csdnimg.cn/img_convert/5a2d95dc0075bbfc208d46ef8e342ab6.png)
CCKS2023:基于企业数仓和大语言模型构建面向场景的智能应用
8月24日-27日,第十七届全国知识图谱与语义计算大会(CCKS 2023)在沈阳召开。大会以“知识图谱赋能通用AI”为主题,探讨知识图谱对通用AI技术的支撑能力,探索知识图谱在跨平台、跨领域等AI任务中的作用和应用途径。 作为…...
![](https://img-blog.csdnimg.cn/891766f33df542eabe534a51d5aa768a.png)
LeetCode 热题 100——无重复字符的最长子串(滑动窗口)
题目链接 力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 题目解析 从s字符串中,去找出连续的子串,使该子串中没有重复字符,返回它的最长长度。 暴力枚举 依次以第一个、第二个、第三个等等为起点去遍历字符串&a…...
![](https://img-blog.csdnimg.cn/2e27a1b4f9a44cc69411ac7c052264c1.png)
【zookeeper】zookeeper的shell操作
Zookeeper的shell操作 本章节将分享一些zookeeper客服端的一些命令,实验操作有助于理解zookeeper的数据结构。 Zookeeper命令工具 在前一章的基础上,在启动Zookeeper服务之后,输入以下命令,连接到Zookeeper服务。连接成功之后&…...
![](https://img-blog.csdnimg.cn/img_convert/e451ca772257ca4cf8abbe6229bc7e31.png)
R语言Meta分析核心技术
Meta分析是针对某一科研问题,根据明确的搜索策略、选择筛选文献标准、采用严格的评价方法,对来源不同的研究成果进行收集、合并及定量统计分析的方法,最早出现于“循证医学”,现已广泛应用于农林生态,资源环境等方面。…...
![](https://img-blog.csdnimg.cn/7e52ff8fe71e4dd2b111d2954db820ae.png)
Oracle数据库尚硅谷学习笔记
文章目录 Oracle数据库体系结构简介补充SQL初步导入sql文件别名连接符distinct去重的坑 过滤和排序数据日期格式比较运算其它比较运算符逻辑运算优先级排序 单行函数SQL中不同类型的函数单行函数字符数值日期转换通用 使用条件表达式嵌套查询 多表查询等值连接非等值连接左外连…...
![](https://img-blog.csdnimg.cn/c29e6cb83692437295aacd32bbeffbd7.jpeg)
CG MAGIC进行实体渲染后!分析渲染器CR和VR的区别之处!
新手小白来说,如何选择渲染器,都会提出疑问? 渲染效果图究竟用CR渲染器还是VR渲染器呢? 今天,CG MAGIC小编通过一个真实的项目场景,实例渲染之后,CR渲染器和VR渲染器区别有哪几点? 1…...
![](https://img-blog.csdnimg.cn/d3c26c4eeffe417d9cde1049c8644874.png)
Ubuntu下Python3与Python2相互切换
参考文章:https://blog.csdn.net/Nicolas_shen/article/details/124144931 设置优先级 sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 200...
![](https://www.ngui.cc/images/no-images.jpg)
【深度学习】实验07 使用TensorFlow完成逻辑回归
文章目录 使用TensorFlow完成逻辑回归1. 环境设定2. 数据读取3. 准备好placeholder4. 准备好参数/权重5. 计算多分类softmax的loss function6. 准备好optimizer7. 在session里执行graph里定义的运算 附:系列文章 使用TensorFlow完成逻辑回归 TensorFlow是一种开源的…...
![](https://img-blog.csdnimg.cn/bed3a331dbb24f978dc8d5331b86c06c.png)
2023-09-04 Linux 让shell编译脚本里面设置的环境变量改变kernel里面驱动文件的宏定义值方法,我这里用来做修改固件版本
一、原生的读取版本接口是/proc/version,我这里需要提供获取固件版本号的api给app,因为版本号会经常需要修改,如果每次都到kernel下修改比较麻烦,我这里是想在编译脚本里面对版本号进行修改,这样方便一点。 二、主要修…...
![](https://www.ngui.cc/images/no-images.jpg)
Python操作Excel实战:Excel行转列
# 1、原始数据准备 样例数据准备 地区1m2-5m6-10m11-20m21-40m地区单价计费单位费用最小值费用最大值北京13012011010090 天津13012011010090 石家庄13012011010090 保定140130120110100 张家口170150130120110 邢台1401201101…...
![](https://www.ngui.cc/images/no-images.jpg)
java实现迭代器模式
迭代器模式(Iterator Pattern)是一种行为型设计模式,它提供一种方法来顺序访问一个聚合对象(如列表、集合、数组等)中的元素,而不暴露聚合对象的内部表示。迭代器模式通常包括以下角色:迭代器&a…...
![](https://img-blog.csdnimg.cn/65e817c43a9948cab39b1f4b0af27c21.png)
C++day7模板、异常、auto关键字、lambda表达式、数据类型转换、STL、list、文件操作
作业 封装一个学生的类,定义一个学生这样类的vector容器, 里面存放学生对象(至少3个) 再把该容器中的对象,保存到文件中。 再把这些学生从文件中读取出来,放入另一个容器中并且遍历输出该容器里的学生。 #include …...
![](https://img-blog.csdnimg.cn/14cccdea432b476faf27fc36b4338793.png)
【校招VIP】产品分析之活动策划宣传
考点介绍: 产品的上线运营是非常重要的。应该来说好的产品都是运营出来的,在一运营过程中难免会依靠策划活动来提高产品知名度、用户数。用户粘度等等指标一,如何策划一个成功的活动就显得非常重要。 产品分析之活动策划宣传-相关题目及解析…...
![](https://www.ngui.cc/images/no-images.jpg)
node基础之一:fs 模块
概念:文件的创建、删除、重命名、移动、写入、读取等 const fs require("fs");// 写入 fs.writeFile("./demo.txt", "hello", (err) > {}); fs.writeFileSync();// 追加 fs.appendFile("./demo.txt", "hello&quo…...
![](https://img-blog.csdnimg.cn/img_convert/9d23bed118cdd61eb92fb821d3a871b4.jpeg)
如何快速搭建母婴行业的微信小程序?
如果你想为你的母婴行业打造一个独特的小程序,但没有任何编程经验,别担心!现在有许多小程序制作平台提供了简单易用的工具,让你可以轻松地建立自己的小程序。接下来,我将为你详细介绍搭建母婴行业小程序的步骤。 首先&…...
![](https://img-blog.csdnimg.cn/b3b6ae74edda40139338609856c99487.png)
【科普向】Jmeter 如何测试接口保姆式教程
现在对测试人员的要求越来越高,不仅仅要做好功能测试,对接口测试的需求也越来越多!所以也越来越多的同学问,怎样才能做好接口测试? 要真正的做好接口测试,并且弄懂如何测试接口,需要从如下几个…...
![](https://img-blog.csdnimg.cn/img_convert/4f5823e819d95a65261f299e1fa83be2.jpeg)
阿里云2核4G服务器5M带宽5年费用价格明细表
阿里云2核4G服务器5M带宽可以选择轻量应用服务器或云服务器ECS,轻量2核4G4M带宽服务器297元一年,2核4G云服务器ECS可以选择计算型c7、c6或通用算力型u1实例等,买5年可以享受3折优惠,阿腾云分享阿里云服务器2核4G5M带宽五年费用表&…...
![](https://img-blog.csdnimg.cn/5b0aa0d2e3674056969f922300b90697.gif)
【图解RabbitMQ-2】图解JMS规范与AMQP协议是什么
🧑💻作者名称:DaenCode 🎤作者简介:CSDN实力新星,后端开发两年经验,曾担任甲方技术代表,业余独自创办智源恩创网络科技工作室。会点点Java相关技术栈、帆软报表、低代码平台快速开…...
![](https://img-blog.csdnimg.cn/e87e069567f44085ad7b511a92dbae84.png)
springboot整合mybatis实现增删改查(xml)--项目阶段1
目录 一、前言 二、创建项目 创建MySQL数据库和表 创建springboot项目 本文总体代码结构图预览 三、编写代码 (一)新建实体层属性类 (二)新建数据层mapper接口 (三)新建mapper的映射SQL(…...
![](https://www.ngui.cc/images/no-images.jpg)
springboot文件上传异步报错
因为迁移的生产环境,在新的服务器发生了之前没有遇到的问题,这种问题是在异步文件上传的时候才会出现 错误信息如下 16:17:50.009 ERROR c.w.einv.minio.service.impl.MinioFileServiceImpl - 文件上传错误! java.io.FileNotFoundException: /applicati…...
![](https://www.ngui.cc/images/no-images.jpg)
error: unable to unlink old ‘.gitlab-ci.yml‘: Permission denied
#gitlab-runner 执行代码git pull origin xxx 更新时候报 error: unable to unlink old ‘.gitlab-ci.yml’: Permission denied 问题环境:centos 部署gitlab-runner 执行脚本方式 选的shell 产生问题的原因:gitlab-runner程序进程占用锁定了.gitlab-ci…...
![](https://img-blog.csdnimg.cn/img_convert/6fc6f5e0ecc4d593e7c194b2599c8004.jpeg)
云南网站建/举例说明什么是seo
Databend 是一款现代云数仓。专为弹性和高效设计,为您的大规模分析需求保驾护航。自由且开源。即刻体验云服务:https://app.databend.com 。 Whats On In Databend 探索 Databend 本周新进展,遇到更贴近你心意的 Databend 。 Support Eager…...
![](/images/no-images.jpg)
做女装的网站/怎么进行网络推广
[Mnsx_x]刷题笔记——顶端迭代器 请你设计一个迭代器,除了支持 hasNext 和 next 操作外,还支持 peek 操作。 实现 PeekingIterator 类: PeekingIterator(int[] nums) 使用指定整数数组 nums 初始化迭代器。 int next() 返回数组中的下一个元素…...
![](/images/no-images.jpg)
网站安全 扫描/seo技术建站
https://codeforces.ml/contest/1353/problem/D (题目链接↑) 题解 这题主要用到优先队列,size(区间长度)大的排在前,size相同的left(左端点)小的排在前。 主要积累一下这里的语法: …...
![](/images/no-images.jpg)
网站开发需求书/seo优化方式
3X家庭净水计划 1. 双膜单出水净水机(润佳系列 RO-18) 雷谛净水器主要参数: 双膜单出水,节能节水 智能控制显示 韩国进口RO和UF膜组件 马来西亚椰壳活性炭 欧洲标准工艺流程与结构设计 水压要求:0.1-0.4MPa 净水流量:50G 冲洗方式…...
![](https://img-blog.csdnimg.cn/img_convert/71e31e39766a528c892e42e5a2c67a18.png)
满满正能量网站/营销型网站建设
dataframe选取数据1.选取行名、列名、值2.以标签(行、列的名字)为索引选择数据—— x.loc[行标签,列标签]3.以位置(第几行、第几列)为索引选择数据—— x.iloc[行位置,列位置]4.同时根据标签和位置选择数据——x.ix[行,列]5.选择连…...
prestashop和wordpress/东莞建设企业网站
作为初学者,我看的是原子的视频,用的是stm32f103vet6的板,所以这个问题纠结了好久,终于在今天解决了,虽然只是第一步,但是已经迈出第一步了。在这里分享给有需要的同学们,祝你们好运。 1、FSMC…...