ngbatis icon indicating copy to clipboard operation
ngbatis copied to clipboard

Does ngbatis support expression of ognl?

Open gavin-ao opened this issue 2 years ago • 5 comments

这种if标签没有用,请问是否支持?如果不支持,有什么办法绕过去吗?谢谢

gavin-ao avatar May 18 '23 09:05 gavin-ao

条件控制的标签可以使用 @if 来控制,#的方式不支持哦

<select id="getGraphDataForTest" resultType="com.vesoft.nebula.client.graph.data.ResultSet">
    MATCH  p1=(v_pl:`linkage_plan`)-[e_pc:`relation`]->(v_c_1:`frame_instance`),
            p2=(v_a_1:`frame_dict`)-[e_ab_1:`relation`{relation_type:20}]->(v_b_1:`biz_frame_instance`),
            p3=(v_d_1:`loc_frame_instance`)-[e_dc_1:`relation`*1..6]->(v_c_1:`frame_instance`)<-[e_bd_1:`relation`*1..6]-(v_b_1:`biz_frame_instance`)
            where 1=1
            @if ( isNotEmpty( structname ) ) {
                and v_c_1.frame_instance.structName = '${structname}'
            @ }
            and ((id(v_pl) contains "${querycontent}") or (id(v_c_1) contains "${querycontent}")
            or (id(v_a_1) contains "${querycontent}") or (id(v_b_1) contains "${querycontent}") or (id(v_d_1) contains "${querycontent}"))
            return nodes(p1), relationships(p1),nodes(p2), relationships(p2),nodes(p3), relationships(p3) limit 100;
</select>

CorvusYe avatar May 18 '23 09:05 CorvusYe

好的,谢谢,我试一下

gavin-ao avatar May 18 '23 09:05 gavin-ao

有效,感谢

gavin-ao avatar May 18 '23 09:05 gavin-ao

可以就行。如果想使用 # 这种类似 preparedStatement 的占位符形式, 可以使用 and v_c_1.frame_instance.structName == {structname}, 但前提是这个参数所在的位置ngql 支持参数化

CorvusYe avatar May 18 '23 09:05 CorvusYe

👌👌

gavin-ao avatar May 18 '23 10:05 gavin-ao