当前位置:网站首页>Commodity management system -- integrate warehouse services and obtain warehouse list
Commodity management system -- integrate warehouse services and obtain warehouse list
2020-11-09 07:35:00 【osc_kiub62pt】
One The configuration file application.yml
# Registration center address and project name
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
application:
name: gulimall-ware
Two Turn on the service registration discovery function
@EnableFeignClients
// Turn on the service registration discovery function
@EnableDiscoveryClient
@SpringBootApplication
public class GulimallWareApplication {
public static void main(String[] args) {
SpringApplication.run(GulimallWareApplication.class, args);
}
}
3、 ... and Gateway microservice configuration
# Configure inventory system routing
- id: ware_route
uri: lb://gulimall-ware
predicates:
- Path=/api/ware/**
filters:
- RewritePath=/api/(?<segment>.*),/$\{segment}
Four controller
/**
* Function description : Warehouse information paging query
*
* @param params Paging conditions
* @return R Data returned to the front end
* @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);
}
5、 ... and Service layer
/**
* Function description : Warehouse information paging query
*
* @param params Pagination filter conditions
* @return PageUtils Paging information
* @author cakin
* @date 2020/11/8
*/
@Override
public PageUtils queryPage(Map<String, Object> params) {
// Query criteria
QueryWrapper<WareInfoEntity> wareInfoEntityQueryWrapper = new QueryWrapper<>();
// Keyword search
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);
}
// Paging query
IPage<WareInfoEntity> page = this.page(new Query<WareInfoEntity>().getPage(params), wareInfoEntityQueryWrapper);
return new PageUtils(page);
}
6、 ... and test
版权声明
本文为[osc_kiub62pt]所创,转载请带上原文链接,感谢
边栏推荐
猜你喜欢
2.计算机硬件简介
Chapter 5 programming
你有没有想过为什么交易和退款要拆开不同的表
Sublime text3 插件ColorPicker(调色板)不能使用快捷键的解决方法
Combine theory with practice to understand CORS thoroughly
Platform in architecture
Unemployment log, November 5
How does semaphore, a thread synchronization tool that uses an up counter, look like?
简单介绍c#通过代码开启或关闭防火墙示例
常见特征金字塔网络FPN及变体
随机推荐
你有没有想过为什么交易和退款要拆开不同的表
A few lines of code can easily transfer traceid across systems, so you don't have to worry about losing the log!
Finally, the python project is released as exe executable program process
2 normal mode
Have you ever thought about why the transaction and refund have to be split into different tables
Introduction to nmon
How does semaphore, a thread synchronization tool that uses an up counter, look like?
C / C + + Programming Notes: pointer! Understand pointer from memory, let you understand pointer completely
基于链表的有界阻塞队列 —— LinkedBlockingQueue
C++之异常捕获和处理
When iperf is installed under centos7, the solution of make: * no targets specified and no makefile found. Stop
服务网格仍然很难 - cncf
2. Introduction to computer hardware
Platform in architecture
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!
你有没有想过为什么交易和退款要拆开不同的表
图节点分类与消息传递 - 知乎
Leetcode-15: sum of three numbers
Chapter 5 programming
Service grid is still difficult - CNCF