use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project usercenteradmin by caijiya.
the class RoleServiceImpl method grantMenus.
@Override
@Transactional(rollbackFor = Exception.class)
public void grantMenus(GrantMenuDTO grantMenuDTO) {
roleMenuRelService.remove(new LambdaQueryWrapper<RoleMenuRel>().eq(RoleMenuRel::getRoleId, grantMenuDTO.getRoleId()));
roleMenuRelService.saveBatch(grantMenuDTO.getMenuIds().stream().map(menuId -> {
RoleMenuRel roleMenuRel = new RoleMenuRel();
roleMenuRel.setRoleId(roleMenuRel.getRoleId());
roleMenuRel.setMenuId(menuId);
return roleMenuRel;
}).collect(Collectors.toList()));
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project orion-ops by lijiahangmax.
the class WebSideMessageServiceImpl method setAllRead.
@Override
public Integer setAllRead() {
WebSideMessageDO update = new WebSideMessageDO();
update.setReadStatus(ReadStatus.READ.getStatus());
LambdaQueryWrapper<WebSideMessageDO> wrapper = new LambdaQueryWrapper<WebSideMessageDO>().eq(WebSideMessageDO::getToUserId, Currents.getUserId()).eq(WebSideMessageDO::getReadStatus, ReadStatus.UNREAD.getStatus());
return webSideMessageDAO.update(update, wrapper);
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project orion-ops by lijiahangmax.
the class MachineEnvServiceImpl method syncMachineEnv.
@Override
@Transactional(rollbackFor = Exception.class)
public void syncMachineEnv(MachineEnvRequest request) {
Long id = request.getId();
Long machineId = request.getMachineId();
List<Long> targetMachineIdList = request.getTargetMachineIdList();
// 获取self
MachineEnvService self = SpringHolder.getBean(MachineEnvService.class);
List<MachineEnvDO> envList;
if (Const.N_N_L_1.equals(id)) {
// 全量同步
LambdaQueryWrapper<MachineEnvDO> wrapper = new LambdaQueryWrapper<MachineEnvDO>().eq(MachineEnvDO::getMachineId, machineId).orderByAsc(MachineEnvDO::getUpdateTime);
envList = machineEnvDAO.selectList(wrapper);
} else {
// 查询数据
MachineEnvDO env = machineEnvDAO.selectById(id);
Valid.notNull(env, MessageConst.UNKNOWN_DATA);
envList = Lists.singleton(env);
}
// 同步
for (Long targetMachineId : targetMachineIdList) {
for (MachineEnvDO syncEnv : envList) {
MachineEnvRequest addRequest = new MachineEnvRequest();
addRequest.setMachineId(targetMachineId);
addRequest.setKey(syncEnv.getAttrKey());
addRequest.setValue(syncEnv.getAttrValue());
addRequest.setDescription(syncEnv.getDescription());
self.addEnv(addRequest);
}
}
// 设置日志参数
EventParamsHolder.addParams(request);
EventParamsHolder.addParam(EventKeys.ENV_COUNT, envList.size());
EventParamsHolder.addParam(EventKeys.MACHINE_COUNT, targetMachineIdList.size());
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project orion-ops by lijiahangmax.
the class CleanTransferStatusRunner method run.
@Override
public void run(String... args) {
log.info("重置传输状态-开始");
// 更新可打包传输状态
LambdaQueryWrapper<FileTransferLogDO> packageWrapper = new LambdaQueryWrapper<FileTransferLogDO>().eq(FileTransferLogDO::getTransferType, SftpTransferType.PACKAGE.getType()).in(FileTransferLogDO::getTransferStatus, SftpTransferStatus.WAIT.getStatus(), SftpTransferStatus.RUNNABLE.getStatus());
FileTransferLogDO updatePackage = new FileTransferLogDO();
updatePackage.setTransferStatus(SftpTransferStatus.CANCEL.getStatus());
updatePackage.setUpdateTime(new Date());
fileTransferLogDAO.update(updatePackage, packageWrapper);
// 更新可恢复传输状态
LambdaQueryWrapper<FileTransferLogDO> resumeWrapper = new LambdaQueryWrapper<FileTransferLogDO>().ne(FileTransferLogDO::getTransferType, SftpTransferType.PACKAGE.getType()).in(FileTransferLogDO::getTransferStatus, SftpTransferStatus.WAIT.getStatus(), SftpTransferStatus.RUNNABLE.getStatus());
FileTransferLogDO updateResume = new FileTransferLogDO();
updateResume.setTransferStatus(SftpTransferStatus.PAUSE.getStatus());
updateResume.setUpdateTime(new Date());
fileTransferLogDAO.update(updateResume, resumeWrapper);
log.info("重置传输状态-结束");
}
use of com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper in project orion-ops by lijiahangmax.
the class MachineInfoServiceImpl method copyMachine.
@Override
public Long copyMachine(Long id) {
MachineInfoDO machine = machineInfoDAO.selectById(id);
Valid.notNull(machine, MessageConst.INVALID_MACHINE);
String sourceMachineName = machine.getMachineName();
String targetMachineName = sourceMachineName + Utils.getCopySuffix();
machine.setId(null);
machine.setCreateTime(null);
machine.setUpdateTime(null);
machine.setMachineName(targetMachineName);
machineInfoDAO.insert(machine);
Long insertId = machine.getId();
// 复制环境变量
LambdaQueryWrapper<MachineEnvDO> wrapper = new LambdaQueryWrapper<MachineEnvDO>().eq(MachineEnvDO::getMachineId, id).orderByAsc(MachineEnvDO::getUpdateTime);
machineEnvDAO.selectList(wrapper).forEach(e -> {
// 插入环境变量
e.setMachineId(insertId);
e.setCreateTime(null);
e.setUpdateTime(null);
machineEnvDAO.insert(e);
// 插入历史值
historyValueService.addHistory(e.getId(), HistoryValueType.MACHINE_ENV, HistoryOperator.ADD, null, e.getAttrValue());
});
// 设置日志参数
EventParamsHolder.addParam(EventKeys.ID, id);
EventParamsHolder.addParam(EventKeys.SOURCE, sourceMachineName);
EventParamsHolder.addParam(EventKeys.TARGET, targetMachineName);
return insertId;
}
Aggregations