public void prepare() throws Exception { if (getRequestId() == null || getRequestId() == 0) { entCategory = new EntCategory(); } else { entCategory = entCategoryService.getEntityById(getRequestId()); } categories = categoryService.getCategoryByFatherId(0L); }
public String insert() { if (categoryIds != null && categoryIds.size() > 0) { Enterprise ent = SysContext.getCurrentEnterpriserUser(); for (Long cid : categoryIds) { Category c = new Category(); c.setId(cid); EntCategory ec = new EntCategory(); ec.setCategory(c); ec.setEnterprise(ent); entCategoryService.insert(ec); } flag = true; } return "input"; }