/** 查询驾驶员的信息 */
  @SuppressWarnings({"rawtypes", "unchecked"})
  public DataGrid load(PageParam param, VmDrivertable vt) {

    DataGrid data = new DataGrid();
    StringBuffer sb = new StringBuffer("  from  VmDrivertable d where 1=1");
    List list = new ArrayList();
    if (StringUtils.isNotBlank(vt.getDrivingname())) {
      sb.append(" and d.drivingname like ?");
      list.add("%" + vt.getDrivingname() + "%");
    }
    if (StringUtils.isNotBlank(vt.getGender())) {
      sb.append(" and d.gender=?");
      list.add(vt.getGender());
    }
    if (StringUtils.isNotBlank(vt.getDrivingno())) {
      sb.append(" and d.drivingno=?");
      list.add(vt.getDrivingno());
    }

    data.setTotal((Long) dao.findOne("select count(*)" + sb.toString(), list));
    if (StringUtils.isNotBlank(param.getSort())) {
      param.appendOrderBy(sb); // 排序
    } else {
      sb.append(" order by d.createdate desc ");
    }

    List<Map<String, Object>> rows =
        dao.findPage(
            "select new Map(d.id as id,d.drivingno as drivingno,d.drivingname as drivingname,d.gender as gender,d.papervaliddate as papervaliddate,d.drivingage as drivingage,d.allowdriving as allowdriving,d.address as address,d.phone as phone,d.promulgator as promulgator,d.createdate as createdate)"
                + sb.toString(),
            param.getPage(),
            param.getRows(),
            list);
    for (Map<String, Object> map : rows) {
      map.put(
          "userName", MyCache.getInstance().getTrueName((String) map.get("promulgator"))); // 创建人
      // map.put("allowdriving",MyCache.getInstance().getSelectValue((String)
      // map.get("allowdriving")));//准驾车型
    }

    data.setRows(rows);
    return data;
  }
 /** 更新数据时 */
 public String updateVd(VmDrivertable vd) {
   VmDrivertable vs = dao.get(VmDrivertable.class, vd.getId());
   if (vs != null) {
     vs.setModydate(vd.getModydate());
     vs.setDrivingname(vd.getDrivingname());
     vs.setGender(vd.getGender());
     vs.setDrivingno(vd.getDrivingno());
     vs.setBirthday(vd.getBirthday());
     vs.setRegisterdate(vd.getRegisterdate());
     vs.setPapervaliddate(vd.getPapervaliddate());
     vs.setDrivingage(vd.getDrivingage());
     vs.setPhone(vd.getPhone());
     vs.setAllowdriving(vd.getAllowdriving());
     vs.setAddress(vd.getAddress());
     vs.setCheckrecord(vd.getCheckrecord());
     vs.setRemark(vd.getRemark());
     return MsgConfig.MSG_KEY_SUCCESS;
   } else {
     return "msg.update.content";
   }
 }