/// <summary> /// 按targetGuid查询数量 /// </summary> /// <param name="targetGuid">目标GUID</param> /// <param name="enable">是否启用</param> /// <returns></returns> public int GetListCountByTarget(string targetGuid, bool enable = true) { string sqlstring = "SELECT count(1) FROM t_consumer_collection where target_guid=@target_guid and enable=1"; DynamicParameters parameters = new DynamicParameters(); parameters.Add("target_guid", targetGuid, System.Data.DbType.String); using (MySql.Data.MySqlClient.MySqlConnection conn = MySqlHelper.GetConnection()) { return(conn.QuerySingle <int?>(sqlstring, parameters) ?? 0); } }