import request from '@/config/axios'

// 城市 VO
export interface CityVO {
  id: number // 主键ID
  name: string // 城市名称
  code: string // 城市编码
}

// 城市 API
export const CityApi = {
  // 查询城市分页
  getCityPage: async (params: any) => {
    return await request.get({ url: `/portal/city/page`, params })
  },

  // 查询城市详情
  getCity: async (id: number) => {
    return await request.get({ url: `/portal/city/get?id=` + id })
  },

  // 新增城市
  createCity: async (data: CityVO) => {
    return await request.post({ url: `/portal/city/create`, data })
  },

  // 修改城市
  updateCity: async (data: CityVO) => {
    return await request.put({ url: `/portal/city/update`, data })
  },

  // 删除城市
  deleteCity: async (id: number) => {
    return await request.delete({ url: `/portal/city/delete?id=` + id })
  },

  // 导出城市 Excel
  exportCity: async (params) => {
    return await request.download({ url: `/portal/city/export-excel`, params })
  }
}