package com.casic.missiles.modular.dept.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.casic.missiles.core.application.context.AbstractPermissionContext;
import com.casic.missiles.modular.dept.dao.BusDeptUserMapper;
import com.casic.missiles.modular.dept.dto.DeptUserView;
import com.casic.missiles.modular.dept.model.BusDeptUser;
import com.casic.missiles.modular.dept.service.IBusDeptUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 部门责任人关联表 服务实现类
 * </p>
 *
 * @author zhangyingjie123
 * @since 2020-05-07
 */
@Service
public class BusDeptUserServiceImpl extends ServiceImpl<BusDeptUserMapper, BusDeptUser> implements IBusDeptUserService {

    @Resource
    private AbstractPermissionContext permissionService;

    @Override
    public List<DeptUserView> selectDeptUserList(String deptType, String deptName) {
        List<DeptUserView> deptUserViews = this.baseMapper.selectDeptUserList(deptType, deptName);
        for (DeptUserView deptUserView : deptUserViews) {
            deptUserView.setpName(permissionService.getDeptService().getDeptName(deptUserView.getPid()));
        }
        return deptUserViews;
    }
}
