Search in sources :

Example 1 with CommandTemplateDO

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;
}
Also used : UserDTO(com.orion.ops.entity.dto.UserDTO) CommandTemplateDO(com.orion.ops.entity.domain.CommandTemplateDO) Date(java.util.Date)

Example 2 with CommandTemplateDO

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();
}
Also used : UserDTO(com.orion.ops.entity.dto.UserDTO) CommandTemplateDO(com.orion.ops.entity.domain.CommandTemplateDO)

Example 3 with CommandTemplateDO

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);
}
Also used : CommandTemplateDO(com.orion.ops.entity.domain.CommandTemplateDO)

Aggregations

CommandTemplateDO (com.orion.ops.entity.domain.CommandTemplateDO)3 UserDTO (com.orion.ops.entity.dto.UserDTO)2 Date (java.util.Date)1