luxiaotao1123
2023-12-21 1abd27fc6e7d8e0202fbb3fe35db00add079ab29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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<ManTagMapper, ManTag> implements ManTagService {
 
    @Override
    public synchronized ManTag getTop() {
        ManTag top = this.getOne(new LambdaQueryWrapper<ManTag>().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;
    }
 
}