package thyyxxk.webserver.controller.dictionary;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.dictionary.EmployeeMi;
import thyyxxk.webserver.entity.dictionary.EmployeeMiVo;
import thyyxxk.webserver.entity.dictionary.ZdEducationCode;
import thyyxxk.webserver.entity.dictionary.ZdEmpInmark;
import thyyxxk.webserver.entity.dictionary.ZdEmpPosition;
import thyyxxk.webserver.entity.dictionary.ZdEmpTitle;
import thyyxxk.webserver.entity.dictionary.ZdIfcadre;
import thyyxxk.webserver.entity.dictionary.ZdUnitClass;
import thyyxxk.webserver.entity.dictionary.ZdUnitCode;
import thyyxxk.webserver.service.dictionary.PersonnelDictService;

import java.util.List;
import java.util.Map;

/**
 * @Description: 人事字典
 * @Author: hsh
 * @CreateTime: 2023-10-16  16:30
 * @Version: 1.0
 */
@RestController
@RequestMapping("/personnel")
public class PersonnelDictController {

    private final PersonnelDictService service;

    @Autowired
    public PersonnelDictController(PersonnelDictService service) {
        this.service = service;
    }

    @GetMapping("/selectZdUnitCode")
    public ResultVo<List<ZdUnitCode>> selectZdUnitCode(@RequestParam("text") String text){
        return service.selectZdUnitCode(text);
    }

    @GetMapping("/selectDeptDict")
    public ResultVo<List<ZdUnitCode>> selectDeptDict(@RequestParam("text") String text){
        return service.selectDeptDict(text);
    }

    @GetMapping("/selectDeptDictForEffective")
    public ResultVo<List<ZdUnitCode>> selectDeptDictForEffective(){
        return service.selectDeptDictForEffective();
    }

    @GetMapping("/selectUnitClass")
    public ResultVo<List<Map<String, Object>>> selectUnitClass(){
        return service.selectUnitClass();
    }

    @GetMapping("/selectDeptDictByCode")
    public ResultVo<ZdUnitCode> selectDeptDictByCode(@RequestParam("code") String code){
        return service.selectDeptDictByCode(code);
    }

    @PostMapping("/saveDeptDict")
    public ResultVo<Map<String, Object>> saveDeptDict(@RequestBody @Validated ZdUnitCode zdUnitCode){
        return service.saveDeptDict(zdUnitCode);
    }

    @GetMapping("/updateDeptStopOrUsed")
    public ResultVo<Map<String, Object>> updateDeptStopOrUsed(@RequestParam("code") String code, @RequestParam("delFlag") String delFlag){
        return service.updateDeptStopOrUsed(code, delFlag);
    }

    @GetMapping("/delDeptDictByCode")
    public ResultVo<Map<String, Object>> delDeptDictByCode(@RequestParam("code") String code){
        return service.delDeptDictByCode(code);
    }

    @GetMapping("/selectDeptClass")
    public ResultVo<List<ZdUnitClass>> selectDeptClass(){
        return service.selectDeptClass();
    }

    @PostMapping("/saveDeptClass")
    public ResultVo<Map<String, Object>> saveDeptClass(@RequestBody @Validated ZdUnitClass zdUnitclass){
        return service.saveDeptClass(zdUnitclass);
    }

    @GetMapping("/delDeptClassByCode")
    public ResultVo<Map<String, Object>> delDeptClassByCode(@RequestParam("code") String code){
        return service.delDeptClassByCode(code);
    }

    @GetMapping("/selectEmpPosition")
    public ResultVo<List<ZdEmpPosition>> selectEmpPosition(){
        return service.selectEmpPosition();
    }

    @PostMapping("/saveEmpPosition")
    public ResultVo<Map<String, Object>> saveEmpPosition(@RequestBody @Validated ZdEmpPosition zdEmpPosition){
        return service.saveEmpPosition(zdEmpPosition);
    }

    @GetMapping("/delEmpPositionByCode")
    public ResultVo<Map<String, Object>> delEmpPositionByCode(@RequestParam("code") String code){
        return service.delEmpPositionByCode(code);
    }

    @GetMapping("/selectEmpTitle")
    public ResultVo<List<ZdEmpTitle>> selectEmpTitle(){
        return service.selectEmpTitle();
    }

    @PostMapping("/saveEmpTitle")
    public ResultVo<Map<String, Object>> saveEmpTitle(@RequestBody @Validated ZdEmpTitle zdEmpTitle){
        return service.saveEmpTitle(zdEmpTitle);
    }

    @GetMapping("/delEmpTitleByCode")
    public ResultVo<Map<String, Object>> delEmpTitleByCode(@RequestParam("code") String code){
        return service.delEmpTitleByCode(code);
    }

    @GetMapping("/selectEducation")
    public ResultVo<List<ZdEducationCode>> selectEducation(){
        return service.selectEducation();
    }

    @PostMapping("/saveEducation")
    public ResultVo<Map<String, Object>> saveEducation(@RequestBody @Validated ZdEducationCode zdEducationCode){
        return service.saveEducation(zdEducationCode);
    }

    @GetMapping("/delEducationByCode")
    public ResultVo<Map<String, Object>> delEducationByCode(@RequestParam("code") String code){
        return service.delEducationByCode(code);
    }

    @GetMapping("/selectIfcadre")
    public ResultVo<List<ZdIfcadre>> selectIfcadre(){
        return service.selectIfcadre();
    }

    @PostMapping("/saveIfcadre")
    public ResultVo<Map<String, Object>> saveIfcadre(@RequestBody @Validated ZdIfcadre zdIfcadre){
        return service.saveIfcadre(zdIfcadre);
    }

    @GetMapping("/delIfcadreByCode")
    public ResultVo<Map<String, Object>> delIfcadreByCode(@RequestParam("code") String code){
        return service.delIfcadreByCode(code);
    }

    @GetMapping("/selectEmpInmark")
    public ResultVo<List<ZdEmpInmark>> selectEmpInmark(){
        return service.selectEmpInmark();
    }

    @PostMapping("/saveEmpInmark")
    public ResultVo<Map<String, Object>> saveEmpInmark(@RequestBody @Validated ZdEmpInmark zdEmpInmark){
        return service.saveEmpInmark(zdEmpInmark);
    }

    @GetMapping("/delEmpInmarkByCode")
    public ResultVo<Map<String, Object>> delEmpInmarkByCode(@RequestParam("code") String code){
        return service.delEmpInmarkByCode(code);
    }

    @GetMapping("/selectEmployeeMi")
    public ResultVo<List<EmployeeMiVo>> selectEmployeeMi(@RequestParam("text") String text){
        return service.selectEmployeeMi(text);
    }

    @GetMapping("/selectEmployeeMiByCode")
    public ResultVo<EmployeeMi> selectEmployeeMiByCode(@RequestParam("code") String code){
        return service.selectEmployeeMiByCode(code);
    }

    @GetMapping("/delEmployeeMiByCode")
    public ResultVo<Map<String, Object>> delEmployeeMiByCode(@RequestParam("code") String code){
        return service.delEmployeeMiByCode(code);
    }

    @GetMapping("/updateEmployeeMiDelFlagByCode")
    public ResultVo<Map<String, Object>> updateEmployeeMiDelFlagByCode(@RequestParam("code") String code, @RequestParam("delFlag") String delFlag){
        return service.updateEmployeeMiDelFlagByCode(code, delFlag);
    }

    @GetMapping("/selectEmployeeByCode")
    public ResultVo<List<CodeName>> selectEmployeeByCode(@RequestParam("text") String text){
        return service.selectEmployeeByCode(text);
    }

}
