157 lines
4.3 KiB
C#
157 lines
4.3 KiB
C#
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
|
||
|
||
}
|
||
}
|