@ModelAttribute public TestDat1 get(@RequestParam(required=false) String id) { TestDat1 entity = null; if (StringUtils.isNotBlank(id)){ entity = testDat1Service.get(id); } if (entity == null){ entity = new TestDat1(); } return entity; } @RequiresPermissions("test1:testDat1:edit") @RequestMapping(value = "save") public String save(TestDat1 testDat1, Model model, Duck duck,RedirectAttributes redirectAttributes) { if (!beanValidator(model, testDat1)){ return form(testDat1, model); } testDat1Service.save(testDat1); addMessage(redirectAttributes, "保存單表成功"); return "redirect:"+Global.getAdminPath()+"/test1/testDat1/?repage"; }
訪問的url: http://127.0.0.1:8080/jeesite/a/test1/testDat1/savejava
數據: app
id:
user.id:2
user.name:管理員
office.id:4
office.name:市場部
area.id:5
area.name:歷下區
name:12
sex:2
inDate:2016-12-15 16:11:29
remarks:aaaui後臺調用 :url
- get 在model 插入 testDat1
- save 在 生成的testDat1中插入 上面的數據 ,而且把duck的name和sex也插入前臺傳入的數據