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

可以问一下这个JOIN到底是干了啥? #789

Open
pbw-langwang opened this issue Dec 25, 2024 · 0 comments
Open

可以问一下这个JOIN到底是干了啥? #789

pbw-langwang opened this issue Dec 25, 2024 · 0 comments

Comments

@pbw-langwang
Copy link

Description

我最近使用apijson导致了一场严重级bug,所以解决后但是不知道为什么,还望解答!

这个是数据库关系:
企业微信截图_1735003108629

其中框起来的表示要搜索的字段!

我一开始的apijson是这样的:

/** 获取我的分析列表 **/
export async function analysisListApi(params = {}, keysword) {
  // 过滤为APIJSON参数格式
  const data = {
    "[]": {
      join: `|/Project/projectId@`,
      query: 2,
      count: params.count,
      page: params.page - 1
    },
    "total@": "/[]/total"
  }

  // 设置模糊查询参数
  const likeList1 = keysword ? likeJoin(["taskName~", "taskId~", "projectId~"], keysword) : {}
  const likeList2 = keysword ? likeJoin(["projectName~", "BNId~"], keysword) : {}

  data["[]"][tableName] = {
    isDelete: 0,
    "@order": "taskCreateTime-",
    // 表字段参数
    ...params.data,
    ...likeList1
  }
  data["[]"]["Project"] = {
    uId: params.uId,
    "projectId@": `/${tableName}/projectId`,
    ...likeList2
  }
  data["[]"]["User"] = {
    id: params.uId,
    "@column": "id,name,email",
    "id@": `/${tableName}/uId`
  }
  delete data.data
  return APIList(baseURL, tableName, data)
}

结果会导致用户可以看见别的用户的数据,将join: |/Project/projectId@,改成join: |/Project/projectId@,&/User/id@,可以是可以了,但是不清楚为什么,可以解答一下吗?

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

No branches or pull requests

1 participant