import request from '/@@/utils/request';
enum Api {
  Add@(@Model.ClassName) = '/@(@Model.ClassName)/add',
  Delete@(@Model.ClassName) = '/@(@Model.ClassName)/delete',
  Update@(@Model.ClassName) = '/@(@Model.ClassName)/edit',
  Get@(@Model.ClassName)Page = '/@(@Model.ClassName)/page',
  @foreach (var column in Model.TableField){
if(@column.EffectType == "fk"){
  @:Get@(@column.FkEntityName)Dropdown = '/@(@Model.ClassName)/@(@column.FkEntityName)Dropdown',
}else if(@column.EffectType == "ApiTreeSelect"){
  @:Get@(@column.FkEntityName)Tree = '/@(@Model.ClassName)/@(@column.FkEntityName)Tree',
}
}
}

// 增加@(@Model.BusName)
export const add@(@Model.ClassName) = (params?: any) =>
	request({
		url: Api.Add@(@Model.ClassName),
		method: 'post',
		data: params,
	});

// 删除@(@Model.BusName)
export const delete@(@Model.ClassName) = (params?: any) => 
	request({
			url: Api.Delete@(@Model.ClassName),
			method: 'post',
			data: params,
		});

// 编辑@(@Model.BusName)
export const update@(@Model.ClassName) = (params?: any) => 
	request({
			url: Api.Update@(@Model.ClassName),
			method: 'post',
			data: params,
		});

// 分页查询@(@Model.BusName)
export const get@(@Model.ClassName)PageList = (params?: any) => 
	request({
			url: Api.Get@(@Model.ClassName)Page,
			method: 'get',
			data: params,
		});

@foreach (var column in Model.TableField){
	if(@column.EffectType == "fk"){
		@:export const get@(@column.FkEntityName)Dropdown = () =>
		@:request({
		@:url: Api.Get@(@column.FkEntityName)Dropdown,
		@:method: 'get'
		@:});
	}else if(@column.EffectType == "ApiTreeSelect"){
		@:export const get@(@column.FkEntityName)Tree = () =>
		@:request({
		@:url: Api.Get@(@column.FkEntityName)Tree,
		@:method: 'get'
		@:});
		}
}