public IResult save(IRequest request) {
AjaxFormResult result = new AjaxFormResult();
String oid = request.get("oid");
String code = request.get("code").toUpperCase();
String locale = request.get("locale");
ErrorCode errorCode = null;
if (CapString.isEmpty(oid)) {
errorCode = errorCodeService.getErrorCode(code, locale);
if (errorCode != null) {
result.set("exist", Boolean.TRUE);
return result;
}
} else {
errorCode = commonSrv.findById(ErrorCode.class, oid);
}
if (errorCode == null) {
errorCode = new ErrorCode();
errorCode.setOid(null);
}
CapBeanUtil.map2Bean(request, errorCode, ErrorCode.class);
errorCode.setCode(errorCode.getCode().toUpperCase());
errorCode.setLastModifyBy(CapSecurityContext.getUserId());
errorCode.setLastModifyTime(CapDate.getCurrentTimestamp());
errorCodeService.save(errorCode);
return result;
}