using System.Data; using System.Collections; using System.Text; using Estsh.Core.Models; using Estsh.Core.IServices; using Estsh.Core.Repository.IRepositories; using Estsh.Core.Services.IServices; using Estsh.Core.Util; using Estsh.Core.Services; using Estsh.Core.Dapper; /*************************************************************************************************** * * 更新人:sitong.dong * 描述: * 修改时间:2022.06.22 * 修改日志:系统迭代升级 * **************************************************************************************************/ namespace Estsh.Core.Repositories { public class BaseManagerService : BaseService, IBaseManagerService { private readonly IBaseManagerRepository repository; public BaseManagerService(IBaseManagerRepository _repository) : base(_repository) { repository = _repository; } /// /// 获取分页数据列表 /// /// 一页显示多少条数据 /// 当前第几页 /// 条件 /// 排序字段 /// public Hashtable getListByPage(int PageSize, int PageIndex, string strWhere, string OrderBy) { Hashtable result = new Hashtable(); result = repository.getListByPage(PageSize, PageIndex, strWhere, OrderBy); return result; } public Hashtable getListByPage(String BaseValue, String BaseName, String enabled, Pager pager, String direction, String sort) { String strWhere = " 1=1 "; Hashtable result = new Hashtable(); if (BaseValue != null && !BaseValue.Trim().Equals("")) { strWhere += " and base_value like '%" + BaseValue.Trim() + "%'"; } if (BaseName != null && !BaseName.Trim().Equals("")) { strWhere += " and base_name like '%" + BaseName.Trim() + "%'"; } if (enabled != null && !enabled.Trim().Equals("")) { strWhere += " and enabled like '%" + enabled.Trim() + "%'"; } String orderBy = ""; if (sort != null && !"".Equals(sort.Trim())) { orderBy += typeof(SysBase).GetEntityColumnName(sort.Trim()) + " " + direction; } else { orderBy += typeof(SysBase).GetEntityColumnName("ParamId") + " " + direction; } result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy); return result; } /// /// 增加系统参数 /// /// /// public int SaveBase(SysBase parames) { return repository.SaveBase(parames); } /// /// 修改参数 /// /// /// public int EditBase(SysBase parames) { return repository.EditBase(parames); } /// /// 删除 /// /// /// public int deleteBase(string parame_id) { return repository.deleteBase(parame_id); } /// /// 启用 /// /// /// public int EnableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.EnableData(ids); } /// /// 禁用 /// /// /// public int DisableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.DisableData(ids); } /// /// 查询系统参数列表 /// /// /// public List getBaseList(string strWhere) { return repository.getBaseList(strWhere); } /// /// 根据ID查询系统参数列表 /// /// /// public List getList(string paramId) { return repository.getList(paramId); } } }