| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System.Data; |
| | | using System.Text; |
| | | using Gs.Toolbox; |
| | | using Gs.Toolbox.ApiCore.Abstract.Mvc; |
| | | using Gs.Toolbox.ApiCore.Common.Mvc; |
| | | using Gs.Toolbox.ApiCore.Group; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using static Gs.Toolbox.UtilityHelper; |
| | | |
| | | namespace Gs.Sys.Services |
| | | { |
| | | |
| | | /// <summary> |
| | | /// é
置系ç»åæ° |
| | | /// </summary> |
| | | |
| | | [ApiGroup(ApiGroupNames.Sys)] |
| | | public class MesConfigController : IRomteService |
| | | { |
| | | |
| | | private readonly IHttpContextAccessor _http; |
| | | private readonly string _userCode, _userGuid, _orgFids; |
| | | |
| | | public MesConfigController(IHttpContextAccessor httpContextAccessor) |
| | | { |
| | | _http = httpContextAccessor; |
| | | (_userCode, _userGuid, _orgFids) = |
| | | GetUserGuidAndOrgGuid(_http); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<int?> SetModel([FromBody] dynamic model) |
| | | { |
| | | string sql = model.sql; |
| | | int rtnInt = (int)ReturnCode.Default; |
| | | try |
| | | { |
| | | StringBuilder strSql = new StringBuilder(); |
| | | strSql.Append(sql); |
| | | int rows = DbHelperSQL.ExecuteSql(strSql.ToString()); |
| | | rtnInt = rows; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(this.ToString(), "SetSql errorï¼" + ex.Message); |
| | | rtnInt = (int)ReturnCode.Exception; |
| | | return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "å é¤å¤±è´¥ï¼" + ex.Message); |
| | | } |
| | | if (rtnInt > 0) |
| | | return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Success, "æä½æåï¼"); |
| | | else |
| | | return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "å é¤å¤±è´¥ï¼è¯·éè¯ï¼"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读åå®ä½ |
| | | /// </summary> |
| | | /// <param name="guid"></param> |
| | | /// <returns></returns> |
| | | [RequestMethod(RequestMethods.POST)] |
| | | public ReturnDto<System.Dynamic.ExpandoObject> GetModel([FromBody] dynamic model) |
| | | { |
| | | dynamic m = new System.Dynamic.ExpandoObject(); |
| | | m.list = new List<dynamic>(); |
| | | System.Text.StringBuilder sbSql = new StringBuilder(); |
| | | sbSql.Append(" select * from MES_CONFIG"); |
| | | try |
| | | { |
| | | DataSet dset = new DataSet(); |
| | | dset = DbHelperSQL.Query(sbSql.ToString()); |
| | | if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0) |
| | | { |
| | | var _tb = dset.Tables[0].TableToDynamicList(); |
| | | m.list = _tb; |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "读åæåï¼"); |
| | | } |
| | | else |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读å失败ï¼"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Debug(this.ToString(), "GetModel error:" + ex.Message); |
| | | return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读å失败ï¼"); |
| | | } |
| | | } |
| | | } |
| | | } |