package com.zy.asrs.common.wms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.common.wms.entity.Tag; import com.zy.asrs.common.wms.mapper.TagMapper; import com.zy.asrs.common.wms.service.TagService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zy.asrs.framework.exception.CoolException; import org.springframework.stereotype.Service; @Service("manTagService") public class TagServiceImpl extends ServiceImpl implements TagService { @Override public synchronized Tag getTop(Long hostId) { Tag top = this.getOne(new LambdaQueryWrapper().eq(Tag::getLevel, 1).eq(Tag::getHostId, hostId)); if (top == null) { top = new Tag(); top.setName("全部"); top.setType(0); top.setLevel(1); top.setStatus(1); top.setSort(0); top.setHostId(hostId); Integer insert = this.baseMapper.insert(top); if (insert == 0) { throw new CoolException("服务器异常"); } } return top; } }