Search in sources :

Example 1 with ApplicationMachineDO

use of com.orion.ops.entity.domain.ApplicationMachineDO in project orion-ops by lijiahangmax.

the class ReleaseMachineProcessor method updateAppMachineVersion.

/**
 * 更新应用机器版本
 */
private void updateAppMachineVersion() {
    ApplicationMachineDO update = new ApplicationMachineDO();
    update.setAppId(release.getAppId());
    update.setProfileId(release.getProfileId());
    update.setMachineId(machine.getMachineId());
    update.setReleaseId(release.getId());
    update.setBuildId(release.getBuildId());
    update.setBuildSeq(release.getBuildSeq());
    applicationMachineDAO.updateAppVersion(update);
}
Also used : ApplicationMachineDO(com.orion.ops.entity.domain.ApplicationMachineDO)

Example 2 with ApplicationMachineDO

use of com.orion.ops.entity.domain.ApplicationMachineDO in project orion-ops by lijiahangmax.

the class ApplicationMachineServiceImpl method syncAppProfileMachine.

@Override
@Transactional(rollbackFor = Exception.class)
public void syncAppProfileMachine(Long appId, Long profileId, Long targetProfileId) {
    // 删除
    LambdaQueryWrapper<ApplicationMachineDO> deleteWrapper = new LambdaQueryWrapper<ApplicationMachineDO>().eq(ApplicationMachineDO::getAppId, appId).eq(ApplicationMachineDO::getProfileId, targetProfileId);
    applicationMachineDAO.delete(deleteWrapper);
    // 查询
    LambdaQueryWrapper<ApplicationMachineDO> queryWrapper = new LambdaQueryWrapper<ApplicationMachineDO>().eq(ApplicationMachineDO::getAppId, appId).eq(ApplicationMachineDO::getProfileId, profileId);
    List<ApplicationMachineDO> machines = applicationMachineDAO.selectList(queryWrapper);
    // 新增
    for (ApplicationMachineDO machine : machines) {
        machine.setId(null);
        machine.setProfileId(targetProfileId);
        machine.setCreateTime(null);
        machine.setUpdateTime(null);
        applicationMachineDAO.insert(machine);
    }
}
Also used : ApplicationMachineDO(com.orion.ops.entity.domain.ApplicationMachineDO) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with ApplicationMachineDO

use of com.orion.ops.entity.domain.ApplicationMachineDO in project orion-ops by lijiahangmax.

the class ApplicationMachineServiceImpl method updateAppMachineReleaseId.

@Override
public void updateAppMachineReleaseId(Long appId, Long profileId, Long releaseId, List<Long> machineIdList) {
    ApplicationMachineDO update = new ApplicationMachineDO();
    update.setReleaseId(releaseId);
    LambdaQueryWrapper<ApplicationMachineDO> wrapper = new LambdaQueryWrapper<ApplicationMachineDO>().eq(ApplicationMachineDO::getAppId, appId).eq(ApplicationMachineDO::getProfileId, profileId).in(ApplicationMachineDO::getMachineId, machineIdList);
    applicationMachineDAO.update(update, wrapper);
}
Also used : ApplicationMachineDO(com.orion.ops.entity.domain.ApplicationMachineDO)

Example 4 with ApplicationMachineDO

use of com.orion.ops.entity.domain.ApplicationMachineDO in project orion-ops by lijiahangmax.

the class ApplicationMachineServiceImpl method copyAppMachine.

@Override
@Transactional(rollbackFor = Exception.class)
public void copyAppMachine(Long appId, Long targetAppId) {
    // 查询
    LambdaQueryWrapper<ApplicationMachineDO> wrapper = new LambdaQueryWrapper<ApplicationMachineDO>().eq(ApplicationMachineDO::getAppId, appId);
    List<ApplicationMachineDO> machines = applicationMachineDAO.selectList(wrapper);
    // 新增
    for (ApplicationMachineDO machine : machines) {
        machine.setId(null);
        machine.setAppId(targetAppId);
        machine.setCreateTime(null);
        machine.setUpdateTime(null);
        applicationMachineDAO.insert(machine);
    }
}
Also used : ApplicationMachineDO(com.orion.ops.entity.domain.ApplicationMachineDO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ApplicationMachineDO

use of com.orion.ops.entity.domain.ApplicationMachineDO in project orion-ops by lijiahangmax.

the class ApplicationMachineServiceImpl method configAppMachines.

@Override
@Transactional(rollbackFor = Exception.class)
public void configAppMachines(ApplicationConfigRequest request) {
    Long appId = request.getAppId();
    Long profileId = request.getProfileId();
    List<Long> machineIdList = request.getMachineIdList();
    // 检查
    for (Long machineId : machineIdList) {
        MachineInfoDO machine = machineInfoDAO.selectById(machineId);
        Valid.notNull(machine, MessageConst.INVALID_MACHINE);
    }
    // 删除
    SpringHolder.getBean(ApplicationMachineService.class).deleteAppMachineByAppProfileId(appId, profileId);
    // 添加
    for (Long machineId : machineIdList) {
        ApplicationMachineDO machine = new ApplicationMachineDO();
        machine.setAppId(appId);
        machine.setProfileId(profileId);
        machine.setMachineId(machineId);
        applicationMachineDAO.insert(machine);
    }
}
Also used : ApplicationMachineService(com.orion.ops.service.api.ApplicationMachineService) MachineInfoDO(com.orion.ops.entity.domain.MachineInfoDO) ApplicationMachineDO(com.orion.ops.entity.domain.ApplicationMachineDO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ApplicationMachineDO (com.orion.ops.entity.domain.ApplicationMachineDO)5 Transactional (org.springframework.transaction.annotation.Transactional)3 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 MachineInfoDO (com.orion.ops.entity.domain.MachineInfoDO)1 ApplicationMachineService (com.orion.ops.service.api.ApplicationMachineService)1