|  |  | 
 |  |  | package com.zy.crm.system.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.crm.system.entity.Dept; | 
 |  |  | import com.zy.crm.system.mapper.DeptMapper; | 
 |  |  | import com.zy.crm.system.service.DeptService; | 
 |  |  | import com.zy.crm.system.service.UserService; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | @Service("deptService") | 
 |  |  | public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements DeptService { | 
 |  |  | 
 |  |  |     private UserService userService; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Dept getTop(Long hostId) { | 
 |  |  |         Dept top = this.selectOne(new EntityWrapper<Dept>().eq("level", 0)); | 
 |  |  |         if (top == null) { | 
 |  |  |             top = new Dept(); | 
 |  |  |             top.setHostId(hostId); | 
 |  |  |             top.setName("全部"); | 
 |  |  |             top.setUuid("全部"); | 
 |  |  |             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 int getMemberCount(Long deptId) { | 
 |  |  |         Dept dept = selectById(deptId); | 
 |  |  |         return 0; |