package com.xiang.xservice.application.generator.controller;

import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
import com.xiang.xservice.application.generator.service.CodeGenService;
import com.xiang.xservice.basic.common.resp.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.RestController;

import java.util.Map;

/**
 * 代码生成控制器
 *
 * @author zhengkai.blog.csdn.net
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/generator/code")
public class CodeGenController {
    
    private final CodeGenService codeGenService;

    @PostMapping("/generate")
    public Result<Map<String, String>> generateCode(@RequestBody ParamInfo paramInfo) throws Exception {
        return codeGenService.generateCode(paramInfo);
    }

}