zoukankan      html  css  js  c++  java
  • Nhibernate 中或者符号Or 的用法

            /// <summary>
            /// 根据机组编号、测点类型获取数据
            /// </summary>
            /// <param name="unitNumber"></param>
            /// <param name="tagtype"></param>
            /// <returns></returns>
            public IList<USSGS_EquStateTag> GetStateTagByUnitNodeidState(string unitNumber, string nodeid, string state)
            {
                if (dataBaseSession == null)
                {
                    throw new ApplicationException("连接数据库失败");
                }
                ICriteria criteria = dataBaseSession.CreateCriteria(typeof(USSGS_EquStateTag));
                if (!string.IsNullOrEmpty(unitNumber))
                {
                    criteria.Add(Restrictions.Eq("JZBH", unitNumber));
                }
                if (!string.IsNullOrEmpty(nodeid))
                {
                    criteria.Add(Restrictions.Eq("NodeID", nodeid)).AddOrder(new Order("ByOrder", true));
                }

        //或者符号 Or 的用法如下:           

         criteria.Add(Restrictions.Or(Restrictions.Eq("State", state),Restrictions.IsNull("State")));
                return criteria.List<USSGS_EquStateTag>();
            }

  • 相关阅读:
    cookie,session,django中间件,csrf回顾
    CSRF
    django中间件
    cookie与session
    form组件简单回顾
    分页器组件与form组件
    ajax回顾
    AJAX
    python魔法方法详解
    python静态方法类方法属性方法
  • 原文地址:https://www.cnblogs.com/yisheng/p/2743976.html
Copyright © 2011-2022 走看看