package com.zhyc.module.common.service.impl;

import com.zhyc.common.annotation.DataScope;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.module.common.domain.Dept;
import com.zhyc.module.common.domain.User;
import com.zhyc.module.common.mapper.DeptMapper;
import com.zhyc.module.common.mapper.UserMapper;
import com.zhyc.module.common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserPostServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;
    @Autowired
    DeptMapper deptMapper;

    @Override
    public List<User> getUserListByCode(User user) {
        Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
        Dept secondLevel = deptMapper.selectTopSecondLevelDept(deptId);
        user.setDeptId(secondLevel.getDeptId());
        System.out.println(secondLevel);
        return userMapper.getUserListByCode(user);
    }

}
