@Override public void update(SysParamItem sysParamItem) { dao.update(sysParamItem); // 更新缓存 // noticeBroker(sysParamItem.getType()); ParameterContainer.getInstance().reloadSystem(sysParamItem.getType()); }
@Override public String save(SysParamItem sysParamItem) { String id = dao.save(sysParamItem); // 更新缓存 // noticeBroker(sysParamItem.getType()); ParameterContainer.getInstance().reloadSystem(sysParamItem.getType()); return id; }
public SysParamItemVo wrap(SysParamItem sysParamItem) { if (sysParamItem == null) return null; SysParamItemVo vo = new SysParamItemVo(); BeanUtils.copyProperties(sysParamItem, vo); ParameterContainer container = ParameterContainer.getInstance(); vo.setTypeName(container.getSystemTypeName(vo.getType())); vo.setStatusName(container.getSystemName(ParameterConstant.COMMON_STATE, vo.getStatus())); String cascadeType = sysParamItem.getCascadeTypeCode(); if (org.apache.commons.lang3.StringUtils.isNotEmpty(cascadeType)) { vo.setCascadeTypeName(container.getSystemTypeName(cascadeType)); String cascadeValue = sysParamItem.getCascadeItemValue(); if (org.apache.commons.lang3.StringUtils.isNotEmpty(cascadeValue)) { String name = container.getSystemNameWithNoQuery(cascadeType, cascadeValue); if (name == null) { name = dao.queryName(cascadeType, cascadeValue); } vo.setCascadeItemName(name); } } return vo; }
@Override public void deleteByIds(String... ids) { if (ids == null || ids.length == 0) return; for (String id : ids) { SysParamItem item = dao.findById(id); if (item == null) { throw new EntityNotFoundException(id); } // 删除或更改状态 String status = item.getStatus(); if (CommonStatus.ACTIVE.getValue().equals(status)) { item.setStatus(CommonStatus.CANCELED.getValue()); } else if (CommonStatus.INACTIVE.getValue().equals(status)) { dao.delete(item); } // 更新缓存 // noticeBroker(item.getType()); ParameterContainer.getInstance().reloadSystem(item.getType()); } }