@Override public Template save(Template entity) { String subject = ""; String operate = OperateLog.OPERATE_CREATE; if (entity.isNew()) { subject = "新建模板:" + entity.getSubject(); } else { subject = "更新模板:" + entity.getSubject(); operate = OperateLog.OPERATE_UPDATE; } // 正常 if (entity.getStatus() == BCConstants.STATUS_ENABLED) { Template oldTpl = this.templateDao.loadByCodeAndId(entity.getCode(), entity.getId()); if (oldTpl != null) { this.operateLogService.saveWorkLog( Template.class.getSimpleName(), oldTpl.getId().toString(), "禁用旧模板:" + oldTpl.getSubject(), null, OperateLog.OPERATE_UPDATE); oldTpl.setStatus(BCConstants.STATUS_DISABLED); this.templateDao.save(oldTpl); } } entity = this.templateDao.save(entity); this.operateLogService.saveWorkLog( Template.class.getSimpleName(), entity.getId().toString(), subject, null, operate); return entity; }
@Override public void delete(Serializable id) { Template entity = this.templateDao.load(id); this.operateLogService.saveWorkLog( Template.class.getSimpleName(), entity.getId().toString(), "删除模板:" + entity.getSubject(), null, OperateLog.OPERATE_DELETE); super.delete(id); }