标签:pos code efi add http rac 技术 inf fine
表
id uid info
1 1001 {"name":"周年庆","status":0,"addtime":"2017-10-10"}
2 1002 [ {"name":"周年庆","status":0,"addtime":"2017-10-11"},{"name":"特价促销","status":0,"addtime":"2017-10-12"}]
3 1003 [ {"name":"特价促销","status":0,"addtime":"2017-10-12"},{"name":"国庆促销","status":0,"addtime":"2017-09-28"}]
查询语句:select * from tb where info->‘$.name‘ = ‘特价促销‘ or JSON_CONTAINS(info->‘$[*].name‘, ‘"特价促销"‘, ‘$‘)
查询语句:SELECT * FROM nlu_define_table WHERE JSON_CONTAINS(JSON_ARRAY("我","想","销","存单"),keywords->‘$.keywords‘) ORDER BY weights DESC;
其他查询语句:
SELECT * FROM nlu_define_table;
SELECT * FROM nlu_define_table WHERE keywords LIKE "%销%";
SELECT * FROM nlu_define_table WHERE JSON_EXTRACT(keywords,‘$.keywords‘) LIKE "%销%";
SELECT * FROM nlu_define_table WHERE keywords -> ‘$.keywords‘ LIKE "%销%";
第三条sql和第四条sql是等效。
MyBatis
select
*
from nlu_define_table
where 1 = 1
AND
<![CDATA[ JSON_CONTAINS( info->‘$[*].name‘, ]]> '"${name}"' <![CDATA[ , ‘$‘ ) ]]>
标签:pos code efi add http rac 技术 inf fine
原文地址:https://www.cnblogs.com/-levi/p/11401824.html