/** 详细 */
 @RequestMapping(
     value = "detail",
     method = {RequestMethod.GET, RequestMethod.POST})
 public String detail(ModelMap model, Long id) {
   MetaColumn metaColumn = metaColumnService.read(id);
   model.put("metaColumn", metaColumn);
   return "meta/column/detail";
 }
 /** 修改 */
 @RequestMapping(
     value = "update",
     method = {RequestMethod.GET})
 public String toUpdate(ModelMap model, Long id) {
   MetaColumn metaColumn = metaColumnService.read(id);
   model.put("metaColumn", metaColumn);
   return "meta/column/update";
 }
  /** 导出 */
  @RequestMapping(
      value = "export",
      method = {RequestMethod.GET, RequestMethod.POST})
  public void export(
      HttpServletRequest request, HttpServletResponse response, ModelMap model, Query query)
      throws Exception {
    Map<String, Object> params = XParamsUtils.parse(request.getParameterMap());
    query.setParameters(params);
    List<MetaColumn> metaColumns = metaColumnService.list(query);

    // 标签名
    String sheet = "列信息";

    // 表头
    String[] headers = {"ID", "表ID", "tableName", "名称", "类型", "是否键"};

    // 数据
    List<String[]> rows = new ArrayList<String[]>();
    String[] row = null;
    MetaColumn metaColumn = null;
    for (int i = 0; i < metaColumns.size(); i++) {
      metaColumn = metaColumns.get(i);
      row =
          new String[] {
            XStringUtils.nullString(metaColumn.getId()),
            XStringUtils.nullString(metaColumn.getTableId()),
            metaColumn.getTableName(),
            metaColumn.getName(),
            metaColumn.getType(),
            XStringUtils.nullString(metaColumn.getIsKey())
          };
      rows.add(row);
    }

    response.setContentType("application/vnd.ms-excel");
    response.setCharacterEncoding("utf-8");
    response.setHeader(
        "Content-Disposition",
        String.format(
            "attachment;fileName=%1$s.xls", XDateUtils.format(new Date(), "yyyyMMddHHmmss")));
    WritableWorkbook wk = JxlExcelUtils.create(response.getOutputStream(), sheet, headers, rows);
    wk.write();
    wk.close();
  }
 /** 管理 */
 @RequestMapping(
     value = "manage",
     method = {RequestMethod.GET, RequestMethod.POST})
 public String manage(
     HttpServletRequest request,
     ModelMap model,
     Query query,
     Paging paging,
     MetaColumn metaColumn) {
   //		query.addParameter("id",metaColumn.getId());
   //		query.addParameter("tableId",metaColumn.getTableId());
   //		query.addParameter("tableName",metaColumn.getTableName());
   //		query.addParameter("name",metaColumn.getName());
   //		query.addParameter("type",metaColumn.getType());
   //		query.addParameter("isKey",metaColumn.getIsKey());
   Map<String, Object> params = XParamsUtils.parse(request.getParameterMap());
   query.setParameters(params);
   query.setPaging(paging);
   List<MetaColumn> metaColumns = metaColumnService.list(query);
   model.put("metaColumns", metaColumns);
   model.put("query", query);
   model.putAll(XParamsUtils.op(params));
   return "meta/column/manage";
 }