parent
dbb75f9ad6
commit
cd58c9871e
@ -0,0 +1,10 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询爬虫中关村笔记本搜索列表
|
||||
export function listZolNotebook(query) {
|
||||
return request({
|
||||
url: '/webmagic/zol-notebook/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.xjs.zol.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.validation.group.SelectGroup;
|
||||
import com.xjs.web.MyBaseController;
|
||||
import com.xjs.zol.pojo.ZolNotebook;
|
||||
import com.xjs.zol.service.ZolNotebookService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 爬虫中关村笔记本controller
|
||||
* @author xiejs
|
||||
* @since 2022-04-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("zol-notebook")
|
||||
@Api(tags = "爬虫模块-中关村笔记本")
|
||||
public class ZolNotebookController extends MyBaseController<ZolNotebook> {
|
||||
|
||||
@Autowired
|
||||
private ZolNotebookService zolNotebookService;
|
||||
|
||||
@RequiresPermissions("webmagic:zol-notebook:list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询中关村笔记本列表")
|
||||
public AjaxResult list(@Validated({SelectGroup.class}) ZolNotebook zolNotebook) {
|
||||
IPage<ZolNotebook> page=zolNotebookService.selectZolPhoneByPage(startPageMP(),zolNotebook);
|
||||
return AjaxResult.success(page);
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,38 @@
|
||||
package com.xjs.zol.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.xjs.zol.mapper.ZolNotebookMapper;
|
||||
import com.xjs.zol.pojo.ZolNotebook;
|
||||
import com.xjs.zol.service.ZolNotebookService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 爬虫数据中关村笔记本service接口实现
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-04-18
|
||||
*/
|
||||
@Service
|
||||
public class ZolNotebookServiceImpl extends ServiceImpl<ZolNotebookMapper, ZolNotebook> implements ZolNotebookService {
|
||||
|
||||
@Override
|
||||
public IPage<ZolNotebook> selectZolPhoneByPage(Page<ZolNotebook> startPageMP, ZolNotebook zolNotebook) {
|
||||
String condition = zolNotebook.getCondition();
|
||||
LambdaQueryWrapper<ZolNotebook> wr = new LambdaQueryWrapper<>();
|
||||
boolean b = Objects.nonNull(zolNotebook.getCreateTime()) && Objects.nonNull(zolNotebook.getEndCreateTime());
|
||||
wr.between(b, ZolNotebook::getCreateTime, zolNotebook.getCreateTime(), zolNotebook.getEndCreateTime());
|
||||
//通用查询/组合查询
|
||||
wr.and(StringUtils.isNotEmpty(condition), obj -> {
|
||||
obj.like(ZolNotebook::getNotebookName, condition)
|
||||
.or()
|
||||
.like(ZolNotebook::getDescription, condition);
|
||||
});
|
||||
return this.page(startPageMP, wr);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue