基础条件查询示例
基础条件查询示例 单个条件查询
精准 =
查询动作类型(DEVELOPLOG_ACT_CODE)是 applyTable的数据
j_query信息:
[
{
"type": "=",
"code": "DEVELOPLOG_ACT_CODE",
"value": "applyTable",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( DEVELOPLOG_ACT_CODE = 'applyTable' )
模糊 like
模糊查询对象名称(DEVELOPLOG_NAME)值是 ‘测试’
j_query信息:
[
{
"type": "like",
"code": "DEVELOPLOG_NAME",
"value": "测试",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( DEVELOPLOG_NAME LIKE '%测试%' )
包含 in
查询动作类型(DEVELOPLOG_ACT_CODE)是 applyTable 和 CREATE
j_query信息:
[
{
"type": "in",
"code": "DEVELOPLOG_ACT_CODE",
"value": [
"applyTable",
"CREATE"
],
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( DEVELOPLOG_NAME IN ('applyTable','CREATE') )
区间 between
查询登记时间是6月-7月数据
j_query信息:
[
{
"type": "between",
"code": "SY_CREATETIME",
"value": [
"2024-06",
"2024-07"
],
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( SY_CREATETIME BETWEEN '2024-06' AND '2024-07' )
大于 >
查询登记时间大于6月数据
j_query信息:
[
{
"type": ">",
"code": "SY_CREATETIME",
"value": "2024-06",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( SY_CREATETIME > '2024-06' )
大于等于 >=
查询登记时间大于等于6月数据
j_query信息:
[
{
"type": ">=",
"code": "SY_CREATETIME",
"value": "2024-06",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( SY_CREATETIME >= '2024-06' )
小于 <
查询登记时间小于等于6月数据
j_query信息:
[
{
"type": "<",
"code": "SY_CREATETIME",
"value": "2024-06",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( SY_CREATETIME < '2024-06' )
小于等于 <=
查询登记时间小于等于6月数据
j_query信息:
[
{
"type": "<=",
"code": "SY_CREATETIME",
"value": "2024-06",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( SY_CREATETIME <= '2024-06' )
不等于 !=
查询登记时间不等于6月数据
j_query信息:
[
{
"type": "!=",
"code": "SY_CREATETIME",
"value": "2024-06",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( SY_CREATETIME <> '2024-06' )
notIn notIn
查询登记时间不在6月和7月的数据
j_query信息:
[
{
"type": "notIn",
"code": "SY_CREATETIME",
"value": [
"2024-06",
"2024-07"
],
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( SY_CREATETIME NOT IN ('2024-06','2024-07') )
notNull notNull
查询登记时间不等于null的数据
j_query信息:
[
{
"type": "notNull",
"code": "SY_CREATETIME",
"value": "",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( ( SY_CREATETIME is not null ) )
isNull isNull
查询登记时间等于null的数据
j_query信息:
[
{
"type": "isNull",
"code": "SY_CREATETIME",
"value": "",
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( ( SY_CREATETIME is null ) )
inSelect inSelect
查询 DEVELOPLOG_ACT_CODE 数据在 ( DICTIONARYITEM_ITEMCODE字段值 JE_CORE_DICTIONARYITEM 表 DICTIONARYITEM_DICTIONARY_ID 为 ZQnboCooVszhRVXj2Si 的数据)
j_query信息:
[
{
"type": "inSelect",
"code": "DEVELOPLOG_ACT_CODE",
"value": {
"table": "JE_CORE_DICTIONARYITEM",
"code": "DICTIONARYITEM_ITEMCODE",
"conditions": [{
"type": "=",
"code": "DICTIONARYITEM_DICTIONARY_ID",
"value": "ZQnboCooVszhRVXj2Si",
"cn": "and"
}]
},
"cn": "and"
}
]
对应后端输出sql:
... WHERE ( DEVELOPLOG_ACT_CODE IN (SELECT DICTIONARYITEM_ITEMCODE FROM JE_CORE_DICTIONARYITEM WHERE DICTIONARYITEM_DICTIONARY_ID = 'ZQnboCooVszhRVXj2Si' ) )
notInSelect notInSelect
原理同上
最后编辑: 于春辉 文档更新时间: 2024-08-29 09:50 作者:于春辉