nebula-contrib / ngbatis

NGBATIS is a database ORM framework base NebulaGraph + spring-boot, which takes advantage of the mybatis’ fashion development, including some de-factor operations in single table and vertex-edge, like mybatis-plus. NGBATIS 是一款针对 NebulaGraph + Springboot 的数据库 ORM 框架。借鉴于 MyBatis 的使用习惯进行开发。https://graph-cn.github.io/ngbatis-docs/
https://nebula-contrib.github.io/ngbatis/
Apache License 2.0
132 stars 42 forks source link

是否支持传入一个Map对象给SQL #142

Closed ZhangJinzhaoGit closed 1 year ago

ZhangJinzhaoGit commented 1 year ago

如题,我现在有一个Map,我想向图数据库查询的时候,在XML的sql中根据Map的键值来取值

CorvusYe commented 1 year ago

支持的~

ZhangJinzhaoGit commented 1 year ago

麻烦请教一下,在XML中怎么使用呢

CorvusYe commented 1 year ago

比如说:

  selectByMap(Map param);
  <select id="selectByMap">
       MATCH (n:person) 
       WHERE n.person.name == '${name}'
       RETURN n
  </select>

name是Map里的一个key

ZhangJinzhaoGit commented 1 year ago

image image 叶老师,这样可以吗

ZhangJinzhaoGit commented 1 year ago

实现了,谢谢!map["1"] 就可以

CorvusYe commented 1 year ago

如果想用get方法获取,前面需要加个@ 符号,用来将这个变量标识为java对象 key是1的值,是个集合是吧

CorvusYe commented 1 year ago

实现了,谢谢!map["1"] 就可以

OK~你发现了一个我自己没用过的用法,哈哈哈