当前位置:网站首页>商品管理系统——整合仓库服务以及获取仓库列表
商品管理系统——整合仓库服务以及获取仓库列表
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
边栏推荐
- Oschina plays disorderly on Monday
- How does semaphore, a thread synchronization tool that uses an up counter, look like?
- Factory pattern pattern pattern (simple factory, factory method, abstract factory pattern)
- 23 pictures, take you to the recommended system
- 使用递增计数器的线程同步工具 —— 信号量,它的原理是什么样子的?
- Share API on the web
- How does semaphore, a thread synchronization tool that uses an up counter, look like?
- 结合阿里云 FC 谈谈我对 FaaS 的理解
- FC 游戏机的工作原理是怎样的?
- This program cannot be started because msvcp120.dll is missing from your computer. Try to install the program to fix the problem
猜你喜欢
随机推荐
一堆代码忘了缩进?快捷方式教你无忧无虑!
Common feature pyramid network FPN and its variants
C/C++编程笔记:指针篇!从内存理解指针,让你完全搞懂指针
当我们聊数据质量的时候,我们在聊些什么?
A solution to the problem that color picker (palette) cannot use shortcut keys in sublime Text3 plug-in
Concurrent linked queue: a non blocking unbounded thread safe queue
14. Introduction to kubenetes
After Android solves the setrequested orientation, the rotation of the mobile phone screen does not trigger the onconfigurationchanged method
使用递增计数器的线程同步工具 —— 信号量,它的原理是什么样子的?
代码保存
Detailed analysis of OpenGL es framework (8) -- OpenGL es Design Guide
Leetcode-11: container with the most water
leetcode之反转字符串中的元音字母
20201108编程练习——练习3
GDI 及OPENGL的区别
App crashed inexplicably. At first, it thought it was the case of the name in the header. Finally, it was found that it was the fault of the container!
Introduction to nmon
2020,Android开发者打破寒冬的利器是什么?
2. Introduction to computer hardware
梁老师小课堂|谈谈模板方法模式





