1、爬虫日志查询条件校验优化
This commit is contained in:
parent
a5cf6c5aea
commit
507cf65cf2
|
|
@ -7,6 +7,7 @@
|
|||
v-model="queryParams.name"
|
||||
placeholder="请输入爬虫名称"
|
||||
clearable
|
||||
maxlength="20"
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
|
|
@ -16,6 +17,7 @@
|
|||
v-model="queryParams.url"
|
||||
placeholder="请输入爬虫地址"
|
||||
clearable
|
||||
maxlength="100"
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
|
|
@ -23,7 +25,8 @@
|
|||
<el-form-item label="请求时间" prop="beginRequestTime">
|
||||
<el-input
|
||||
v-model.number="queryParams.beginRequestTime"
|
||||
placeholder=""
|
||||
placeholder="单位:秒"
|
||||
maxlength="9"
|
||||
size="small"
|
||||
style="width: 90px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
|
|
@ -33,8 +36,9 @@
|
|||
-
|
||||
<el-input
|
||||
v-model.number="queryParams.endRequestTime"
|
||||
placeholder=""
|
||||
placeholder="单位:秒"
|
||||
size="small"
|
||||
maxlength="9"
|
||||
style="width: 90px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
|
|
@ -89,7 +93,7 @@
|
|||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="爬虫名称" align="center" prop="name"/>
|
||||
<el-table-column label="爬虫地址" align="center" prop="url" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="请求时间" align="center" prop="requestTime">
|
||||
<el-table-column label="请求时间(秒)" align="center" prop="requestTime">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.requestTime < 1000
|
||||
|
|
@ -206,11 +210,24 @@ export default {
|
|||
this.queryParams.createTime = this.daterangeCreateTime[0];
|
||||
this.queryParams.endCreateTime = this.daterangeCreateTime[1];
|
||||
}
|
||||
let beginRequestTime = this.queryParams.beginRequestTime;
|
||||
let endRequestTime = this.queryParams.endRequestTime;
|
||||
if (beginRequestTime != null && '' !== beginRequestTime && endRequestTime != null && '' !== endRequestTime) {
|
||||
this.queryParams.beginRequestTime = beginRequestTime * 1000
|
||||
this.queryParams.endRequestTime = endRequestTime * 1000
|
||||
}
|
||||
|
||||
listWebmagicLog(this.queryParams).then(response => {
|
||||
this.webmagicLogList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
//回显的时候正常回显
|
||||
if (beginRequestTime != null && '' !== beginRequestTime && endRequestTime != null && '' !== endRequestTime) {
|
||||
this.queryParams.beginRequestTime = beginRequestTime ;
|
||||
this.queryParams.endRequestTime = endRequestTime ;
|
||||
}
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ import com.ruoyi.common.log.enums.BusinessType;
|
|||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.reptileLog.domain.WebmagicLog;
|
||||
import com.xjs.reptileLog.service.WebmagicLogService;
|
||||
import com.xjs.validation.group.SelectGroup;
|
||||
import com.xjs.web.MyBaseController;
|
||||
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.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -50,7 +52,7 @@ public class WebmagicLogController extends MyBaseController {
|
|||
*/
|
||||
@RequiresPermissions("log:webmagicLog:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WebmagicLog webmagicLog) {
|
||||
public TableDataInfo list(@Validated({SelectGroup.class}) WebmagicLog webmagicLog) {
|
||||
startPage();
|
||||
List<WebmagicLog> list = webmagicLogService.selectWebmagicLogList(webmagicLog);
|
||||
return getDataTable(list);
|
||||
|
|
|
|||
|
|
@ -3,30 +3,42 @@ package com.xjs.reptileLog.domain;
|
|||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.xjs.validation.group.SelectGroup;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 爬虫日志实体类
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-02-17
|
||||
*/
|
||||
@Data
|
||||
public class WebmagicLog implements Serializable {
|
||||
public class WebmagicLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 爬虫名称 */
|
||||
/**
|
||||
* 爬虫名称
|
||||
*/
|
||||
@Excel(name = "爬虫名称")
|
||||
@Size(max = 20, message = "请控制爬虫名称长度在20字符", groups = {SelectGroup.class})
|
||||
private String name;
|
||||
|
||||
/** 爬虫地址 */
|
||||
/**
|
||||
* 爬虫地址
|
||||
*/
|
||||
@Excel(name = "爬虫地址")
|
||||
@Size(max = 100, message = "请控制爬虫地址长度在20字符", groups = {SelectGroup.class})
|
||||
private String url;
|
||||
|
||||
/**
|
||||
|
|
@ -36,14 +48,16 @@ public class WebmagicLog implements Serializable {
|
|||
private Long complexRate;
|
||||
|
||||
|
||||
@Excel(name = "执行结果",readConverterExp = "1=成功,2=失败")
|
||||
@Excel(name = "执行结果", readConverterExp = "1=成功,2=失败")
|
||||
private Integer status;
|
||||
|
||||
/** 请求耗费时间(单位毫秒) */
|
||||
/**
|
||||
* 请求耗费时间(单位毫秒)
|
||||
*/
|
||||
@Excel(name = "请求耗费时间")
|
||||
private Long requestTime;
|
||||
|
||||
@Excel(name = "创建时间" ,dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
|
@ -54,12 +68,14 @@ public class WebmagicLog implements Serializable {
|
|||
* 查询条件:耗费时间Start
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@Max(message = "beginRequestTime长度太长!", value = 200000000, groups = {SelectGroup.class})
|
||||
private Long beginRequestTime;
|
||||
|
||||
/**
|
||||
* 查询条件:耗费时间End
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@Max(message = "endRequestTime长度太长!", value = 200000000, groups = {SelectGroup.class})
|
||||
private Long endRequestTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue