当前位置:网站首页>商品管理系统——整合仓库服务以及获取仓库列表
商品管理系统——整合仓库服务以及获取仓库列表
2020-11-09 07:35:00 【osc_kiub62pt】
一 配置文件application.yml
# 注册中心地址以及项目名称
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
application:
name: gulimall-ware
二 开启服务注册发现功能
@EnableFeignClients
// 开启服务注册发现功能
@EnableDiscoveryClient
@SpringBootApplication
public class GulimallWareApplication {
public static void main(String[] args) {
SpringApplication.run(GulimallWareApplication.class, args);
}
}
三 网关微服务配置
# 配置库存系统路由
- id: ware_route
uri: lb://gulimall-ware
predicates:
- Path=/api/ware/**
filters:
- RewritePath=/api/(?<segment>.*),/$\{segment}
四 控制器
/**
* 功能描述:仓库信息分页查询
*
* @param params 分页条件
* @return R 返回给前端的数据
* @author cakin
* @date 2020/11/8
* @description:
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = wareInfoService.queryPage(params);
return R.ok().put("page", page);
}
五 服务层
/**
* 功能描述:仓库信息分页查询
*
* @param params 分页过滤条件
* @return PageUtils 分页信息
* @author cakin
* @date 2020/11/8
*/
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 查询条件
QueryWrapper<WareInfoEntity> wareInfoEntityQueryWrapper = new QueryWrapper<>();
// 关键字检索
String key = (String) params.get("key");
if (!StringUtils.isEmpty(key)) {
wareInfoEntityQueryWrapper.eq("id", key)
.or().like("name", key)
.or().like("address", key)
.or().like("areacode", key);
}
// 分页查询
IPage<WareInfoEntity> page = this.page(new Query<WareInfoEntity>().getPage(params), wareInfoEntityQueryWrapper);
return new PageUtils(page);
}
六 测试

版权声明
本文为[osc_kiub62pt]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4296470/blog/4708490
边栏推荐
- API部分的知识点复习
- 链表
- The vowels in the inverted string of leetcode
- Pipedrive如何在每天部署50+次的情况下支持质量发布?
- The vowels in the inverted string of leetcode
- leetcode之反转字符串中的元音字母
- Finally, the python project is released as exe executable program process
- How does pipedrive support quality publishing with 50 + deployments per day?
- Core knowledge of C + + 11-17 template (2) -- class template
- 华为HCIA笔记
猜你喜欢

3.你知道计算机是如何启动的吗?

GDI 及OPENGL的区别

华为HCIA笔记

上线1周,B.Protocal已有7000ETH资产!

B. protocal has 7000eth assets in one week!

Oschina plays disorderly on Monday

23张图,带你入门推荐系统

The vowels in the inverted string of leetcode

老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”

WordPress Import 上传的文件尺寸超过php.ini中定义的upload_max_filesize值--&gt;解决方法。
随机推荐
AQS 都看完了,Condition 原理可不能少!
首次开通csdn,这篇文章送给过去的自己和正在发生的你
A bunch of code forgot to indent? Shortcut teach you carefree!
salesforce零基础学习(九十八)Salesforce Connect & External Object
c++11-17 模板核心知识(二)—— 类模板
对象
Salesforce connect & external object
When we talk about data quality, what are we talking about?
Common feature pyramid network FPN and its variants
When iperf is installed under centos7, the solution of make: * no targets specified and no makefile found. Stop
2. Introduction to computer hardware
C + + adjacency matrix
Esockettimeout solution in request in nodejs
android开发中提示:requires permission android.permission write_settings解决方法
Have you ever thought about why the transaction and refund have to be split into different tables
亚马逊的无服务器总线EventBridge支持事件溯源 - AWS
leetcode之反转字符串中的元音字母
Programmers should know the URI, a comprehensive understanding of the article
Teacher Liang's small class
自然语言处理(NLP)路线图 - kdnuggets