You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using AutoMapper;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Txgy.RBS.DbModel.Models;
|
|
|
|
|
using Txgy.RBS.Framework.Api;
|
|
|
|
|
using Txgy.RBS.IServices;
|
|
|
|
|
|
|
|
|
|
namespace Txgy.RBS.Services
|
|
|
|
|
{
|
|
|
|
|
public class GlobalConfigService : BaseService, IGlobalConfigService
|
|
|
|
|
{
|
|
|
|
|
private readonly IMapper _iMapper;
|
|
|
|
|
|
|
|
|
|
public GlobalConfigService(ISqlSugarClient client, IMapper iMapper) : base(client)
|
|
|
|
|
{
|
|
|
|
|
this._iMapper = iMapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ApiResult AddGlobalConfig(GlobalConfigDTO globalConfigDTO)
|
|
|
|
|
{
|
|
|
|
|
int res = 0;
|
|
|
|
|
global_config global_Config = _iMapper.Map<global_config>(globalConfigDTO);
|
|
|
|
|
|
|
|
|
|
res = _Client.Insertable(global_Config).ExecuteCommand();
|
|
|
|
|
if (res > 0)
|
|
|
|
|
{
|
|
|
|
|
return new ApiResult();
|
|
|
|
|
}
|
|
|
|
|
return new ApiResult() { Message = "添加失败" };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<GlobalConfigDTO> GetAllGlobalConfig()
|
|
|
|
|
{
|
|
|
|
|
var global_Config = _Client.Queryable<global_config>().ToList();
|
|
|
|
|
return _iMapper.Map<List<GlobalConfigDTO>>(global_Config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public GlobalConfigDTO GetGlobalConfig(int id)
|
|
|
|
|
{
|
|
|
|
|
return new GlobalConfigDTO();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ApiResult UpdateGlobalConfig(GlobalConfigDTO GlobalConfigDTO)
|
|
|
|
|
{
|
|
|
|
|
global_config global_Config = _iMapper.Map<global_config> (GlobalConfigDTO);
|
|
|
|
|
int res= _Client.Updateable<global_config>(global_Config).ExecuteCommand();
|
|
|
|
|
if(res > 0)
|
|
|
|
|
{
|
|
|
|
|
return new ApiResult();
|
|
|
|
|
}
|
|
|
|
|
return new ApiResult() { Message = "更新失败" };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|