Ejemplo n.º 1
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="query"></param>
 /// <returns></returns>
 public static List <T> BaseGetListByParam <T>(BaseQuery query)
 {
     using (IDbConnection conn = new SqlConnection(ConnString))
     {
         conn.Open();
         List <T> item = conn.Query <T>(query.Sql, query.Obj).ToList();
         conn.Close();
         return(item);
     }
 }
Ejemplo n.º 2
0
 public static int BaseGetCountByParam(BaseQuery query)
 {
     using (IDbConnection conn = new SqlConnection(ConnString))
     {
         conn.Open();
         int count = conn.QueryFirst(query.Sql, query.Obj);
         conn.Close();
         return(count);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="query"></param>
 /// <returns></returns>
 public static T BaseGetByParam <T>(BaseQuery query)
 {
     using (IDbConnection conn = new SqlConnection(ConnString))
     {
         conn.Open();
         T item = conn.Query <T>(query.Sql, query.Obj).FirstOrDefault();
         conn.Close();
         return(item);
     }
 }