zoukankan      html  css  js  c++  java
  • hibernate左连接查询时在easyUI的dataGrid中有些行取值为空的解决办法

    1 当使用left join左连连接,sql语句为

    select t from SecondPage t left join t.rightNavbar n where 1=1

    页面中出现了部分空行的情况,上述语句返回的list集合为

    DataGrid dataGrid = new DataGrid();
    List<SecondPage> list=secondPageDao.find(model, paging);
    
    dataGrid.setRows(list);
    dataGrid.setTotal(secondPageDao.count(model));
    return dataGrid;

    遍历list的值,发现list里边的每一项都是有值的,我就没有理解,为什么直接把listset到row中,页面上就是有空格存在,但是我加了下面代码后解决了这个问题,如果有经验的朋友欢迎提供说明

        DataGrid dataGrid = new DataGrid();
    
        List<SecondPage> list=secondPageDao.find(model, paging);
        Iterator<SecondPage> it = list.iterator();
    
        /**解决空格的问题,前台取不到值**/
        List<SecondPage> listCopy = new ArrayList<SecondPage>();
        while (it.hasNext()) {
            SecondPage s = (SecondPage) it.next();
            SecondPage copy = new SecondPage();
            BeanUtils.copyProperties(s, copy);
            listCopy.add(copy);
        }
        /**结束**/
    
        dataGrid.setRows(list);
        dataGrid.setTotal(secondPageDao.count(model));
        return dataGrid;
    
  • 相关阅读:
    实验三 进程调度模拟程序
    实验二作业调度模拟程序实验报告
    实验8
    实验七
    实验六
    实验五 数独游戏界面设置
    实验五
    实验四
    实验三
    实验二
  • 原文地址:https://www.cnblogs.com/sean-zeng/p/11024807.html
Copyright © 2011-2022 走看看