当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
猜你喜欢
Teacher Liang's small class
C/C++编程笔记:指针篇!从内存理解指针,让你完全搞懂指针
Several common playing methods of sub database and sub table and how to solve the problem of cross database query
This program cannot be started because msvcp120.dll is missing from your computer. Try to install the program to fix the problem
简单介绍c#通过代码开启或关闭防火墙示例
作业2020.11.7-8
Concurrent linked queue: a non blocking unbounded thread safe queue
Oschina plays disorderly on Monday
Share API on the web
In 2020, what are the best tools for Android developers to break the cold winter?
随机推荐
python生日贺卡制作以及细节问题的解决最后把python项目发布为exe可执行程序过程
作业2020.11.7-8
使用递增计数器的线程同步工具 —— 信号量,它的原理是什么样子的?
为什么我们不使用GraphQL? - Wundergraph
基于链表的有界阻塞队列 —— LinkedBlockingQueue
首次开通csdn,这篇文章送给过去的自己和正在发生的你
老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”
Several common playing methods of sub database and sub table and how to solve the problem of cross database query
23 pictures, take you to the recommended system
商品管理系统——整合仓库服务以及获取仓库列表
Several rolling captions based on LabVIEW
Linked list
How does FC game console work?
A solution to the problem that color picker (palette) cannot use shortcut keys in sublime Text3 plug-in
华为HCIA笔记
Linked blocking queue based on linked list
Copy on write collection -- copyonwritearraylist
leetcode之反转字符串中的元音字母
几行代码轻松实现跨系统传递 traceId,再也不用担心对不上日志了!
Installation record of SAP s / 4hana 2020