Explorar el Código

优化数据处理逻辑,重构相关类和方法

在 `SystemController.cs` 中简化了 `OperationSetData` 方法的异常处理,移除了多余的 `try-catch` 结构,并优化了对 `dto.Name` 的空值检查。调整了返回的错误信息以提高用户反馈的清晰度。

移除了 `Grp_OrderInfo.cs` 中的类定义,并在 `Grp_OrderPreInfo.cs` 中新增了 `Grp_OrderPreInfo` 类,增强了数据模型的丰富性。

在 `VisaFeeInfoRepository.cs` 中将费用报价系数的默认值从 `1.20M` 修改为 `1.00M`,以调整费用计算的准确性。

重构了 `SetDataRepository.cs` 中的 `OperationSetData` 方法,移除了冗余的 SQL 查询逻辑,简化了数据的添加和修改流程,确保状态参数的正确处理,提升了代码的可读性和维护性。
LEIYI hace 5 meses
padre
commit
915baad7eb

+ 7 - 16
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -530,24 +530,15 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OperationSetData(OperationSetDataDto dto)
         {
-            try
-            {
-                if (dto.Name == "")
-                {
-                    return Ok(JsonView(false, "请检查板块名称是否填写!"));
-                }
-                Result result = await _setDataRepository.OperationSetData(dto);
-                if (result.Code != 0)
-                {
-                    return Ok(JsonView(false, result.Msg));
-                }
-                return Ok(JsonView(true, result.Msg));
-            }
-            catch (Exception ex)
+            if (string.IsNullOrEmpty(dto.Name)) return Ok(JsonView(false, "请检查板块名称是否填写!"));
+
+            Result result = await _setDataRepository.OperationSetData(dto);
+
+            if (result.Code != 0)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                return Ok(JsonView(false, result.Msg));
             }
+            return Ok(JsonView(true, result.Msg));
         }
 
         /// <summary>

+ 0 - 29
OASystem/OASystem.Domain/Entities/Groups/Grp_OrderInfo.cs

@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OASystem.Domain.Entities.Groups
-{
-    /// <summary>
-    /// 团组下单信息
-    /// </summary>
-    [SqlSugar.SugarTable("Grp_OrderInfo","团组下单信息")]
-    public class Grp_OrderInfo:EntityBase
-    {
-        /// <summary>
-        /// 正式团组Id
-        /// </summary>
-        [SugarColumn(ColumnName = "GroupId", ColumnDescription = "团组Id", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "int")]
-        public int GroupId { get; set; }
-
-        /// <summary>
-        /// 类型
-        /// </summary>
-        [SugarColumn(ColumnName = "Type", ColumnDescription = "团组下单类型", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "int")]
-        public int Type { get; set; }
-
-        public string Unit { get; set; }
-    }
-}

+ 327 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_OrderPreInfo.cs

