Commit 20f18edf authored by 黄奎's avatar 黄奎

页面修改

parent d1fff1db
...@@ -15,16 +15,31 @@ ...@@ -15,16 +15,31 @@
/// </summary> /// </summary>
public string Ids { get; set; } public string Ids { get; set; }
/// <summary>
/// 国家编号
/// </summary>
public int CountryId { get; set; }
/// <summary> /// <summary>
/// 国家名称 /// 国家名称
/// </summary> /// </summary>
public string CountryName { get; set; } public string CountryName { get; set; }
/// <summary>
/// 省份编号
/// </summary>
public int ProviceId { get; set; }
/// <summary> /// <summary>
/// 省份名称 /// 省份名称
/// </summary> /// </summary>
public string ProvinceName { get; set; } public string ProvinceName { get; set; }
/// <summary>
/// 城市编号
/// </summary>
public int CityId { get; set; }
/// <summary> /// <summary>
/// 城市名称 /// 城市名称
/// </summary> /// </summary>
......
...@@ -3,6 +3,7 @@ using Edu.Model.ViewModel.System; ...@@ -3,6 +3,7 @@ using Edu.Model.ViewModel.System;
using Edu.Repository.System; using Edu.Repository.System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using VT.FW.DB;
namespace Edu.Module.System namespace Edu.Module.System
{ {
...@@ -136,5 +137,95 @@ namespace Edu.Module.System ...@@ -136,5 +137,95 @@ namespace Edu.Module.System
var list = destinationRepository.GetDestinationListRepository(query); var list = destinationRepository.GetDestinationListRepository(query);
return list; return list;
} }
/// <summary>
/// 根据编号获取地区详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Destination_ViewModel GetDestinationModule(object Id)
{
var model = destinationRepository.GetEntity<RB_Destination_ViewModel>(Id);
if (model != null && model.ID > 0)
{
RB_Destination_ViewModel country = null;
RB_Destination_ViewModel provice = null;
RB_Destination_ViewModel city = null;
switch (model.CodeLevel)
{
//省份
case 2:
country = destinationRepository.GetEntity<RB_Destination_ViewModel>(model.ParentID);
model.CountryName = country?.Name;
model.CountryId = country?.ID??0;
break;
//市
case 3:
provice = destinationRepository.GetEntity<RB_Destination_ViewModel>(model.ParentID);
model.ProvinceName = provice?.Name;
model.ProviceId = provice?.ID ?? 0;
country = destinationRepository.GetEntity<RB_Destination_ViewModel>(provice?.ParentID);
model.CountryName = country?.Name;
model.CountryId = country?.ID ?? 0;
break;
//区
case 4:
city = destinationRepository.GetEntity<RB_Destination_ViewModel>(model.ParentID);
model.CityName = city?.Name;
model.CityId = city?.ID ?? 0;
provice = destinationRepository.GetEntity<RB_Destination_ViewModel>(city?.ParentID);
model.ProvinceName = provice?.Name;
model.ProviceId = provice?.ID ?? 0;
country = destinationRepository.GetEntity<RB_Destination_ViewModel>(provice?.ParentID);
model.CountryName = country?.Name;
model.CountryId = country?.ID ?? 0;
break;
}
}
return model;
}
/// <summary>
/// 新增修改地区
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetDestinationModule(RB_Destination_ViewModel model)
{
bool flag = false;
if (model.ID > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Destination_ViewModel.Name),model.Name},
{ nameof(RB_Destination_ViewModel.ParentID),model.ParentID},
{ nameof(RB_Destination_ViewModel.CodeLevel),model.CodeLevel},
};
flag = destinationRepository.Update(fileds, new WhereHelper(nameof(RB_Destination_ViewModel.ID),model.ID));
}
else
{
var newId = destinationRepository.Insert(model);
model.ID = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 删除地区数据
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public bool RemoveAreaModule(int ID)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Destination_ViewModel.Status),(int)Common.Enum.DateStateEnum.Delete}
};
return destinationRepository.Update(fileds, new WhereHelper(nameof(RB_Destination_ViewModel.ID), ID));
}
} }
} }
\ No newline at end of file
...@@ -111,6 +111,50 @@ namespace Edu.WebApi.Controllers.Public ...@@ -111,6 +111,50 @@ namespace Edu.WebApi.Controllers.Public
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
} }
/// <summary>
/// 新增修改地区
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetArea()
{
RB_Destination_ViewModel model = new RB_Destination_ViewModel()
{
ID = base.ParmJObj.GetInt("ID"),
Name = base.ParmJObj.GetStringValue("Name"),
ParentID = base.ParmJObj.GetInt("ParentID"),
CodeLevel = base.ParmJObj.GetInt("CodeLevel"),
};
model.Status = Common.Enum.DateStateEnum.Normal;
bool flag = destinationModule.SetDestinationModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取地区信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAreaInfo()
{
var ID = base.ParmJObj.GetInt("ID");
var model = destinationModule.GetDestinationModule(ID);
return ApiResult.Success(data: model);
}
/// <summary>
/// 删除地区数据
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveArea()
{
var ID = base.ParmJObj.GetInt("ID");
bool flag = destinationModule.RemoveAreaModule(ID);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion #endregion
#region 菜单管理 #region 菜单管理
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment