Skip to content

请求api时date区间条件怎么设置 #112

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
icsaas opened this issue Oct 29, 2019 · 5 comments
Closed

请求api时date区间条件怎么设置 #112

icsaas opened this issue Oct 29, 2019 · 5 comments

Comments

@icsaas
Copy link

icsaas commented Oct 29, 2019

环境信息

  • 系统:
  • JDK:
  • 数据库:
  • APIJSON:

问题描述
{
"User": {
"date{}": ">=2017-02"
}
}

错误信息

  • 测试账号 +
    {
    "User": {
    "date{}": ">=2017-02"
    },
    "code": 403 ,
    "msg": "date{}:value 的 value 中 >=2017-02 不合法!预编译模式下 key{}:"condition" 中 condition 必须 为 =null 或 !=null 或 符合正则表达式 ^[0-9%!=<>,]+$ !不允许空格!" ,
    "sql:generate|cache|execute|maxExecute": "1|0|0|200" ,
    "depth:count|max": "1|5" ,
    "time:start|duration|end": "1572353867665|4|1572353867669"
    }

时间区间的条件该如何设置?

@TommyLemon
Copy link
Collaborator

TommyLemon commented Oct 29, 2019

比较运算
"date>=": "2017-02"

连续范围
"date%": "2017-02-01,2018-02-01"

https://github.com/APIJSON/APIJSON/blob/master/Document.md#32-%E5%8A%9F%E8%83%BD%E7%AC%A6

@shanhan0
Copy link

搜索日期和时间区间也是一样的吗 "2017-02-01 10:01:02 ,2018-02-01 11:09:03"

@TommyLemon
Copy link
Collaborator

"2017-02-01 10:01:02 ,2018-02-01 11:09:03"

一样,不过你写的这个在逗号前多了个空格

@shanhan0
Copy link

shanhan0 commented Dec 9, 2020

好的,感谢回答

@transtone
Copy link
Contributor

transtone commented Oct 9, 2022

比较运算 "date>=": "2017-02"

连续日期 "date%": "2017-02-01,2018-02-01"

连续时间 "datetime%": "2017-02-01 10:01:02 ,2018-02-01 11:09:03"

https://github.com/APIJSON/APIJSON/blob/master/Document.md#32-%E5%8A%9F%E8%83%BD%E7%AC%A6

pg使用此查询方式,需在数据库连接处加参数 stringtype=unspecified,如:

url: jdbc:postgresql://127.0.0.1:5432/postgres?reWriteBatchedInserts=true&TimeZone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&stringtype=unspecified

#436

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants