using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;
using Dapper;
using PushPlatform.Data;

namespace PushPlatform.Data.DaoAchieve
{
    sealed partial class SysPushDaoAchieve
    {
        
        
        
        
        #region Dao
        public int Save(SysPush entity)
        {
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                var result = connection.Execute("Insert into sys_push values (@Id,@PushSys_ProId,@Name_Des,@Push_Target,@Push_Style,@Push_Title,@Push_Body,@Push_Type,@Push_Cycle,@Push_Month,@Push_Which,@Push_Action,@Push_ActionType,@Push_IosLink,@Push_AndLink,@Push_WebLink,@Push_WechatLink,@Db_ConnectId,@Push_User_Action,@Push_User_ActionType,@Db_User_ConnectId,@Is_Deleted,@Create_User,@Create_Time,@Update_User,@Update_Time,@Timestamp)",
                                   entity);
                return result;
            }
        }
        
        public int Save(List<SysPush> entityList)
        {
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                var result = connection.Execute("Insert into sys_push values (@Id,@PushSys_ProId,@Name_Des,@Push_Target,@Push_Style,@Push_Title,@Push_Body,@Push_Type,@Push_Cycle,@Push_Month,@Push_Which,@Push_Action,@Push_ActionType,@Push_IosLink,@Push_AndLink,@Push_WebLink,@Push_WechatLink,@Db_ConnectId,@Push_User_Action,@Push_User_ActionType,@Db_User_ConnectId,@Is_Deleted,@Create_User,@Create_Time,@Update_User,@Update_Time,@Timestamp)",
                                   entityList);
                return result;
            }
        }
        
        
        public int Delete(string id)
        {
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                var result = connection.Execute("delete from sys_push where Id=@id",
                                   new { id = id });
                return result;
            }
        }
        
        public int Update(SysPush entity)
        {
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                var result = connection.Execute("update sys_push set PushSys_ProId=@PushSys_ProId,Name_Des=@Name_Des,Push_Target=@Push_Target,Push_Style=@Push_Style,Push_Title=@Push_Title,Push_Body=@Push_Body,Push_Type=@Push_Type,Push_Cycle=@Push_Cycle,Push_Month=@Push_Month,Push_Which=@Push_Which,Push_Action=@Push_Action,Push_ActionType=@Push_ActionType,Push_IosLink=@Push_IosLink,Push_AndLink=@Push_AndLink,Push_WebLink=@Push_WebLink,Push_WechatLink=@Push_WechatLink,Db_ConnectId=@Db_ConnectId,Push_User_Action=@Push_User_Action,Push_User_ActionType=@Push_User_ActionType,Db_User_ConnectId=@Db_User_ConnectId,Is_Deleted=@Is_Deleted,Create_User=@Create_User,Create_Time=@Create_Time,Update_User=@Update_User,Update_Time=@Update_Time,Timestamp=@Timestamp where Id=@id",
                                   entity);
                return result;
            }
        }
        
        public int Update(List<SysPush> entityList)
        {
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                var result = connection.Execute("update sys_push set PushSys_ProId=@PushSys_ProId,Name_Des=@Name_Des,Push_Target=@Push_Target,Push_Style=@Push_Style,Push_Title=@Push_Title,Push_Body=@Push_Body,Push_Type=@Push_Type,Push_Cycle=@Push_Cycle,Push_Month=@Push_Month,Push_Which=@Push_Which,Push_Action=@Push_Action,Push_ActionType=@Push_ActionType,Push_IosLink=@Push_IosLink,Push_AndLink=@Push_AndLink,Push_WebLink=@Push_WebLink,Push_WechatLink=@Push_WechatLink,Db_ConnectId=@Db_ConnectId,Push_User_Action=@Push_User_Action,Push_User_ActionType=@Push_User_ActionType,Db_User_ConnectId=@Db_User_ConnectId,Is_Deleted=@Is_Deleted,Create_User=@Create_User,Create_Time=@Create_Time,Update_User=@Update_User,Update_Time=@Update_Time,Timestamp=@Timestamp where Id=@id",
                                   entityList);
                return result;
            }
        }
        
        public int SaveOrUpdate(IList<SysPush> entityList)
        {
            if (entityList == null || entityList.Count == 0)
                return 0;
            List<SysPush> saveList = new List<SysPush>();
            List<SysPush> updateList = new List<SysPush>();
            foreach(var entity in entityList)
            {
                if(entity.IsEdit)
                {
                    updateList.Add(entity);
                }
                else
                {
                    saveList.Add(entity);
                }
            }
            int save = 0;
            int update = 0;
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
		connection.Open();
                IDbTransaction transaction = connection.BeginTransaction();
                try
                {
                    if (updateList.Count > 0)
                    {
                        update = connection.Execute("update sys_push set PushSys_ProId=@PushSys_ProId,Name_Des=@Name_Des,Push_Target=@Push_Target,Push_Style=@Push_Style,Push_Title=@Push_Title,Push_Body=@Push_Body,Push_Type=@Push_Type,Push_Cycle=@Push_Cycle,Push_Month=@Push_Month,Push_Which=@Push_Which,Push_Action=@Push_Action,Push_ActionType=@Push_ActionType,Push_IosLink=@Push_IosLink,Push_AndLink=@Push_AndLink,Push_WebLink=@Push_WebLink,Push_WechatLink=@Push_WechatLink,Db_ConnectId=@Db_ConnectId,Push_User_Action=@Push_User_Action,Push_User_ActionType=@Push_User_ActionType,Db_User_ConnectId=@Db_User_ConnectId,Is_Deleted=@Is_Deleted,Create_User=@Create_User,Create_Time=@Create_Time,Update_User=@Update_User,Update_Time=@Update_Time,Timestamp=@Timestamp where Id=@id",
                                       updateList, transaction, null, null);
                    }
                    if (saveList.Count > 0)
                    {
                        save = connection.Execute("Insert into sys_push values (@Id,@PushSys_ProId,@Name_Des,@Push_Target,@Push_Style,@Push_Title,@Push_Body,@Push_Type,@Push_Cycle,@Push_Month,@Push_Which,@Push_Action,@Push_ActionType,@Push_IosLink,@Push_AndLink,@Push_WebLink,@Push_WechatLink,@Db_ConnectId,@Push_User_Action,@Push_User_ActionType,@Db_User_ConnectId,@Is_Deleted,@Create_User,@Create_Time,@Update_User,@Update_Time,@Timestamp)",
                                       saveList, transaction, null, null);
                    }
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw new Exception(ex.Message);
                }
                return save + update;
            }
        }
        
        public int SaveOrUpdateWithTran(IList<SysPush> entityList, IDbConnection connection, IDbTransaction transaction)
        {
            if (entityList == null || entityList.Count == 0)
                return 0;
            List<SysPush> saveList = new List<SysPush>();
            List<SysPush> updateList = new List<SysPush>();
            foreach(var entity in entityList)
            {
                if(entity.IsEdit)
                {
                    updateList.Add(entity);
                }
                else
                {
                    saveList.Add(entity);
                }
            }
            int save = 0;
            int update = 0;
            if (updateList.Count > 0)
            {
                update = connection.Execute("update sys_push set PushSys_ProId=@PushSys_ProId,Name_Des=@Name_Des,Push_Target=@Push_Target,Push_Style=@Push_Style,Push_Title=@Push_Title,Push_Body=@Push_Body,Push_Type=@Push_Type,Push_Cycle=@Push_Cycle,Push_Month=@Push_Month,Push_Which=@Push_Which,Push_Action=@Push_Action,Push_ActionType=@Push_ActionType,Push_IosLink=@Push_IosLink,Push_AndLink=@Push_AndLink,Push_WebLink=@Push_WebLink,Push_WechatLink=@Push_WechatLink,Db_ConnectId=@Db_ConnectId,Push_User_Action=@Push_User_Action,Push_User_ActionType=@Push_User_ActionType,Db_User_ConnectId=@Db_User_ConnectId,Is_Deleted=@Is_Deleted,Create_User=@Create_User,Create_Time=@Create_Time,Update_User=@Update_User,Update_Time=@Update_Time,Timestamp=@Timestamp where Id=@id",
                               updateList, transaction, null, null);
            }
            if (saveList.Count > 0)
            {
                save = connection.Execute("Insert into sys_push values (@Id,@PushSys_ProId,@Name_Des,@Push_Target,@Push_Style,@Push_Title,@Push_Body,@Push_Type,@Push_Cycle,@Push_Month,@Push_Which,@Push_Action,@Push_ActionType,@Push_IosLink,@Push_AndLink,@Push_WebLink,@Push_WechatLink,@Db_ConnectId,@Push_User_Action,@Push_User_ActionType,@Db_User_ConnectId,@Is_Deleted,@Create_User,@Create_Time,@Update_User,@Update_Time,@Timestamp)",
                               saveList, transaction, null, null);
            }
            return save + update;
        }
        
        public SysPush Get(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return null;
            }
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                var query = connection.Query<SysPush>("select * from sys_push where Id=@id", new { id = id });
                if (query.Count() > 0)
                    return query.FirstOrDefault();
                return null;
            }
        }
        
        public int GetCount(PushPlatform.Data.Criteria.CriteriaSysPush mycriteria)
        {
            if(mycriteria.UsePage && (mycriteria.PageIndex <= 0 || mycriteria.PageSize < 1))
            {
                mycriteria.PageTotal = 0;
                return 0;
            }
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                if (mycriteria.UserWhere)
                {
                    if (mycriteria.WhereValue != null)
                    {
                        return connection.Query<int>("select count(1) from sys_push " + mycriteria.Where, mycriteria.WhereValue).FirstOrDefault();
                    }
                    else
                    {
                        return connection.Query<int>("select count(1) from sys_push " + mycriteria.Where).FirstOrDefault();
                    }
                }
                else
                {
                    return connection.Query<int>("select count(1) from sys_push " + CreatAutoQuery(mycriteria)).FirstOrDefault(); 
                }
            }
        }
        
        public List<SysPush> Fetch(PushPlatform.Data.Criteria.CriteriaSysPush mycriteria)
        {
            if(mycriteria.UsePage && (mycriteria.PageIndex <= 0 || mycriteria.PageSize < 1))
            {
                mycriteria.PageTotal = 0;
                return new List<SysPush>();
            }
            string orderby = "";
            foreach(var order in mycriteria.OrderList)
            {
                if(orderby=="")
                {
                    orderby = " order by ";
                }
                orderby += order+",";
            }
            if(orderby.Length>0)
            {
                orderby = orderby.Substring(0, orderby.Length - 1);
                if(!mycriteria.IsAsc)
                {
                    orderby += " desc ";
                }
            }
            int pageStart = (mycriteria.PageIndex - 1) * mycriteria.PageSize;
            using(IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                if (mycriteria.UserWhere)
                {
                    if(mycriteria.UsePage)
                    {
                        if (mycriteria.WhereValue != null)
                        {
                            mycriteria.PageTotal = connection.Query<int>("select count(1) from sys_push " + mycriteria.Where + orderby, mycriteria.WhereValue).FirstOrDefault();
                            var query = connection.Query<SysPush>("select * from sys_push " + mycriteria.Where + orderby + " LIMIT " + pageStart.ToString() + "," + mycriteria.PageSize, mycriteria.WhereValue);
                            return query.ToList();
                        }
                        else
                        {
                            mycriteria.PageTotal = connection.Query<int>("select count(1) from sys_push " + mycriteria.Where + orderby).FirstOrDefault();
                            var query = connection.Query<SysPush>("select * from sys_push " + mycriteria.Where + orderby + " LIMIT " + pageStart.ToString() + "," + mycriteria.PageSize);
                            return query.ToList();
                        }
                    }
                    else
                    {
                        if (mycriteria.WhereValue != null)
                        {
                            var query = connection.Query<SysPush>("select * from sys_push " + mycriteria.Where + orderby, mycriteria.WhereValue);
                            return query.ToList();
                        }
                        else
                        {
                            var query = connection.Query<SysPush>("select * from sys_push " + mycriteria.Where + orderby);
                            return query.ToList();
                        }
                    }
                }
                else
                {
                    if (mycriteria.UsePage)
                    {
                        string whereStr=CreatAutoQuery(mycriteria);
                        mycriteria.PageTotal = connection.Query<int>("select count(1) from sys_push " + whereStr).FirstOrDefault();
                        string queryStr = "select * from sys_push ";
                        queryStr += whereStr + orderby;
                        queryStr += " LIMIT " + pageStart.ToString() + "," + mycriteria.PageSize;
                        var query = connection.Query<SysPush>(queryStr);
                        return query.ToList();
                    }
                    else
                    {
                        string queryStr = "select * from sys_push ";
                        queryStr += CreatAutoQuery(mycriteria) + orderby;
                        var query = connection.Query<SysPush>(queryStr);
                        return query.ToList();
                    }  
                }
            }
        }
        #endregion
        
        #region method
        private string CreatAutoQuery(Criteria.CriteriaSysPush mycriteria)
        {
            string where = "";
            
            if (!string.IsNullOrEmpty(mycriteria.LikeId))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Id like '%" + mycriteria.LikeId + "%'";
            }
            if (mycriteria.InId.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InId)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Id in (" + instr + ")";
            }
            if (mycriteria.NotId.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotId)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Id not in (" + instr + ")";
            }
            if (mycriteria.OrEqId.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqId)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Id='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikeId.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikeId)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Id like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqId))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Id ='" + mycriteria.EqId + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NeId))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Id <>'" + mycriteria.NeId + "'";
            }
            if (mycriteria.NullId)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Id is null"; 
            }
            if (mycriteria.NotNullId)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Id is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushsysProid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " PushSys_ProId like '%" + mycriteria.LikePushsysProid + "%'";
            }
            if (mycriteria.InPushsysProid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushsysProid)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " PushSys_ProId in (" + instr + ")";
            }
            if (mycriteria.NotPushsysProid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushsysProid)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "PushSys_ProId not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushsysProid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushsysProid)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "PushSys_ProId='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushsysProid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushsysProid)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "PushSys_ProId like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushsysProid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "PushSys_ProId ='" + mycriteria.EqPushsysProid + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushsysProid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "PushSys_ProId <>'" + mycriteria.NePushsysProid + "'";
            }
            if (mycriteria.NullPushsysProid)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " PushSys_ProId is null"; 
            }
            if (mycriteria.NotNullPushsysProid)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " PushSys_ProId is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikeNameDes))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Name_Des like '%" + mycriteria.LikeNameDes + "%'";
            }
            if (mycriteria.InNameDes.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InNameDes)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Name_Des in (" + instr + ")";
            }
            if (mycriteria.NotNameDes.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotNameDes)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Name_Des not in (" + instr + ")";
            }
            if (mycriteria.OrEqNameDes.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqNameDes)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Name_Des='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikeNameDes.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikeNameDes)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Name_Des like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqNameDes))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Name_Des ='" + mycriteria.EqNameDes + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NeNameDes))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Name_Des <>'" + mycriteria.NeNameDes + "'";
            }
            if (mycriteria.NullNameDes)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Name_Des is null"; 
            }
            if (mycriteria.NotNullNameDes)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Name_Des is not null";
            }
            if (mycriteria.InPushTarget.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushTarget)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Target in (" + instr + ")";
            }
            if (mycriteria.NotPushTarget.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushTarget)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Target not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushTarget.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushTarget)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Target="+str.ToString()+" or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.EqPushTarget!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Target =" + mycriteria.EqPushTarget;
            }
            if (mycriteria.NePushTarget!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Target <>" + mycriteria.NePushTarget;
            }
            if (mycriteria.LePushTarget!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Target <=" + mycriteria.LePushTarget;
            }
            if (mycriteria.GePushTarget!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Target >=" + mycriteria.GePushTarget;
            }
            if (mycriteria.LtPushTarget!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Target <" + mycriteria.LtPushTarget;
            }
            if (mycriteria.GtPushTarget!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Target >" + mycriteria.GtPushTarget;
            }
            if (mycriteria.NullPushTarget)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Target is null"; 
            }
            if (mycriteria.NotNullPushTarget)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Target is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushStyle))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Style like '%" + mycriteria.LikePushStyle + "%'";
            }
            if (mycriteria.InPushStyle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushStyle)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Style in (" + instr + ")";
            }
            if (mycriteria.NotPushStyle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushStyle)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Style not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushStyle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushStyle)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Style='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushStyle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushStyle)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Style like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushStyle))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Style ='" + mycriteria.EqPushStyle + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushStyle))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Style <>'" + mycriteria.NePushStyle + "'";
            }
            if (mycriteria.NullPushStyle)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Style is null"; 
            }
            if (mycriteria.NotNullPushStyle)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Style is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushTitle))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Title like '%" + mycriteria.LikePushTitle + "%'";
            }
            if (mycriteria.InPushTitle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushTitle)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Title in (" + instr + ")";
            }
            if (mycriteria.NotPushTitle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushTitle)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Title not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushTitle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushTitle)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Title='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushTitle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushTitle)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Title like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushTitle))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Title ='" + mycriteria.EqPushTitle + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushTitle))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Title <>'" + mycriteria.NePushTitle + "'";
            }
            if (mycriteria.NullPushTitle)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Title is null"; 
            }
            if (mycriteria.NotNullPushTitle)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Title is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushBody))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Body like '%" + mycriteria.LikePushBody + "%'";
            }
            if (mycriteria.InPushBody.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushBody)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Body in (" + instr + ")";
            }
            if (mycriteria.NotPushBody.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushBody)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Body not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushBody.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushBody)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Body='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushBody.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushBody)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Body like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushBody))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Body ='" + mycriteria.EqPushBody + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushBody))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Body <>'" + mycriteria.NePushBody + "'";
            }
            if (mycriteria.NullPushBody)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Body is null"; 
            }
            if (mycriteria.NotNullPushBody)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Body is not null";
            }
            if (mycriteria.InPushType.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushType)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Type in (" + instr + ")";
            }
            if (mycriteria.NotPushType.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushType)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Type not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushType.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushType)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Type="+str.ToString()+" or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.EqPushType!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Type =" + mycriteria.EqPushType;
            }
            if (mycriteria.NePushType!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Type <>" + mycriteria.NePushType;
            }
            if (mycriteria.LePushType!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Type <=" + mycriteria.LePushType;
            }
            if (mycriteria.GePushType!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Type >=" + mycriteria.GePushType;
            }
            if (mycriteria.LtPushType!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Type <" + mycriteria.LtPushType;
            }
            if (mycriteria.GtPushType!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Type >" + mycriteria.GtPushType;
            }
            if (mycriteria.NullPushType)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Type is null"; 
            }
            if (mycriteria.NotNullPushType)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Type is not null";
            }
            if (mycriteria.InPushCycle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushCycle)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Cycle in (" + instr + ")";
            }
            if (mycriteria.NotPushCycle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushCycle)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Cycle not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushCycle.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushCycle)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Cycle="+str.ToString()+" or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.EqPushCycle!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Cycle =" + mycriteria.EqPushCycle;
            }
            if (mycriteria.NePushCycle!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Cycle <>" + mycriteria.NePushCycle;
            }
            if (mycriteria.LePushCycle!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Cycle <=" + mycriteria.LePushCycle;
            }
            if (mycriteria.GePushCycle!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Cycle >=" + mycriteria.GePushCycle;
            }
            if (mycriteria.LtPushCycle!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Cycle <" + mycriteria.LtPushCycle;
            }
            if (mycriteria.GtPushCycle!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Cycle >" + mycriteria.GtPushCycle;
            }
            if (mycriteria.NullPushCycle)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Cycle is null"; 
            }
            if (mycriteria.NotNullPushCycle)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Cycle is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushMonth))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Month like '%" + mycriteria.LikePushMonth + "%'";
            }
            if (mycriteria.InPushMonth.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushMonth)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Month in (" + instr + ")";
            }
            if (mycriteria.NotPushMonth.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushMonth)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Month not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushMonth.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushMonth)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Month='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushMonth.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushMonth)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Month like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushMonth))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Month ='" + mycriteria.EqPushMonth + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushMonth))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Month <>'" + mycriteria.NePushMonth + "'";
            }
            if (mycriteria.NullPushMonth)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Month is null"; 
            }
            if (mycriteria.NotNullPushMonth)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Month is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushWhich))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Which like '%" + mycriteria.LikePushWhich + "%'";
            }
            if (mycriteria.InPushWhich.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushWhich)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Which in (" + instr + ")";
            }
            if (mycriteria.NotPushWhich.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushWhich)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Which not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushWhich.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushWhich)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Which='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushWhich.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushWhich)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Which like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushWhich))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Which ='" + mycriteria.EqPushWhich + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushWhich))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Which <>'" + mycriteria.NePushWhich + "'";
            }
            if (mycriteria.NullPushWhich)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Which is null"; 
            }
            if (mycriteria.NotNullPushWhich)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Which is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushAction))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Action like '%" + mycriteria.LikePushAction + "%'";
            }
            if (mycriteria.InPushAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushAction)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_Action in (" + instr + ")";
            }
            if (mycriteria.NotPushAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushAction)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_Action not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushAction)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Action='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushAction)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_Action like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushAction))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Action ='" + mycriteria.EqPushAction + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushAction))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_Action <>'" + mycriteria.NePushAction + "'";
            }
            if (mycriteria.NullPushAction)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Action is null"; 
            }
            if (mycriteria.NotNullPushAction)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_Action is not null";
            }
            if (mycriteria.InPushActiontype.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushActiontype)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_ActionType in (" + instr + ")";
            }
            if (mycriteria.NotPushActiontype.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushActiontype)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_ActionType not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushActiontype.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushActiontype)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_ActionType="+str.ToString()+" or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.EqPushActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_ActionType =" + mycriteria.EqPushActiontype;
            }
            if (mycriteria.NePushActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_ActionType <>" + mycriteria.NePushActiontype;
            }
            if (mycriteria.LePushActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_ActionType <=" + mycriteria.LePushActiontype;
            }
            if (mycriteria.GePushActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_ActionType >=" + mycriteria.GePushActiontype;
            }
            if (mycriteria.LtPushActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_ActionType <" + mycriteria.LtPushActiontype;
            }
            if (mycriteria.GtPushActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_ActionType >" + mycriteria.GtPushActiontype;
            }
            if (mycriteria.NullPushActiontype)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_ActionType is null"; 
            }
            if (mycriteria.NotNullPushActiontype)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_ActionType is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushIoslink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_IosLink like '%" + mycriteria.LikePushIoslink + "%'";
            }
            if (mycriteria.InPushIoslink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushIoslink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_IosLink in (" + instr + ")";
            }
            if (mycriteria.NotPushIoslink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushIoslink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_IosLink not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushIoslink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushIoslink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_IosLink='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushIoslink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushIoslink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_IosLink like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushIoslink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_IosLink ='" + mycriteria.EqPushIoslink + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushIoslink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_IosLink <>'" + mycriteria.NePushIoslink + "'";
            }
            if (mycriteria.NullPushIoslink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_IosLink is null"; 
            }
            if (mycriteria.NotNullPushIoslink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_IosLink is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushAndlink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_AndLink like '%" + mycriteria.LikePushAndlink + "%'";
            }
            if (mycriteria.InPushAndlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushAndlink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_AndLink in (" + instr + ")";
            }
            if (mycriteria.NotPushAndlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushAndlink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_AndLink not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushAndlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushAndlink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_AndLink='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushAndlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushAndlink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_AndLink like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushAndlink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_AndLink ='" + mycriteria.EqPushAndlink + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushAndlink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_AndLink <>'" + mycriteria.NePushAndlink + "'";
            }
            if (mycriteria.NullPushAndlink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_AndLink is null"; 
            }
            if (mycriteria.NotNullPushAndlink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_AndLink is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushWeblink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_WebLink like '%" + mycriteria.LikePushWeblink + "%'";
            }
            if (mycriteria.InPushWeblink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushWeblink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_WebLink in (" + instr + ")";
            }
            if (mycriteria.NotPushWeblink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushWeblink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_WebLink not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushWeblink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushWeblink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_WebLink='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushWeblink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushWeblink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_WebLink like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushWeblink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_WebLink ='" + mycriteria.EqPushWeblink + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushWeblink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_WebLink <>'" + mycriteria.NePushWeblink + "'";
            }
            if (mycriteria.NullPushWeblink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_WebLink is null"; 
            }
            if (mycriteria.NotNullPushWeblink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_WebLink is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushWechatlink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_WechatLink like '%" + mycriteria.LikePushWechatlink + "%'";
            }
            if (mycriteria.InPushWechatlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushWechatlink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_WechatLink in (" + instr + ")";
            }
            if (mycriteria.NotPushWechatlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushWechatlink)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_WechatLink not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushWechatlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushWechatlink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_WechatLink='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushWechatlink.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushWechatlink)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_WechatLink like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushWechatlink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_WechatLink ='" + mycriteria.EqPushWechatlink + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushWechatlink))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_WechatLink <>'" + mycriteria.NePushWechatlink + "'";
            }
            if (mycriteria.NullPushWechatlink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_WechatLink is null"; 
            }
            if (mycriteria.NotNullPushWechatlink)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_WechatLink is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikeDbConnectid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Db_ConnectId like '%" + mycriteria.LikeDbConnectid + "%'";
            }
            if (mycriteria.InDbConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InDbConnectid)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Db_ConnectId in (" + instr + ")";
            }
            if (mycriteria.NotDbConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotDbConnectid)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Db_ConnectId not in (" + instr + ")";
            }
            if (mycriteria.OrEqDbConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqDbConnectid)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Db_ConnectId='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikeDbConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikeDbConnectid)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Db_ConnectId like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqDbConnectid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Db_ConnectId ='" + mycriteria.EqDbConnectid + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NeDbConnectid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Db_ConnectId <>'" + mycriteria.NeDbConnectid + "'";
            }
            if (mycriteria.NullDbConnectid)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Db_ConnectId is null"; 
            }
            if (mycriteria.NotNullDbConnectid)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Db_ConnectId is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikePushUserAction))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_User_Action like '%" + mycriteria.LikePushUserAction + "%'";
            }
            if (mycriteria.InPushUserAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushUserAction)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_User_Action in (" + instr + ")";
            }
            if (mycriteria.NotPushUserAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushUserAction)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_User_Action not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushUserAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushUserAction)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_User_Action='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikePushUserAction.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikePushUserAction)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_User_Action like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqPushUserAction))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_Action ='" + mycriteria.EqPushUserAction + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NePushUserAction))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_Action <>'" + mycriteria.NePushUserAction + "'";
            }
            if (mycriteria.NullPushUserAction)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_User_Action is null"; 
            }
            if (mycriteria.NotNullPushUserAction)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_User_Action is not null";
            }
            if (mycriteria.InPushUserActiontype.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InPushUserActiontype)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Push_User_ActionType in (" + instr + ")";
            }
            if (mycriteria.NotPushUserActiontype.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotPushUserActiontype)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Push_User_ActionType not in (" + instr + ")";
            }
            if (mycriteria.OrEqPushUserActiontype.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqPushUserActiontype)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Push_User_ActionType="+str.ToString()+" or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.EqPushUserActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_ActionType =" + mycriteria.EqPushUserActiontype;
            }
            if (mycriteria.NePushUserActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_ActionType <>" + mycriteria.NePushUserActiontype;
            }
            if (mycriteria.LePushUserActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_ActionType <=" + mycriteria.LePushUserActiontype;
            }
            if (mycriteria.GePushUserActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_ActionType >=" + mycriteria.GePushUserActiontype;
            }
            if (mycriteria.LtPushUserActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_ActionType <" + mycriteria.LtPushUserActiontype;
            }
            if (mycriteria.GtPushUserActiontype!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Push_User_ActionType >" + mycriteria.GtPushUserActiontype;
            }
            if (mycriteria.NullPushUserActiontype)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_User_ActionType is null"; 
            }
            if (mycriteria.NotNullPushUserActiontype)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Push_User_ActionType is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikeDbUserConnectid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Db_User_ConnectId like '%" + mycriteria.LikeDbUserConnectid + "%'";
            }
            if (mycriteria.InDbUserConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InDbUserConnectid)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Db_User_ConnectId in (" + instr + ")";
            }
            if (mycriteria.NotDbUserConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotDbUserConnectid)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Db_User_ConnectId not in (" + instr + ")";
            }
            if (mycriteria.OrEqDbUserConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqDbUserConnectid)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Db_User_ConnectId='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikeDbUserConnectid.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikeDbUserConnectid)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Db_User_ConnectId like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqDbUserConnectid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Db_User_ConnectId ='" + mycriteria.EqDbUserConnectid + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NeDbUserConnectid))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Db_User_ConnectId <>'" + mycriteria.NeDbUserConnectid + "'";
            }
            if (mycriteria.NullDbUserConnectid)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Db_User_ConnectId is null"; 
            }
            if (mycriteria.NotNullDbUserConnectid)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Db_User_ConnectId is not null";
            }
            if (mycriteria.InIsDeleted.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InIsDeleted)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Is_Deleted in (" + instr + ")";
            }
            if (mycriteria.NotIsDeleted.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotIsDeleted)
                {
                    instr += str.ToString()+",";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Is_Deleted not in (" + instr + ")";
            }
            if (mycriteria.OrEqIsDeleted.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqIsDeleted)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Is_Deleted="+str.ToString()+" or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.EqIsDeleted!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Is_Deleted =" + mycriteria.EqIsDeleted;
            }
            if (mycriteria.NeIsDeleted!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Is_Deleted <>" + mycriteria.NeIsDeleted;
            }
            if (mycriteria.LeIsDeleted!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Is_Deleted <=" + mycriteria.LeIsDeleted;
            }
            if (mycriteria.GeIsDeleted!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Is_Deleted >=" + mycriteria.GeIsDeleted;
            }
            if (mycriteria.LtIsDeleted!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Is_Deleted <" + mycriteria.LtIsDeleted;
            }
            if (mycriteria.GtIsDeleted!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Is_Deleted >" + mycriteria.GtIsDeleted;
            }
            if (mycriteria.NullIsDeleted)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Is_Deleted is null"; 
            }
            if (mycriteria.NotNullIsDeleted)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Is_Deleted is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikeCreateUser))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Create_User like '%" + mycriteria.LikeCreateUser + "%'";
            }
            if (mycriteria.InCreateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InCreateUser)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Create_User in (" + instr + ")";
            }
            if (mycriteria.NotCreateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotCreateUser)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Create_User not in (" + instr + ")";
            }
            if (mycriteria.OrEqCreateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqCreateUser)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Create_User='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikeCreateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikeCreateUser)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Create_User like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqCreateUser))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_User ='" + mycriteria.EqCreateUser + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NeCreateUser))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_User <>'" + mycriteria.NeCreateUser + "'";
            }
            if (mycriteria.NullCreateUser)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Create_User is null"; 
            }
            if (mycriteria.NotNullCreateUser)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Create_User is not null";
            }
            if (mycriteria.EqCreateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_Time =" + mycriteria.EqCreateTime;
            }
            if (mycriteria.NeCreateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_Time <>" + mycriteria.NeCreateTime;
            }
            if (mycriteria.LeCreateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_Time <='" + mycriteria.LeCreateTime + "'";
            }
            if (mycriteria.GeCreateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_Time >='" + mycriteria.GeCreateTime + "'";
            }
            if (mycriteria.LtCreateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_Time <'" + mycriteria.LtCreateTime + "'";
            }
            if (mycriteria.GtCreateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Create_Time >'" + mycriteria.GtCreateTime + "'";
            }
            if (mycriteria.NullCreateTime)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Create_Time is null"; 
            }
            if (mycriteria.NotNullCreateTime)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Create_Time is not null";
            }
            if (!string.IsNullOrEmpty(mycriteria.LikeUpdateUser))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Update_User like '%" + mycriteria.LikeUpdateUser + "%'";
            }
            if (mycriteria.InUpdateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.InUpdateUser)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += " Update_User in (" + instr + ")";
            }
            if (mycriteria.NotUpdateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.NotUpdateUser)
                {
                    instr += "'"+str+"',";
                }
                instr = instr.Substring(0,instr.Length-1);
                where += "Update_User not in (" + instr + ")";
            }
            if (mycriteria.OrEqUpdateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrEqUpdateUser)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Update_User='"+str+"' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (mycriteria.OrLikeUpdateUser.Count>0)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                string instr = "";
                foreach(var str in mycriteria.OrLikeUpdateUser)
                {
                    if(instr=="")
                    {instr="(";}
                    instr += "Update_User like '%"+str+"%' or ";
                }
                instr = instr.Substring(0,instr.Length-4);
                instr+=")";
                where += instr;
            }
            if (!string.IsNullOrEmpty(mycriteria.EqUpdateUser))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_User ='" + mycriteria.EqUpdateUser + "'";
            }
            if (!string.IsNullOrEmpty(mycriteria.NeUpdateUser))
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_User <>'" + mycriteria.NeUpdateUser + "'";
            }
            if (mycriteria.NullUpdateUser)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Update_User is null"; 
            }
            if (mycriteria.NotNullUpdateUser)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Update_User is not null";
            }
            if (mycriteria.EqUpdateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_Time =" + mycriteria.EqUpdateTime;
            }
            if (mycriteria.NeUpdateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_Time <>" + mycriteria.NeUpdateTime;
            }
            if (mycriteria.LeUpdateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_Time <='" + mycriteria.LeUpdateTime + "'";
            }
            if (mycriteria.GeUpdateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_Time >='" + mycriteria.GeUpdateTime + "'";
            }
            if (mycriteria.LtUpdateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_Time <" + mycriteria.LtUpdateTime;
            }
            if (mycriteria.GtUpdateTime!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Update_Time >" + mycriteria.GtUpdateTime;
            }
            if (mycriteria.NullUpdateTime)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Update_Time is null"; 
            }
            if (mycriteria.NotNullUpdateTime)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Update_Time is not null";
            }
            if (mycriteria.EqTimestamp!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Timestamp =" + mycriteria.EqTimestamp;
            }
            if (mycriteria.NeTimestamp!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Timestamp <>" + mycriteria.NeTimestamp;
            }
            if (mycriteria.LeTimestamp!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Timestamp <=" + mycriteria.LeTimestamp;
            }
            if (mycriteria.GeTimestamp!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Timestamp >=" + mycriteria.GeTimestamp;
            }
            if (mycriteria.LtTimestamp!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Timestamp <" + mycriteria.LtTimestamp;
            }
            if (mycriteria.GtTimestamp!=null)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += "Timestamp >" + mycriteria.GtTimestamp;
            }
            if (mycriteria.NullTimestamp)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Timestamp is null"; 
            }
            if (mycriteria.NotNullTimestamp)
            {
                if(where==""){ where += "where "; } else if(mycriteria.UseOr) {where += " or ";} else { where += " and "; }
                where += " Timestamp is not null";
            }
            
            return where;
        }
        
        #endregion
        
        
        
        
    }
}
