コード例 #1
0
 /**
  * 删除自定义字段
  *
  * @param cmId 表单ID
  * @param request 请求
  * @param response 响应
  */
 @RequestMapping("/{fieldId}/delete")
 public void delete(
     @PathVariable int fieldId, HttpServletRequest request, HttpServletResponse response) {
   //
   DiyFormFieldEntity diyFormField = (DiyFormFieldEntity) this.diyFormFieldBiz.getEntity(fieldId);
   if (diyFormField == null) {
     this.outJson(
         response,
         null,
         false,
         this.getResString("err.not.exist", this.getResString("diy.form.field")));
     return;
   }
   DiyFormEntity diyForm =
       (DiyFormEntity) this.diyFormBiz.getEntity(diyFormField.getDiyFormFieldFormId());
   if (diyForm == null) {
     this.outJson(
         response, null, false, this.getResString("err.not.exist", this.getResString("diy.form")));
     return;
   }
   Map fields = new HashMap();
   // 要删除的字段名
   fields.put("fieldName", diyFormField.getDiyFormFieldFieldName());
   // 删除列
   diyFormFieldBiz.alterTable(diyForm.getDiyFormTableName(), fields, "drop");
   diyFormFieldBiz.deleteEntity(diyFormField.getDiyFormFieldId());
   this.outJson(response, null, true);
 }