import { post } from '@vue2-client/services/api/restTools'

const entityApi = {
  // 根据ID查询数据
  getById: (entityName, id, data = {}, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
    return post(`/api/${serviceName}/entity/query/${entityName}/${id}`, data)
  },
  // 根据ID集合查询所有数据
  findAllByIds: (entityName, data, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
    return post(`/api/${serviceName}/entity/query/${entityName}`, data)
  },
  // 查询实体的总数量
  getCount: (entityName, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
    return post(`/api/${serviceName}/entity/queryCount/${entityName}`, {})
  }
}

export { entityApi }
