package com.sckw.user.controller;

import com.sckw.core.utils.TenantUtil;
import com.sckw.core.web.response.HttpResult;
import com.sckw.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @desc:
 * @author: Lt
 * @date: 2024-05-22
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    /**
    * @Description: 根据tenantId生成用户信息
    * @Author: Lt
    * @Date: 2024/5/22 0022 13:58
    */
    @PostMapping(value = "/generateUserByTenantId")
    public HttpResult generateUserByTenantId() throws Exception {
        String tenant = TenantUtil.getTenant();
        if (tenant.isBlank()){
            return HttpResult.error("租户为空");
        }
        return HttpResult.ok(userService.generateUserByTenantId(tenant));
    }


}
