package com.cool.store.controller.webc;

import com.cool.store.dto.ehr.FranchiseeInfoDTO;
import com.cool.store.dto.ehr.StaffBaseInfoDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.XfsgEhrService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 培训登记
 */
@RestController
@RequestMapping("/mini/trainingRegist")
@Api(tags = "移动端培训登记")
@Slf4j
public class TrainingRegistController {

    @Resource
    XfsgEhrService xfsgEhrService;

    @ApiOperation("根据工号获取人员主数据")
    @GetMapping("/getUserInfoByCode")
    public ResponseResult<StaffBaseInfoDTO> getUserInfoByCode(@RequestParam("staffNumber") String staffNumber) {
        return ResponseResult.success(xfsgEhrService.getUserInfoByCode(staffNumber));
    }

    @ApiOperation("根据加盟商编码查询加盟商信息")
    @GetMapping("/getFranchiseeInfoByFrId")
    public ResponseResult<FranchiseeInfoDTO> getFranchiseeInfoByFrId(@RequestParam("frId") String frId) {
        return ResponseResult.success(xfsgEhrService.getFranchiseeInfoByFrId(frId));
    }

}
