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.

112 lines
3.6 KiB
C#

2 years ago
using Estsh.Core.Model.Result;
using Estsh.Core.Models;
using Estsh.Core.Repository.IRepositories;
using Estsh.Core.Services.IServices;
using Estsh.Core.Util;
/***************************************************************************************************
*
* sitong.dong
*
* 2022.06.22
*
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
public class PageFunctionService : BaseService<SysProgramFunOp>, IPageFunctionService
{
private readonly IPageFunctionRepository repository;
public PageFunctionService(IPageFunctionRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页数据列表
/// </summary>
public List<SysProgramFunOp> getListByPage(ref Pager page, string menuName, String enabled)
{
string whereStr = " 1=1";
if (string.IsNullOrEmpty(menuName) == false)
{
whereStr += " and b.name like '%" + menuName + "%'";
}
if (enabled != null && !enabled.Trim().Equals(""))
{
whereStr += " and a.enabled = '" + enabled + "'";
}
return repository.getListByPage(ref page, whereStr);
}
public List<KeyValueResult> GetWebMenuList(string name)
{
string where = string.Empty;
if (string.IsNullOrEmpty(name) == false)
{
where = string.Format("name like '%{0}%'", name);
}
return repository.GetWebMenuList(where);
}
public List<KeyValueResult> GetOpType()
{
return repository.GetOpType();
}
public List<SysProgramFunOp> GetFunctionByRuid(string ruid)
{
List<SysProgramFunOp> dt = null;
if (string.IsNullOrEmpty(ruid) == false)
{
string where = string.Format("ruid='{0}'", ruid);
dt = repository.GetFunction(where);
}
return dt;
}
public bool SaveOp(string where, SysProgramFunOp paramsList)
{
return repository.SaveOp(where, paramsList);
}
public bool AddOp(SysProgramFunOp paramsList)
{
return repository.AddOp(paramsList);
}
public bool ExitOp(string program, string fun_name, string grid_name, string op_name)
{
string where = string.Format(" program='{0}' and fun_name='{1}' and grid_name='{2}' and op_name='{3}'", program, fun_name, grid_name, op_name);
return repository.ExitOp(where);
}
public bool DeleteByRuid(string ruidStr)
{
string where = string.Format("ruid in ({0})", ruidStr);
return repository.Delete(where);
}
/// <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);
}
}
}