use of com.orion.ops.entity.domain.CommandTemplateDO in project orion-ops by lijiahangmax.
the class CommandTemplateServiceImpl method updateTemplate.
@Override
public Integer updateTemplate(CommandTemplateRequest request) {
// 查询模板信息
Long id = request.getId();
CommandTemplateDO beforeTemplate = commandTemplateDAO.selectById(id);
Valid.notNull(beforeTemplate, MessageConst.TEMPLATE_ABSENT);
// 更新
UserDTO user = Currents.getUser();
CommandTemplateDO update = new CommandTemplateDO();
update.setId(id);
update.setTemplateName(request.getName());
update.setTemplateValue(request.getValue());
update.setDescription(request.getDescription());
update.setUpdateUserId(user.getId());
update.setUpdateUserName(user.getUsername());
update.setUpdateTime(new Date());
int effect = commandTemplateDAO.updateById(update);
// 设置日志参数
EventParamsHolder.addParams(update);
EventParamsHolder.addParam(EventKeys.NAME, beforeTemplate.getTemplateName());
return effect;
}
use of com.orion.ops.entity.domain.CommandTemplateDO in project orion-ops by lijiahangmax.
the class CommandTemplateServiceImpl method addTemplate.
@Override
public Long addTemplate(CommandTemplateRequest request) {
// 插入
UserDTO user = Currents.getUser();
CommandTemplateDO entity = new CommandTemplateDO();
entity.setTemplateName(request.getName());
entity.setTemplateValue(request.getValue());
entity.setCreateUserId(user.getId());
entity.setCreateUserName(user.getUsername());
entity.setUpdateUserId(user.getId());
entity.setUpdateUserName(user.getUsername());
entity.setDescription(request.getDescription());
commandTemplateDAO.insert(entity);
// 设置日志参数
EventParamsHolder.addParams(entity);
return entity.getId();
}
use of com.orion.ops.entity.domain.CommandTemplateDO in project orion-ops by lijiahangmax.
the class CommandTemplateServiceImpl method templateDetail.
@Override
public CommandTemplateVO templateDetail(Long id) {
CommandTemplateDO template = commandTemplateDAO.selectById(id);
Valid.notNull(template, MessageConst.TEMPLATE_ABSENT);
return Converts.to(template, CommandTemplateVO.class);
}
Aggregations