157 lines
4.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Learun.Util;
using Learun.Util.SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
namespace Learun.Application.Base.SystemModule
{
/// <summary>
/// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
/// Copyright (c) 2013-2018 Hexagon PPM
/// 创 建:超级管理员
/// 日 期2018-07-30 14:53
/// 描 述logo设置
/// </summary>
public class LogoImgService
{
#region
Repository<LogoImgEntity> _logoImgRepository => new Repository<LogoImgEntity>();
#endregion
#region
private string fieldSql;
public LogoImgService()
{
fieldSql = @"
t.F_Code,
t.F_FileName
";
}
#endregion
#region
/// <summary>
/// 获取列表数据
/// <summary>
/// <returns></returns>
public IEnumerable<LogoImgEntity> GetList(string queryJson)
{
try
{
//参考写法
//var queryParam = queryJson.ToJObject();
// 虚拟参数
//var dp = new DynamicParameters(new { });
//dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append(fieldSql);
strSql.Append(" FROM LR_Base_Logo t ");
//return this.BaseRepository().FindList<LogoImgEntity>(strSql.ToString());
return SqlSugarHelper.Db.SqlQueryable<LogoImgEntity>(strSql.ToString()).ToList();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 获取实体数据
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
public LogoImgEntity GetEntity(string keyValue)
{
try
{
return _logoImgRepository.GetById(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion
#region
/// <summary>
/// 删除实体数据
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
public void DeleteEntity(string keyValue)
{
try
{
_logoImgRepository.Delete(t => t.F_Code == keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 保存实体数据(新增、修改)
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
public void SaveEntity(LogoImgEntity entity)
{
try
{
LogoImgEntity entityTmp = _logoImgRepository.GetById(entity.F_Code);
if (entityTmp != null)
{
entity.Modify(entity.F_Code);
_logoImgRepository.Update(entity);
}
else
{
entity.Create();
_logoImgRepository.Insert(entity);
}
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion
}
}