IDEMPIERE-5008 Performance improvement of "NF3.0 Tree On Any Table". (#938)
Co-authored-by: jpiere <h.hagiwara@compiere-distribution-lab.net>
This commit is contained in:
parent
1970ee6539
commit
9f835c3e15
|
@ -286,7 +286,7 @@ public class MTree extends MTree_Base
|
|||
try
|
||||
{
|
||||
// load Node details - addToTree -> getNodeDetail
|
||||
getNodeDetails();
|
||||
getNodeDetails(linkColName, linkID);
|
||||
//
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt.setInt(1, getAD_Tree_ID());
|
||||
|
@ -445,7 +445,7 @@ public class MTree extends MTree_Base
|
|||
* - Node_ID
|
||||
* The SQL contains security/access control
|
||||
*/
|
||||
private void getNodeDetails ()
|
||||
private void getNodeDetails (String linkColName, int linkID)
|
||||
{
|
||||
// SQL for Node Info
|
||||
StringBuilder sqlNode = new StringBuilder();
|
||||
|
@ -506,7 +506,19 @@ public class MTree extends MTree_Base
|
|||
sqlNode.append("t.Description,t.IsSummary,").append(color)
|
||||
.append(" FROM ").append(tableName).append(" t ");
|
||||
if (!m_editable)
|
||||
sqlNode.append(" WHERE t.IsActive='Y'");
|
||||
{
|
||||
if (Util.isEmpty(linkColName) || linkID==0 )
|
||||
sqlNode.append(" WHERE t.IsActive='Y'");
|
||||
else
|
||||
sqlNode.append(" WHERE t.IsActive='Y' AND t.").append(linkColName).append("=").append(linkID);
|
||||
|
||||
}else {
|
||||
|
||||
if (!Util.isEmpty(linkColName) && linkID > 0)
|
||||
sqlNode.append(" WHERE t.").append(linkColName).append("=").append(linkID);
|
||||
|
||||
}
|
||||
|
||||
} else if (isValueDisplayed()) {
|
||||
sqlNode.append("SELECT t.").append(columnNameX)
|
||||
.append("_ID, t.Value || ' - ' || t.Name, t.Description, t.IsSummary,").append(color)
|
||||
|
|
Loading…
Reference in New Issue