获取list,有内容就赋值,根据ID显现NAME,没有显现list

function onTOWN() {
    var town=mini.get("TOWN_ID");
    var town_id =town.getValue();
    $.ajax({
        url:"${ctx}/aUTHDEPARTMENT/onTOWN",
        data:{"town_id":town_id},
        dataType:"json",
        async:false,
        success:function(json){
            town.setData(json);
        }
    })
}

java代码

List<Record> list = Db.find("SELECT * FROM AUTH_DEPARTMENT WHERE DEPARTMENT_LEVEL='2'");
if(list!=null){
    for(Record re:list){
        Map a = new HashMap();
        a.put("id", re.get("ID"));
        a.put("text", re.get("NAME"));
        STATEList.add(a);
    }
}
renderJson(STATEList);

 

posted @ 2017-07-20 19:18  易之盛  阅读(305)  评论(0编辑  收藏  举报