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.

146 lines
4.7 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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<SysBase>, IBaseManagerService
{
private readonly IBaseManagerRepository repository;
public BaseManagerService(IBaseManagerRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 获取分页数据列表
/// </summary>
/// <param name="PageSize">一页显示多少条数据</param>
/// <param name="PageIndex">当前第几页</param>
/// <param name="strWhere">条件</param>
/// <param name="OrderBy">排序字段</param>
/// <returns></returns>
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;
}
/// <summary>
/// 增加系统参数
/// </summary>
/// <param name="parames"></param>
/// <returns></returns>
public int SaveBase(SysBase parames)
{
return repository.SaveBase(parames);
}
/// <summary>
/// 修改参数
/// </summary>
/// <param name="parames"></param>
/// <returns></returns>
public int EditBase(SysBase parames)
{
return repository.EditBase(parames);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="parame_id"></param>
/// <returns></returns>
public int deleteBase(string parame_id)
{
return repository.deleteBase(parame_id);
}
/// <summary>
/// 启用
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int EnableData(String ids)
{
ids = ids.Substring(0, ids.Length - 1);
return this.repository.EnableData(ids);
}
/// <summary>
/// 禁用
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int DisableData(String ids)
{
ids = ids.Substring(0, ids.Length - 1);
return this.repository.DisableData(ids);
}
/// <summary>
/// 查询系统参数列表
/// </summary>
/// <param name="strWhere"></param>
/// <returns></returns>
public List<SysBase> getBaseList(string strWhere)
{
return repository.getBaseList(strWhere);
}
/// <summary>
/// 根据ID查询系统参数列表
/// </summary>
/// <param name="paramId"></param>
/// <returns></returns>
public List<SysBase> getList(string paramId)
{
return repository.getList(paramId);
}
}
}