///<summary>
 /// 用户收藏信息获取
 ///</summary>
 ///<param name="id">用户收藏信息id</param>
 ///<returns></returns>
 public UserFavorite UserFavoriteGet(int id)
 {
     return(Try(nameof(UserFavoriteGet), () =>
     {
         var sql = @"select * from UserFavorite where id=@id";
         var cmd = SqlBuilder.Raw(sql, new { id }).ToCommand();
         return PassportConn.QueryFirstOrDefault <UserFavorite>(cmd);
     }));
 }
 /// <summary>
 /// 用户地址数量获取
 /// </summary>
 /// <param name="userId">用户id</param>
 /// <param name="groupId">地址分组 0为收货地址 2发货地址 3退货地址</param>
 /// <returns></returns>
 public int UserAddressCount(int userId, byte groupId)
 {
     return(Try(nameof(UserAddressGet), () =>
     {
         var sql = @"select count(0) as Count from UserAddress where UserId=@userId and GroupId=@groupId";
         var cmd = SqlBuilder.Raw(sql, new { userId, groupId }).ToCommand();
         return PassportConn.QueryFirstOrDefault <int>(cmd);
     }));
 }
 ///<summary>
 /// 用户地址获取
 ///</summary>
 ///<param name="id">用户地址id</param>
 ///<param name="userId">用户id</param>
 ///<returns></returns>
 public UserAddress UserAddressGet(int id, int userId)
 {
     return(Try(nameof(UserAddressGet), () =>
     {
         var sql = @"select * from UserAddress where Id=@id and UserId=@userId";
         var cmd = SqlBuilder.Raw(sql, new { id, userId }).ToCommand();
         return PassportConn.QueryFirstOrDefault <UserAddress>(cmd);
     }));
 }
 ///<summary>
 /// 用户第三方授权信息更新获取
 ///</summary>
 ///<param name="provider">provider</param>
 ///<param name="openId">openId</param>
 ///<returns></returns>
 public UserOAuth UserOAuthGet(string provider, string openId)
 {
     return(Try(nameof(UserOAuthGet), () =>
     {
         var sql = @"select * from UserOAuth where provider=@provider and  openId=@openId";
         var cmd = SqlBuilder.Raw(sql, new { openId, provider }).ToCommand();
         return PassportConn.QueryFirstOrDefault <UserOAuth>(cmd);
     }));
 }
        /// <summary>
        /// 用户获取
        /// </summary>
        /// <param name="uid">用户名/绑定邮箱/绑定手机号</param>
        /// <param name="password">登录密码</param>
        /// <returns></returns>
        public User UserGet(string uid, string password)
        {
            return(Try(nameof(UserGet), () =>
            {
                var sql = @"select * from user where password=@password and (name=@uid or mobile=@uid or email=@uid)";

                var cmd = SqlBuilder.Raw(sql, new { uid, password }).ToCommand();

                return PassportConn.QueryFirstOrDefault <User>(cmd);
            }));
        }
        /// <summary>
        /// 用户获取
        /// </summary>
        /// <param name="guid">用户guid</param>
        /// <returns></returns>
        public User UserGet(string guid)
        {
            return(Try(nameof(UserGet), () =>
            {
                var sql = @"select * from user where guid=@guid";

                var cmd = SqlBuilder.Raw(sql, new { guid }).ToCommand();

                return PassportConn.QueryFirstOrDefault <User>(cmd);
            }));
        }