/** 关注我的/我关注的用户列表 */
  @SuppressWarnings("unchecked")
  @Override
  public DataGrid dataGridAccount(LvFollow lvFollow, PageHelper ph) {
    List<LvAccount> al = new ArrayList<LvAccount>();

    DataGrid dg = dataGridByType(ph, lvFollow, lvFollowDao);
    List<TlvAccount> l = dg.getRows();
    if (l != null && l.size() > 0) {
      String[] openIds = new String[l.size()];
      int i = 0;
      for (TlvAccount t : l) {
        LvAccount a = new LvAccount();
        MyBeanUtils.copyProperties(t, a, true);
        al.add(a);
        openIds[i++] = t.getOpenId().toString();
      }
      HashMap<Integer, Integer> photoNums = lvAccountPhotoDao.getCountPhotoNum(openIds);
      for (LvAccount a : al) {
        Integer num = photoNums.get(a.getOpenId());
        if (num != null) a.setPhotoNum(num);
      }
    }
    dg.setRows(al);
    return dg;
  }
  @SuppressWarnings({"rawtypes", "unchecked"})
  private DataGrid dataGridByType(PageHelper ph, LvFollow lvFollow, BaseDaoI dao) {
    ph.setSort("createTime");
    ph.setOrder("desc");

    DataGrid dg = new DataGrid();
    dg.setPage(Long.valueOf(ph.getPage()));
    dg.setPageSize(Long.valueOf(ph.getRows()));

    String hql = "select a from TlvAccount a ,TlvFollow t  ";
    Map<String, Object> params = new HashMap<String, Object>();
    // 我关注的用户
    if (lvFollow.getFromOpenId() != null) {
      hql += "where a.openId = t.toOpenId and t.fromOpenId = :openId";
      params.put("openId", lvFollow.getFromOpenId());
      // 关注我的用户
    } else if (lvFollow.getToOpenId() != null) {
      hql += "where a.openId = t.fromOpenId and t.toOpenId = :openId";
      params.put("openId", lvFollow.getToOpenId());
    }
    List<TlvAccount> l = dao.find(hql + orderHql(ph), params, ph.getPage(), ph.getRows());
    dg.setTotal(dao.count("select count(*) " + hql.substring(8), params));
    dg.setRows(l);
    return dg;
  }
 @Override
 public DataGrid dataGrid(LvFollow lvFollow, PageHelper ph) {
   List<LvFollow> ol = new ArrayList<LvFollow>();
   String hql = " from TlvFollow t ";
   DataGrid dg = dataGridQuery(hql, ph, lvFollow, lvFollowDao);
   @SuppressWarnings("unchecked")
   List<TlvFollow> l = dg.getRows();
   if (l != null && l.size() > 0) {
     for (TlvFollow t : l) {
       LvFollow o = new LvFollow();
       BeanUtils.copyProperties(t, o);
       ol.add(o);
     }
   }
   dg.setRows(ol);
   return dg;
 }
 @Override
 public DataGrid dataGrid(JbAssets jbAssets, PageHelper ph) {
   List<JbAssets> ol = new ArrayList<JbAssets>();
   String hql = " from TjbAssets t ";
   DataGrid dg = dataGridQuery(hql, ph, jbAssets, jbAssetsDao);
   @SuppressWarnings("unchecked")
   List<TjbAssets> l = dg.getRows();
   if (l != null && l.size() > 0) {
     for (TjbAssets t : l) {
       JbAssets o = new JbAssets();
       BeanUtils.copyProperties(t, o);
       ol.add(o);
     }
   }
   dg.setRows(ol);
   return dg;
 }