// 根据用户id查询出不同的位置区
List<String> list = businessService.queryAllCIByAccountId(1);
StringBuffer strLac = new StringBuffer();
strLac.append("[");
int idFlag = 1;
for (int i = 0; i < list.size(); i++)
{
String parent = list.get(i);
//是否是最后一个位置区
if ((list.size() - 1) > i)
{
//根据用户id,位置区查询所有的小区
List<AcceptCI> listCi = businessService.queryAllCIByAccountIdAndAcceptLai(1, list.get(i));
strLac.append("{id:'" + (idFlag++) + "',text:'" + parent + "',checked:false");
//如果位置区下面有小区
if (listCi.size() > 0)
{
strLac.append(",children: [");
for (int j = 0; j < listCi.size(); j++)
{
AcceptCI node = listCi.get(j);
//是否是最后一个小区
if ((listCi.size() - 1) > j)
{
strLac.append("{id:'" + node.getAcceptCi() + "',text:'" + node.getAcceptCi()
+ "',checked:false,leaf:true},");
}
else
{
strLac.append("{id:'" + node.getAcceptCi() + "',text:'" + node.getAcceptCi()
+ "',checked:false,leaf:true}");
}
}
//存在多个位置区,且位置区下有小区时,但不是是最后一个位置区
strLac.append("]},");
}
else
{
//存在多个位置区,且位置区下没有小区时,但不是是最后一个位置区
strLac.append("},");
}
}
List<String> list = businessService.queryAllCIByAccountId(1);
StringBuffer strLac = new StringBuffer();
strLac.append("[");
int idFlag = 1;
for (int i = 0; i < list.size(); i++)
{
String parent = list.get(i);
//是否是最后一个位置区
if ((list.size() - 1) > i)
{
//根据用户id,位置区查询所有的小区
List<AcceptCI> listCi = businessService.queryAllCIByAccountIdAndAcceptLai(1, list.get(i));
strLac.append("{id:'" + (idFlag++) + "',text:'" + parent + "',checked:false");
//如果位置区下面有小区
if (listCi.size() > 0)
{
strLac.append(",children: [");
for (int j = 0; j < listCi.size(); j++)
{
AcceptCI node = listCi.get(j);
//是否是最后一个小区
if ((listCi.size() - 1) > j)
{
strLac.append("{id:'" + node.getAcceptCi() + "',text:'" + node.getAcceptCi()
+ "',checked:false,leaf:true},");
}
else
{
strLac.append("{id:'" + node.getAcceptCi() + "',text:'" + node.getAcceptCi()
+ "',checked:false,leaf:true}");
}
}
//存在多个位置区,且位置区下有小区时,但不是是最后一个位置区
strLac.append("]},");
}
else
{
//存在多个位置区,且位置区下没有小区时,但不是是最后一个位置区
strLac.append("},");
}
}