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