自动化立体仓库 - WMS系统
whycq
2022-08-06 7d7090b098add475808ffdebebff8b4e2a3b98ff
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Node;
import com.zy.asrs.mapper.NodeMapper;
import com.zy.asrs.service.NodeService;
import org.springframework.stereotype.Service;
 
import java.util.Date;
 
@Service("nodeService")
public class NodeServiceImpl extends ServiceImpl<NodeMapper, Node> implements NodeService {
    @Override
    public Node getTop() {
        Node top = this.selectOne(new EntityWrapper<Node>().eq("type", 0).eq("level", 0));
        if (top == null) {
            top = new Node();
            top.setName("全部");
            top.setUuid("全部");
            top.setType(0);
            top.setLevel(0);
            top.setSort(0);
            top.setStatus(1);
            top.setCreateTime(new Date());
            top.setUpdateTime(new Date());
            Integer insert = this.baseMapper.insert(top);
            if (insert == 0) {
                throw new CoolException("服务器异常");
            }
        }
        return top;
    }
 
    @Override
    public Node selectByUuid(String uuid) {
        return selectOne(new EntityWrapper<Node>().eq("uuid", uuid));
    }
 
    @Override
    public Node selectByUuid(String uuid, Long hostId) {
        return this.baseMapper.selectByUuid(uuid, hostId);
    }
 
    @Override
    public Node selectByUuid(String uuid, Long hostId, Integer type) {
        return selectOne(new EntityWrapper<Node>().eq("host_id", hostId).eq("uuid", uuid).eq("type", type));
    }
 
    @Override
    public Node selectByUuid(String uuid, Long hostId, Integer type, Long parentId) {
        return selectOne(new EntityWrapper<Node>().eq("host_id", hostId).eq("uuid", uuid).eq("type", type).eq("parent_id", parentId));
    }
}