Exemplo n.º 1
0
        /// <summary>
        /// 区域列表
        /// </summary>
        /// <returns></returns>
        public IEnumerable <AreaEntity> GetList()
        {
            var sql = PetaPoco.Sql.Builder.Append(@"select * from Base_Area where 1=1 and Layer<>4 and EnabledMark<>0");

            sql.Append(" order by CreateDate desc");
            var list = Base_Area.Query(sql);

            return(EntityConvertTools.CopyToList <Base_Area, AreaEntity>(list.ToList()));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 区域列表
        /// </summary>
        /// <param name="parentId">节点Id</param>
        /// <param name="keyword">关键字查询</param>
        /// <returns></returns>
        public IEnumerable <AreaEntity> GetList(string parentId, string keyword)
        {
            var sql = PetaPoco.Sql.Builder.Append(@"select * from Base_Area where 1=1");

            if (!string.IsNullOrEmpty(parentId))
            {
                sql.Append(" and ParentId=@0", parentId);
            }
            if (!string.IsNullOrEmpty(keyword))
            {
                sql.Append(" and (charindex(@0,AreaCode)>0 or (charindex(@0,AreaName)>0", keyword);
            }
            var list = Base_Area.Query(sql);

            return(EntityConvertTools.CopyToList <Base_Area, AreaEntity>(list.ToList()));
        }