using Learun.Application.TwoDevelopment.ZZDT_EC; using Learun.Util; using Learun.Util.SqlSugar; using NPOI.POIFS.Properties; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Http.Description; using System.Web.UI; namespace Learun.Application.Web.AppApi { /// /// /// [RoutePrefix("api/PropertyApi")] [HandlerApiLogin(FilterMode.Ignore)] [TokenAuthorize] public class PropertyApiController : WebApiControllerBase { private ec_propertyIBLL ec_propertyIBLL; /// /// /// public PropertyApiController() { ec_propertyIBLL = new ec_propertyBLL(); } /// /// 获取所有的属性,和对象类型无关。 /// /// 空,或者0,则查询公司级 /// [HttpGet] public IHttpActionResult GetAllProps(string ProjectId) { try { var res = ec_propertyIBLL.GetPropTreeData(ProjectId, false); #region 特殊处理 var settingTbName = ProjectSugar.TableName(ProjectId); var existvalue = SqlSugarHelper.Db.Queryable().AS(settingTbName).First(x => x.SettingName == GlobalObject.projSetting_TagNumber_CADBlockAlias); var fakePropForTagNumber = new ec_propertyEntity() { PropertyID = GlobalObject.fakeID, PropertyName = GlobalObject.propName_TagNumber, PropertyGID = GlobalObject.fakeID, CADBlockAlias = existvalue == null ? "" : existvalue.SettingValue, }; var Group_treemodel = new TreeModel() { id = GlobalObject.fakeID, text = "位号" }; Group_treemodel.ChildNodes = new List(); Group_treemodel.ChildNodes.Add(new TreeModel() { id = fakePropForTagNumber.PropertyID, parentId = fakePropForTagNumber.PropertyGID, text = fakePropForTagNumber.PropertyName, NodeExtData = new { fakePropForTagNumber.CADBlockAlias, fakePropForTagNumber.PropertyID }, }); res.Add(Group_treemodel); #endregion return Success(res); } catch (Exception ex) { return Fail(ex.Message); } } } }