示例#1
0
        public MetaNoticeCategoryEntity GetById(int id)
        {
            string sql = "select name as Name, title as Title from `oam_notice_category` where Id = ?";

            using (var mysqlConn = connectionProvider.GetConnection())
            {
                return(mysqlConn.QueryFirstOrDefault <MetaNoticeCategoryEntity>(sql, new { Id = id }));
            }
        }
示例#2
0
        /// <summary>
        /// 根据id获取单个实体
        /// </summary>
        /// <param name="id">实体编号</param>
        /// <returns>实体</returns>
        public NoticeCategoryEntity GetEntityById(int id)
        {
            string sql = @"
select
  id as Id,
  name as Name,
  title as Title,
  remark as Remark,
  data_status as DataStatus,
  create_time as CreateTime,
  last_update_time as LastUpdateTime,
  1 as _
from `oam_notice_category`
where
  id = @Id
  and data_status = 1;";

            using (var mysqlConn = connectionProvider.GetConnection())
            {
                return(mysqlConn.QueryFirstOrDefault <NoticeCategoryEntity>(sql, new { Id = id }));
            }
        }