#
Junjie
2023-12-21 29bc0e7f8558a5c053958ad63005363ded9f4f8b
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.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<TagMapper, Tag> implements TagService {
 
    @Override
    public synchronized Tag getTop() {
        Tag top = this.getOne(new LambdaQueryWrapper<Tag>().eq(Tag::getLevel, 1));
        if (top == null) {
            top = new Tag();
            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;
    }
 
}