解决方案 »

  1.   

    @RequestMapping(value ="/autocomplete")
        @ResponseBody
        public String autocomplete(BaseConditionVO vo){
         Map<String,Object> map =new HashMap<String,Object>();
         map.put("re" , "%" + vo.getQ() + "%");
         if (vo.getArg1() != "") {
    map.put("actuaMethodId", Long.parseLong(vo.getArg1()));
    }
    List<TjsActuaMethod> list = tjsActuaMethodService.findListByMap(map);
    return JacksonMapper.getListToJson(list);
    }-----------------------------------------------------
    <tr>
    <th type="del" width="60">操作</th>
    <th type="autocomplete" fieldClass="required" 
    name = "tjsActuaMethodList[#index#].fixMethods"
    lookupGroup="tjsActuaMethodList[#index#].methodId" 
    onfocus="onfocus_Autocomplete(#index#)"
    size="25" 
    >维修保养项目</th>

     <th type="lookup" fieldClass="required" 
    name="tjsActuaMethodList[#index#].trueName"
    lookupGroup="tjsActuaMethodList[#index#]" 
    lookupUrl="${ctx}/tjsCarService/lookCheck" 
    size="25"  disabled="true"
    lookupPk="wxgrId"
    >维修保养工人</th>
      <th type="text" name="tjsActuaMethodList[#index#].quotaMins" size="25" disable="true"  fieldClass="required" 
      >维修保养耗时(分钟)</th>
      <th type="text"   name="tjsActuaMethodList[#index#].warDays"  size="25" 
      >维修保修期限(天)</th>
      <th type="text"  name="tjsActuaMethodList[#index#].re" defaultVal="" size="25"
    >备注</th>
    </tr>
    --------------------------
    <script>
    function onfocus_Autocomplete(index)
    {
    $("input[name='tjsActuaMethodList["+index+"].fixMethods']").autocomplete("${ctx}/tjsCarBrokeMethod/autocomplete", {
    minChars : 0, //自动完成激活之前填入的最小字符
    mustMatch:true,
    matchSubset:false,
    extraParams: {},//多个参数
    formatItem : function(row, i, max,id,term) {
    return getAutocompleteCss(term,row.methodCode,row.fixMethods);
    },
    formatMatch : function(row, i, max) {
    return row.methodCode + row.fixMethods ;
    },
    formatResult : function(row) {
    return row.fixMethods;
    }
    }).result(function(event, row, formatted) {
    if(row != null)
    {
    $("input[name='tjsActuaMethodList["+index+"].methodId']").val(row.id);
    $("input[name='tjsActuaMethodList["+index+"].quotaMins']").val(row.quotaMins);
    $("input[name='tjsActuaMethodList["+index+"].warDays']").val(row.warDays);
    }
    });
    }
    </script>上面的五张表是举例,就是想问通过B表的信息插入到D表时。C表的B.id根据A表的id查询出来的数据如何自动加入到E表中。前面的功能我已经实现。
      

  2.   

    这个推荐使用hb的关联插入就ok,, 或者数据库的trigger 拉,,,或者自己实现拉..