当前位置:网站首页>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.]所创,转载请带上原文链接,感谢
边栏推荐
- Oschina plays disorderly on Monday
- The difference between GDI and OpenGL
- EasyNTS上云网关设备在雪亮工程项目中的实战应用
- salesforce零基础学习(九十八)Salesforce Connect & External Object
- Leetcode-15: sum of three numbers
- How does semaphore, a thread synchronization tool that uses an up counter, look like?
- Five design patterns frequently used in development
- 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-11: container with the most water
- APP 莫名崩溃,开始以为是 Header 中 name 大小写的锅,最后发现原来是容器的错!
猜你喜欢

服务器性能监控神器nmon使用介绍

centos7下安装iperf时出现 make: *** No targets specified and no makefile found. Stop.的解决方案

leetcode之反转字符串中的元音字母

Unemployment log, November 5
![[Python从零到壹] 五.网络爬虫之BeautifulSoup基础语法万字详解](/img/e8/dd70ddf3c2027907f64674676d676e.jpg)
[Python从零到壹] 五.网络爬虫之BeautifulSoup基础语法万字详解

华为HCIA笔记

Depth first search and breadth first search

写时复制集合 —— CopyOnWriteArrayList

Windows环境下如何进行线程Dump分析

WordPress Import 上传的文件尺寸超过php.ini中定义的upload_max_filesize值--&gt;解决方法。
随机推荐
Windows环境下如何进行线程Dump分析
Programmers should know the URI, a comprehensive understanding of the article
23 pictures, take you to the recommended system
服务器性能监控神器nmon使用介绍
基于链表的有界阻塞队列 —— LinkedBlockingQueue
When we talk about data quality, what are we talking about?
Platform in architecture
Several rolling captions based on LabVIEW
Depth first search and breadth first search
Do you know how the computer starts?
How to do thread dump analysis in Windows Environment
Leetcode-15: sum of three numbers
Sublime text3 插件ColorPicker(调色板)不能使用快捷键的解决方法
Tips in Android Development: requires permission android.permission write_ Settings solution
B. protocal has 7000eth assets in one week!
2 normal mode
Finally, the python project is released as exe executable program process
C++邻接矩阵
老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”
写时复制集合 —— CopyOnWriteArrayList