当前位置:网站首页>Commodity management system -- the search function of SPU
Commodity management system -- the search function of SPU
2020-11-09 07:35:00 【I'm sorry.】
One API analysis
1 request
GET /product/spuinfo/list
2 Request parameters
{
page: 1, // The current page number
limit: 10, // Records per page
sidx: 'id', // Sort field
order: 'asc/desc', // sort order
key: ' Huawei ', // Search keywords
catelogId: 6, // Three levels of classification id
brandId: 1, // brand id
status: 0, // Goods state
}
3 Respond to
{
"msg": "success",
"code": 0,
"page": {
"totalCount": 0,
"pageSize": 10,
"totalPage": 0,
"currPage": 1,
"list": [{
"brandId": 0, // brand id
"brandName": " Brand name ",
"catalogId": 0, // classification id
"catalogName": " Category name ",
"createTime": "2019-11-13T16:07:32.877Z", // Creation time
"id": 0, // goods id
"publishStatus": 0, // Release status
"spuDescription": "string", // Commodity Description
"spuName": "string", // Commodity name
"updateTime": "2019-11-13T16:07:32.877Z", // Update time
"weight": 0 // weight
}]
}
}
Two controller
/**
* Function description : Query by criteria SPU Information
*
* @param params Filter conditions
* @return R Data returned to the front end
* @author cakin
* @date 2020/11/8
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = spuInfoService.queryPageByCondition(params);
return R.ok().put("page", page);
}
3、 ... and Service layer
/**
* Function description : Pagination query by condition
*
* @param params Filter conditions
* @return PageUtils Paging information
* @author cakin
* @date 2020/11/8
*/
@Override
public PageUtils queryPageByCondition(Map<String, Object> params) {
QueryWrapper<SpuInfoEntity> wrapper = new QueryWrapper<>();
String key = (String) params.get("key");
// Keyword query
if (!StringUtils.isEmpty(key)) {
wrapper.and((w) -> {
w.eq("id", key).or().like("spu_name", key);
});
}
// Splicing status
String status = (String) params.get("status");
if (!StringUtils.isEmpty(status)) {
wrapper.eq("publish_status", status);
}
// Splicing brandId
String brandId = (String) params.get("brandId");
if (!StringUtils.isEmpty(brandId) && !"0".equalsIgnoreCase(brandId)) {
wrapper.eq("brand_id", brandId);
}
// Splicing catelogId
String catelogId = (String) params.get("catelogId");
if (!StringUtils.isEmpty(catelogId) && !"0".equalsIgnoreCase(catelogId)) {
wrapper.eq("catalog_id", catelogId);
}
// Pagination conditions and other composite conditions after splicing query
IPage<SpuInfoEntity> page = this.page(new Query<SpuInfoEntity>().getPage(params), wrapper);
return new PageUtils(page);
}
Four test
版权声明
本文为[I'm sorry.]所创,转载请带上原文链接,感谢
边栏推荐
- Core knowledge of C + + 11-17 template (2) -- class template
- STS安装
- Bifrost 之 文件队列(一)
- When we talk about data quality, what are we talking about?
- ubuntu 上使用微信的新方案——手机投屏
- Android emulator error: x86 emulation currently requires hardware acceleration solution
- How does semaphore, a thread synchronization tool that uses an up counter, look like?
- After Android solves the setrequested orientation, the rotation of the mobile phone screen does not trigger the onconfigurationchanged method
- linx7.5 初始安装
- 2. Introduction to computer hardware
猜你喜欢
分库分表的几种常见玩法及如何解决跨库查询等问题
深度优先搜索和广度优先搜索
Installation record of SAP s / 4hana 2020
Introduction to nmon
Detailed analysis of OpenGL es framework (8) -- OpenGL es Design Guide
EasyNTS上云网关设备在雪亮工程项目中的实战应用
基于链表的有界阻塞队列 —— LinkedBlockingQueue
卧槽,这年轻人不讲武德,应届生凭“小抄”干掉5年老鸟,成功拿到字节20Koffer
STS安装
Several common playing methods of sub database and sub table and how to solve the problem of cross database query
随机推荐
Factory pattern pattern pattern (simple factory, factory method, abstract factory pattern)
基于链表的有界阻塞队列 —— LinkedBlockingQueue
API部分的知识点复习
C++邻接矩阵
程序员都应该知道的URI,一文帮你全面了解
Salesforce connect & external object
23张图,带你入门推荐系统
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!
How does pipedrive support quality publishing with 50 + deployments per day?
老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”
服务网格仍然很难 - cncf
商品管理系统——SPU检索功能
B. protocal has 7000eth assets in one week!
Natural language processing (NLP) roadmap - KDnuggets
Service grid is still difficult - CNCF
平台商业化能力的另一种表现形式SAAS
当我们聊数据质量的时候,我们在聊些什么?
商品管理系统——整合仓库服务以及获取仓库列表
第五章编程
2.计算机硬件简介