// @Validations(requiredStrings={@RequiredStringValidator(fieldName="name",message="名称必须输入")}) // @InputConfig(methodName="list") @Override public String save() { try { if (StringUtils.isNotBlank(id)) { periodAccountService.update(periodAccount); } else { periodAccountService.save(periodAccount); } actionJsonResult = new ActionJsonResult(periodAccount); } catch (Exception e) { actionJsonResult = new ActionJsonResult(e.getMessage()); } return JSONLIST; }
@Override public String delete() { // id对应的记录不存在已经在Dao作了处理 if (StringUtils.isNotBlank(id)) { periodAccountService.delete(id); } actionJsonResult = new ActionJsonResult(true, null); return JSONLIST; }
@Override protected void beforInputSave() { if (StringUtils.isBlank(id)) { if (isEditSave()) { // 新增的时候不需要初始化,保存的时候要有个对象保存值 periodAccount = new PeriodAccount(); } } else { periodAccount = periodAccountService.getById(id); if (isEditSave()) { // 如果是修改后的保存,因为prepare到save前会执行一次Set操作(modelDriven), // 所以要在保存前将其关联的对象置空 } } }
@Override public String listall() { actionJsonResult = new ActionJsonResult(periodAccountService.getAll()); return JSONALL; }
@Override public String listjson() { pager = periodAccountService.findPager(objectQuery); actionJsonResult = new ActionJsonResult(pager); return JSONALL; }