package com.bonus.material.clz.controller;

import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.clz.domain.vo.IwsTeamUserVo;
import com.bonus.material.clz.service.IwsTeamUserService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author : 阮世耀
 * @version : 1.0
 * @PackagePath: com.bonus.material.app.controller
 * @CreateTime: 2025-06-10  15:23
 * @Description: i皖送查询班组信息接口
 */
@RestController
@RequestMapping("/app/iwsTeamUser")
public class IwsTeamUserController {

    @Resource
    private IwsTeamUserService iwsTeamUserService;

    @ApiModelProperty(value = "根据用户名查询班组信息", notes = "根据用户名查询班组信息")
    @GetMapping("/selectUserInfoByUserName")
    public AjaxResult selectUserInfoByUserName(String userName) {
        if (userName == null || userName.isEmpty()) {
            userName = SecurityUtils.getLoginUser().getUsername();
        }
        return AjaxResult.success(iwsTeamUserService.selectUserInfoByUserName(userName));
    }

    @ApiModelProperty(value = "根据身份证号码查询班组信息", notes = "根据身份证号码查询班组信息")
    @GetMapping("/selectProjectTeamInfoByIdCard")
    public AjaxResult selectProjectTeamInfoByIdCard(IwsTeamUserVo dto) {
        return AjaxResult.success(iwsTeamUserService.selectProjectTeamInfoByIdCard(dto));
    }


    /**
     * 根据第三方信息修改班组及工程信息
     * @param dto
     * @return
     */
    @PostMapping("/updateTeamProject")
    public AjaxResult updateTeamProject(@RequestBody IwsTeamUserVo dto) {
        return iwsTeamUserService.updateTeamProject(dto);
    }

}
