76 lines
2.6 KiB
C#
76 lines
2.6 KiB
C#
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
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
[RoutePrefix("api/PropertyApi")]
|
||
[HandlerApiLogin(FilterMode.Ignore)]
|
||
[TokenAuthorize]
|
||
public class PropertyApiController : WebApiControllerBase
|
||
{
|
||
private ec_propertyIBLL ec_propertyIBLL;
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public PropertyApiController()
|
||
{
|
||
ec_propertyIBLL = new ec_propertyBLL();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取所有的属性,和对象类型无关。
|
||
/// </summary>
|
||
/// <param name="ProjectId">空,或者0,则查询公司级</param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
public IHttpActionResult GetAllProps(string ProjectId)
|
||
{
|
||
try
|
||
{
|
||
var res = ec_propertyIBLL.GetPropTreeData(ProjectId, false);
|
||
#region 特殊处理
|
||
var settingTbName = ProjectSugar.TableName<ec_projectSettingsEntity>(ProjectId);
|
||
var existvalue = SqlSugarHelper.Db.Queryable<ec_projectSettingsEntity>().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<TreeModel>();
|
||
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);
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|