Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

post时,远程函数如何拿到自增的id值 #754

Open
CarsonYue opened this issue Aug 18, 2024 · 5 comments
Open

post时,远程函数如何拿到自增的id值 #754

CarsonYue opened this issue Aug 18, 2024 · 5 comments

Comments

@CarsonYue
Copy link

CarsonYue commented Aug 18, 2024

Description

在新增时调用远程函数(如:{"INSERT": {"A-()": "A(p1,p2)"}}),如何在远程函数中拿到新增记录的自增id。

Tasks

No tasks being tracked yet.
@TommyLemon
Copy link
Collaborator

会直接在当前表对象返回:
"主键名": 自增id值

例如:
"id": 2
可以直接在这个层级用远程函数访问
"fun()":"fun(id)"

@CarsonYue
Copy link
Author

这是我的配置:
图片
我的远程函数:
图片
没有看到id,是哪里配错了吗?

@CarsonYue
Copy link
Author

找到了,多谢

@CarsonYue
Copy link
Author

还有个问题啊,POST 插入时,如何在一个远程函数中,同时拿到插入的字段和返回的id(即拿到当前对象所有的字段)

@CarsonYue CarsonYue reopened this Aug 19, 2024
@TommyLemon
Copy link
Collaborator

TommyLemon commented Aug 22, 2024

"key-()":"saveCurObj()", // 预处理函数保存当前传参对象
"key2()":"fun(id)" // 后处理函数获取插入记录的 id
都拿到后放到 DemoFunctionParser 内同一个成员变量(可以是 JSONObject/Map 或其它自定义 JavaBean 等)保存即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants