package com.sqx.modules.firstLogin.control;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.firstLogin.entity.DepartmentEntity;
import com.sqx.modules.firstLogin.entity.WorkExpEntity;
import com.sqx.modules.firstLogin.service.DepartmentService;
import com.sqx.modules.resumes.entity.Resumes;
import com.sqx.modules.resumes.service.ResumesService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app/userFirst" )
public class UserFirstRegistCotroller {
    @Autowired
    private ResumesService resumesService;
    @Autowired
    private DepartmentService departmentService;

    @Login
    @PostMapping("regist")
    @ApiOperation("初次加载信息")
    public void  userFirstRegist(Long userId, String minWage, String maxWages, String city,Integer ifExp){
        System.out.println("?????????" + userId);
        Resumes resumes1 = resumesService.selectResumesByUserId(userId);
        resumes1.setCity(city);
        resumes1.setIfExp(ifExp);
        resumes1.setMinWage(minWage);
        resumes1.setMaxWage(maxWages);
        resumesService.updateById(resumes1);
    }
@GetMapping ("getDepartment" )
@ApiOperation("获取工作部门列表")
    public  Result  getDepartment(DepartmentEntity departmentEntity){

        return Result.success().put("data",departmentService.getDepartmentList(departmentEntity));
}

@PostMapping("workExp")
@ApiOperation("工作经验")
    public  void workExp(WorkExpEntity workExp){
}
@PostMapping("registe")
@ApiOperation("补充详细信息")
    public  void  registe(Resumes resumes){
    Resumes resumes1 = resumesService.selectResumesByUserId(resumes.getUserId());
    resumes1.setPicture(resumes.getPicture());
    resumes1.setResumesName(resumes.getResumesName());
    resumes1.setResumesSex(resumes.getResumesSex());
    resumes1.setResumesPhone(resumes.getResumesPhone());
    resumes1.setBirthday(resumes.getBirthday());
    resumes1.setResumesStatus(resumes.getResumesStatus());
    resumes1.setEdu(resumes.getEdu());
    resumes1.setAdv(resumes.getAdv());
    resumesService.updateById(resumes1);
}
}
