Skip to content

单表新增、修改、删除支持别名 #470

Open

Description

@cloudAndMonkey

apijson版本: 5.2.0
校验入口, 添加代码:
image
返回结果添加如下代码:
image
JSONResponse 格式化返回结果:
image
示例说明:
新增:
image
image
修改:
image
image
删除
image

Activity

  1. TommyLemon commented on Nov 26, 2022

    @TommyLemon
    Member

    @cloudAndMonkey 默认还是不要把 User:aa 转为 aa,因为可能还同时有 Comment:aa, Moment:aa 等,转换后就只剩最后一个,上面的都被覆盖了。
    只有 format: true 时才转(也有这个 bug,不过至少默认是 false 不会触发)。

    {
        "User": {},
        "User:count": {
            "@column": "count(*)"
        },
        "Comment:count": {
            "@column": "count(1)"
        }
    }

    image

    http://apijson.cn/api/?send=true&type=JSON&url=http%3A%2F%2Fapijson.cn%3A8080%2Fget&json={%22User:count%22:{%22@column%22:%22count(*)%22},%22Comment:count%22:{%22@column%22:%22count(1)%22}}

    image

    http://apijson.cn/api/?send=true&type=JSON&url=http%3A%2F%2Fapijson.cn%3A8080%2Fget&json={%22User:count%22:{%22@column%22:%22count(*)%22},%22Comment:count%22:{%22@column%22:%22count(1)%22},%22format%22:true}
  2. cloudAndMonkey commented on Jan 16, 2023

    @cloudAndMonkey
    ContributorAuthor

    @cloudAndMonkey 默认还是不要把 User:aa 转为 aa,因为可能还同时有 Comment:aa, Moment:aa 等,转换后就只剩最后一个,上面的都被覆盖了。 只有 format: true 时才转(也有这个 bug,不过至少默认是 false 不会触发)。

    {
        "User": {},
        "User:count": {
            "@column": "count(*)"
        },
        "Comment:count": {
            "@column": "count(1)"
        }
    }
    image

    http://apijson.cn/api/?send=true&type=JSON&url=http%3A%2F%2Fapijson.cn%3A8080%2Fget&json={%22User:count%22:{%22@column%22:%22count(*)%22},%22Comment:count%22:{%22@column%22:%22count(1)%22}}

    image

    http://apijson.cn/api/?send=true&type=JSON&url=http%3A%2F%2Fapijson.cn%3A8080%2Fget&json={%22User:count%22:{%22@column%22:%22count(*)%22},%22Comment:count%22:{%22@column%22:%22count(1)%22},%22format%22:true}
    @TommyLemon
    github notifications 没有提醒,我都没看到,不好意思 ,😄
    image

  3. cloudAndMonkey commented on Jan 16, 2023

    @cloudAndMonkey
    ContributorAuthor

    我测了一下,你已经加上去了, 不好意思. 😄

  4. TommyLemon commented on Jan 20, 2023

    @TommyLemon
    Member

    😄

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions