package cn.palmte.work.service;

import cn.palmte.work.model.Admin;
import cn.palmte.work.model.Dept;
import cn.palmte.work.model.DeptRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xiongshiyan at 2021/10/29 , contact me with email yanshixiong@126.com or phone 15208384257
 */
@Service
public class DeptService {
    @Autowired
    private DeptRepository deptRepository;

    public List<Dept> findAll(){
        return deptRepository.findAll();
    }

    public Dept findUserDept(Admin admin){
        return deptRepository.findOne(admin.getDeptId());
    }

}
