package com.zhyc.module.common.controller;

import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.module.common.domain.Post;
import com.zhyc.module.common.domain.User;

import com.zhyc.module.common.service.PostService;
import com.zhyc.module.common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//人员用户
@RestController
@RequestMapping("/userPost")
public class UserPostController {
    @Autowired
    UserService userService;

    @Autowired
    PostService postService;

//    根据岗位编码获取用户
    @GetMapping("/getUser")
    public AjaxResult getUserPost(String postCode){
        User user = new User();
        user.setPostCode(postCode);
        List<User> list = userService.getUserListByCode(user);
        return AjaxResult.success(list);
    }

//    获取岗位（部门）
    @GetMapping("/getPost")
    public AjaxResult getPost(String postName){
        List<Post> list = postService.selectPostList(postName);
        return AjaxResult.success(list);
    }

//    获取岗位班组
    @GetMapping("/getPostTeam")
    public AjaxResult getPostTeam(){
        List<Post> list = postService.selectPostList("班");
        return AjaxResult.success(list);
    }


}
