|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- using Learun.DataBase.Repository;
- using Learun.Util;
- using System;
- using System.Collections.Generic;
- using System.Text;
-
- namespace Learun.Application.Base.SystemModule
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创建人:陈彬彬
- /// 日 期:2017.04.01
- /// 描 述:接口管理
- /// </summary>
- public class InterfaceService : RepositoryFactory
- {
- #region 属性 构造函数
- private string fieldSql;
- public InterfaceService()
- {
- fieldSql = @"
- t.F_Id,
- t.F_Name,
- t.F_Address,
- t.F_FieldsJson,
- t.F_CreateDate,
- t.F_CreateUserId,
- t.F_CreateUserName,
- t.F_ModifyDate,
- t.F_ModifyUserId,
- t.F_ModifyUserName
- ";
- }
- #endregion
-
- #region 获取数据
- /// <summary>
- /// 获取列表数据
- /// </summary>
- /// <returns></returns>
- public IEnumerable<InterfaceEntity> GetList()
- {
- try
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT " + fieldSql + " FROM LR_Base_Interface t ");
- return this.BaseRepository().FindList<InterfaceEntity>(strSql.ToString());
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowServiceException(ex);
- }
- }
- }
- #endregion
-
- #region 提交数据
- /// <summary>
- /// 虚拟删除分类数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- public void DeleteEntity(string keyValue)
- {
- try
- {
- this.BaseRepository().Delete<InterfaceEntity>(t => t.F_Id == keyValue);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowServiceException(ex);
- }
- }
- }
- /// <summary>
- /// 保存分类数据实体
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="entity">实体</param>
- public void SaveEntity(string keyValue, InterfaceEntity entity)
- {
- try
- {
- if (string.IsNullOrEmpty(keyValue))
- {
- entity.Create();
- this.BaseRepository().Insert(entity);
- }
- else
- {
- entity.Modify(keyValue);
- this.BaseRepository().Update(entity);
- }
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowServiceException(ex);
- }
- }
- }
- #endregion
- }
- }
|