@@ -0,0 +1,327 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 团组下单前信息
+    /// </summary>
+    [SqlSugar.SugarTable("Grp_OrderPreInfo", "团组下单前信息")]
+    public class Grp_OrderPreInfo:EntityBase
+    {
+        /// <summary>
+        /// 正式团组Id
+        /// </summary>
+        [SugarColumn(ColumnName = "GroupId", ColumnDescription = "团组Id", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "int")]
+        public int GroupId { get; set; }
+
+        /// <summary>
+        /// 类型
+        /// </summary>
+        [SugarColumn(ColumnName = "Type", ColumnDescription = "团组下单类型", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "int")]
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 团组单位
+        /// </summary>
+        [SugarColumn(ColumnName = "Unit", ColumnDescription = "团组单位", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(120)")]
+        public string Unit { get; set; }
+
+        /// <summary>
+        /// 团组单位备注
+        /// </summary>
+        [SugarColumn(ColumnName = "UnitRmk", ColumnDescription = "团组单位备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string UnitRmk { get; set; }
+
+        /// <summary>
+        /// 出访国家(地、区)
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitCountry", ColumnDescription = "出访国家(地、区)", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(120)")]
+        public string VisitCountry { get; set; }
+
+        /// <summary>
+        /// 出访国家(地、区)备注
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitCountryRmk", ColumnDescription = "出访国家(地、区)备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string VisitCountryRmk { get; set; }
+
+        /// <summary>
+        /// 涉及城市
+        /// </summary>
+        [SugarColumn(ColumnName = "Urban", ColumnDescription = "涉及城市", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(120)")]
+        public string Urban { get; set; }
+
+        /// <summary>
+        /// 涉及城市备注
+        /// </summary>
+        [SugarColumn(ColumnName = "UrbanRmk", ColumnDescription = "涉及城市备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string UrbanRmk { get; set; }
+
+        /// <summary>
+        /// 计划出访时间(天数)
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitDays", ColumnDescription = "计划出访时间(天数)", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "int")]
+        public int VisitDays { get; set; }
+
+        /// <summary>
+        /// 计划出访时间(天数)备注
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitDaysRmk", ColumnDescription = "计划出访时间(天数)备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string VisitDaysRmk { get; set; }
+
+        /// <summary>
+        /// 计划出访人数
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitPNum", ColumnDescription = "计划出访人数", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "int")]
+        public int VisitPNum { get; set; }
+
+        /// <summary>
+        /// 计划出访人数备注
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitPNumRmk", ColumnDescription = "计划出访人数备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string VisitPNumRmk { get; set; }
+
+        /// <summary>
+        /// 航班信息
+        /// </summary>
+        [SugarColumn(ColumnName = "AirInfo", ColumnDescription = "航班信息", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(120)")]
+        public string AirInfo { get; set; }
+
+        /// <summary>
+        /// 航班信息备注
+        /// </summary>
+        [SugarColumn(ColumnName = "AirInfoRmk", ColumnDescription = "航班信息备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string AirInfoRmk { get; set; }
+        
+        /// <summary>
+        /// 行李尺寸
+        /// </summary>
+        [SugarColumn(ColumnName = "LugSize", ColumnDescription = "行李尺寸", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(120)")]
+        public string LugSize { get; set; }
+
+        /// <summary>
+        /// 行李尺寸备注
+        /// </summary>
+        [SugarColumn(ColumnName = "LugSizeRmk", ColumnDescription = "行李尺寸备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string LugSizeRmk { get; set; }
+
+        /// <summary>
+        /// 酒店地址
+        /// </summary>
+        [SugarColumn(ColumnName = "HotelAddr", ColumnDescription = "酒店地址", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(120)")]
+        public string HotelAddr { get; set; }
+
+        /// <summary>
+        /// 酒店地址备注
+        /// </summary>
+        [SugarColumn(ColumnName = "HotelAddrRmk", ColumnDescription = "酒店地址备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string HotelAddrRmk { get; set; }
+
+        /// <summary>
+        /// 车型有无要求
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCarTypeReq", ColumnDescription = "有无车型要求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsCarTypeReq { get; set; } = false;
+
+        /// <summary>
+        /// 车型有无要求备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCarTypeReqRmk", ColumnDescription = "有无车型要求备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsCarTypeReqRmk { get; set; }
+
+        /// <summary>
+        /// 有无司导性别要求
+        /// </summary>
+        [SugarColumn(ColumnName = "IsGuideSexReq", ColumnDescription = "有无司导性别要求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsGuideSexReq { get; set; } = false;
+
+        /// <summary>
+        /// 有无司导性别要求备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsGuideSexReqRmk", ColumnDescription = "有无司导性别要求备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsGuideSexReqRmk { get; set; }
+
+        /// <summary>
+        /// 其他增加信息
+        /// </summary>
+        [SugarColumn(ColumnName = "OtherInfoReq", ColumnDescription = "其他增加信息", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(120)")]
+        public string OtherInfoReq { get; set; }
+
+        /// <summary>
+        /// 其他增加信息备注
+        /// </summary>
+        [SugarColumn(ColumnName = "OtherInfoRmk", ColumnDescription = "其他增加信息备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string OtherInfoRmk { get; set; }
+
+        /// <summary>
+        /// 客户自有公务信息(地址、联系人)
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCustBiz", ColumnDescription = "客户自有公务信息(地址、联系人)", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsCustBiz { get; set; } = false;
+
+        /// <summary>
+        /// 客户自有公务信息(地址、联系人)备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCustBizRmk", ColumnDescription = "客户自有公务信息(地址、联系人)备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsCustBizRmk { get; set; }
+
+        /// <summary>
+        /// 是否已提供名单
+        /// </summary>
+        [SugarColumn(ColumnName = "IsListProvided", ColumnDescription = "是否已提供名单", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsListProvided { get; set; } = false;
+
+        /// <summary>
+        /// 是否已提供名单备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsListProvidedRmk", ColumnDescription = "是否已提供名单备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsListProvidedRmk { get; set; }
+
+        /// <summary>
+        /// 航班选座需求
+        /// </summary>
+        [SugarColumn(ColumnName = "IsNeedSeat", ColumnDescription = "航班选座需求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsNeedSeat { get; set; } = false;
+
+        /// <summary>
+        /// 航班选座需求备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsNeedSeatRmk", ColumnDescription = "航班选座需求备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsNeedSeatRmk { get; set; }
+
+        /// <summary>
+        /// 酒店特殊需求
+        /// </summary>
+        [SugarColumn(ColumnName = "IsSpecialReq", ColumnDescription = "酒店特殊需求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsSpecialReq { get; set; } = false;
+
+        /// <summary>
+        /// 酒店特殊需求备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsSpecialReqRmk", ColumnDescription = "酒店特殊需求 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsSpecialReqRmk { get; set; }
+
+        /// <summary>
+        /// 餐和超支需求(餐是否需要我们安排,超支怎么处理)
+        /// </summary>
+        [SugarColumn(ColumnName = "IsMealPlanOver", ColumnDescription = "餐和超支需求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsMealPlanOver { get; set; } = false;
+
+        /// <summary>
+        /// 餐和超支需求备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsMealPlanOverRmk", ColumnDescription = "餐和超支需求 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsMealPlanOverRmk { get; set; }
+
+        /// <summary>
+        /// 超时和超支(超时和超支,客人现付还是境外签单回来结算)
+        /// </summary>
+        [SugarColumn(ColumnName = "OverTimeOverBudgetBil", ColumnDescription = "超时和超支", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string OverTimeOverBudgetBil { get; set; }
+
+        /// <summary>
+        /// 超时和超支 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "OverTimeOverBudgetBilRmk", ColumnDescription = "超时和超支 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string OverTimeOverBudgetBilRmk { get; set; }
+
+        /// <summary>
+        /// 物资需求(物资(含wifi,备用金)要求及时间)要求及时间
+        /// </summary>
+        [SugarColumn(ColumnName = "MatReqTime", ColumnDescription = "物资需求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string MatReqTime { get; set; }
+
+        /// <summary>
+        /// 物资需求(物资(含wifi,备用金)要求及时间) 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "MatReqTimelRmk", ColumnDescription = "物资需求 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string MatReqTimelRmk { get; set; }
+
+        /// <summary>
+        /// 景点需求(景点有无特别想去的,是否要安排讲解)
+        /// </summary>
+        [SugarColumn(ColumnName = "IsSpotLectReq", ColumnDescription = "景点需求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsSpotLectReq { get; set; } = false;
+
+        /// <summary>
+        /// 景点需求(景点有无特别想去的,是否要安排讲解) 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsSpotLectReqRmk", ColumnDescription = "景点需求 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsSpotLectReqRmk { get; set; }
+
+        /// <summary>
+        /// 出访任务内容
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitTaskContent", ColumnDescription = "出访任务内容", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool VisitTaskContent { get; set; } = false;
+
+        /// <summary>
+        /// 出访任务内容 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "VisitTaskContentReqRmk", ColumnDescription = "出访任务内容 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string VisitTaskContentReqRmk { get; set; }
+
+        /// <summary>
+        /// 出访背景
+        /// </summary>
+        [SugarColumn(ColumnName = "IsVisitBack", ColumnDescription = "出访背景", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsVisitBack { get; set; }
+
+        /// <summary>
+        /// 出访背景 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsVisitBackRmk", ColumnDescription = "出访背景 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsVisitBackRmk { get; set; }
+
+        /// <summary>
+        /// 客户自有参考材料
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCustRefMat", ColumnDescription = "客户自有参考材料", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsCustRefMat { get; set; }
+
+        /// <summary>
+        /// 客户自有参考材料 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCustRefMatRmk", ColumnDescription = "客户自有参考材料 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsCustRefMatRmk { get; set; }
+
+        /// <summary>
+        /// 客户自有项目(公务)资源
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCustProjRes", ColumnDescription = "客户自有项目(公务)资源", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsCustProjRes { get; set; }
+
+        /// <summary>
+        /// 客户自有项目(公务)资源 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsCustProjResRmk", ColumnDescription = "客户自有项目(公务)资源 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsCustProjResRmk { get; set; }
+
+        /// <summary>
+        /// 其他特殊要求
+        /// </summary>
+        [SugarColumn(ColumnName = "IsOtherSpecialReq", ColumnDescription = "其他特殊要求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsOtherSpecialReq { get; set; }
+
+        /// <summary>
+        /// 其他特殊要求 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsOtherSpecialReqRmk", ColumnDescription = "其他特殊要求 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsOtherSpecialReqRmk { get; set; }
+
+        /// <summary>
+        /// 公务需求(客人有无自己安排的公务(如有的话需要提供地址,涉及到是否市外用车))
+        /// </summary>
+        [SugarColumn(ColumnName = "IsGuestOwnBiz", ColumnDescription = "公务需求", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "bit")]
+        public bool IsGuestOwnBiz { get; set; }
+
+        /// <summary>
+        /// 公务需求(客人有无自己安排的公务(如有的话需要提供地址,涉及到是否市外用车)) 备注
+        /// </summary>
+        [SugarColumn(ColumnName = "IsGuestOwnBizRmk", ColumnDescription = "公务需求 备注", IsNullable = true, DefaultValue = "NULL", ColumnDataType = "varchar(300)")]
+        public string IsGuestOwnBizRmk { get; set; }
+    }
+}

+ 2 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaFeeInfoRepository.cs

@@ -289,7 +289,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             var visaData1 = visaData.GroupBy(it => it.CountryVisaFeeId);
             
             //费用报价系数
-            decimal priceCoeff = 1.20M; 
+            decimal priceCoeff = 1.00M; 
             foreach (var kvp in visaData1)
             {
                 var countryData = visaCountryDatas.Find(it => it.Id == kvp.Key);
@@ -365,7 +365,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             decimal feeTotal = 0.00M;
 
             //费用报价系数
-            decimal priceCoeff = 1.20M;
+            decimal priceCoeff = 1.00M;
             foreach (var kvp in visaCountryDatas)
             {
                 var countryName = kvp?.VisaCountry ?? "";

+ 27 - 38
OASystem/OASystem.Infrastructure/Repositories/System/SetDataRepository.cs

@@ -229,53 +229,42 @@ namespace OASystem.Infrastructure.Repositories.System
         public async Task<Result> OperationSetData(OperationSetDataDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+            if (dto.Status == 1)//添加
             {
-                if (dto.Status == 1)//添加
+                string selectSql = string.Format(@"select * from Sys_SetData where STID={0} AND Name='{1}' and IsDel='{2}'"
+                                                   , dto.STid, dto.Name, 0);
+                var SetData = await _sqlSugar.SqlQueryable<Sys_SetData>(selectSql).FirstAsync();//查询是否存在
+                if (SetData != null)
                 {
-                    string selectSql = string.Format(@"select * from Sys_SetData where Name='{0}' and IsDel='{1}'"
-                                                       , dto.Name, 0);
-                    var SetData = await _sqlSugar.SqlQueryable<Sys_SetData>(selectSql).FirstAsync();//查询是否存在
-                    if (SetData != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
-
-                    }
-                    else//不存在,可添加
-                    {
-                        Sys_SetData _SetData = _mapper.Map<Sys_SetData>(dto);
-                        int id = await AddAsyncReturnId(_SetData);
-                        if (id == 0)
-                        {
-                            return result = new Result() { Code = -1, Msg = "添加失败!" };
+                    return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
 
-                        }
-                        result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
-                    }
-                }
-                else if (dto.Status == 2)//修改
-                {
-                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Sys_SetData
-                    {
-                        Name = dto.Name,
-                        STid = dto.STid,
-                        Remark = dto.Remark,
-                    });
-                    if (!res)
-                    {
-                        return result = new Result() { Code = -1, Msg = "修改失败!" };
-                    }
-                    result = new Result() { Code = 0, Msg = "修改成功!" };
                 }
-                else
+
+                Sys_SetData _SetData = _mapper.Map<Sys_SetData>(dto);
+                int id = await AddAsyncReturnId(_SetData);
+                if (id == 0)
                 {
-                    return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
+                    return result = new Result() { Code = -1, Msg = "添加失败!" };
+
                 }
+                result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
+
             }
-            catch (Exception ex)
+            else if (dto.Status == 2)//修改
             {
-                return result = new Result() { Code = -2, Msg = "程序错误!" };
+                bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Sys_SetData
+                {
+                    Name = dto.Name,
+                    STid = dto.STid,
+                    Remark = dto.Remark,
+                });
+                if (!res)
+                {
+                    return result = new Result() { Code = -1, Msg = "修改失败!" };
+                }
+                result = new Result() { Code = 0, Msg = "修改成功!" };
             }
+            else return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
             return result;
         }