疯狂的狮子Li
2023-01-13 0fc796b90d3f44b81ef30285edb897223df439f7
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
@@ -12,13 +12,11 @@
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.service.IGenTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
@@ -30,7 +28,6 @@
 * @author Lion Li
 */
@Validated
@Api(value = "代码生成", tags = {"代码生成管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/tool/gen")
@@ -41,7 +38,6 @@
    /**
     * 查询代码生成列表
     */
    @ApiOperation("查询代码生成列表")
    @SaCheckPermission("tool:gen:list")
    @GetMapping("/list")
    public TableDataInfo<GenTable> genList(GenTable genTable, PageQuery pageQuery) {
@@ -50,14 +46,15 @@
    /**
     * 修改代码生成业务
     *
     * @param tableId 表ID
     */
    @ApiOperation("修改代码生成业务")
    @SaCheckPermission("tool:gen:query")
    @GetMapping(value = "/{talbleId}")
    public R<Map<String, Object>> getInfo(@PathVariable Long talbleId) {
        GenTable table = genTableService.selectGenTableById(talbleId);
    @GetMapping(value = "/{tableId}")
    public R<Map<String, Object>> getInfo(@PathVariable Long tableId) {
        GenTable table = genTableService.selectGenTableById(tableId);
        List<GenTable> tables = genTableService.selectGenTableAll();
        List<GenTableColumn> list = genTableService.selectGenTableColumnListByTableId(talbleId);
        List<GenTableColumn> list = genTableService.selectGenTableColumnListByTableId(tableId);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("info", table);
        map.put("rows", list);
@@ -68,7 +65,6 @@
    /**
     * 查询数据库列表
     */
    @ApiOperation("查询数据库列表")
    @SaCheckPermission("tool:gen:list")
    @GetMapping("/db/list")
    public TableDataInfo<GenTable> dataList(GenTable genTable, PageQuery pageQuery) {
@@ -77,10 +73,11 @@
    /**
     * 查询数据表字段列表
     *
     * @param tableId 表ID
     */
    @ApiOperation("查询数据表字段列表")
    @SaCheckPermission("tool:gen:list")
    @GetMapping(value = "/column/{talbleId}")
    @GetMapping(value = "/column/{tableId}")
    public TableDataInfo<GenTableColumn> columnList(Long tableId) {
        TableDataInfo<GenTableColumn> dataInfo = new TableDataInfo<>();
        List<GenTableColumn> list = genTableService.selectGenTableColumnListByTableId(tableId);
@@ -91,8 +88,9 @@
    /**
     * 导入表结构(保存)
     *
     * @param tables 表名串
     */
    @ApiOperation("导入表结构(保存)")
    @SaCheckPermission("tool:gen:import")
    @Log(title = "代码生成", businessType = BusinessType.IMPORT)
    @PostMapping("/importTable")
@@ -107,7 +105,6 @@
    /**
     * 修改保存代码生成业务
     */
    @ApiOperation("修改保存代码生成业务")
    @SaCheckPermission("tool:gen:edit")
    @Log(title = "代码生成", businessType = BusinessType.UPDATE)
    @PutMapping
@@ -119,8 +116,9 @@
    /**
     * 删除代码生成
     *
     * @param tableIds 表ID串
     */
    @ApiOperation("删除代码生成")
    @SaCheckPermission("tool:gen:remove")
    @Log(title = "代码生成", businessType = BusinessType.DELETE)
    @DeleteMapping("/{tableIds}")
@@ -131,8 +129,9 @@
    /**
     * 预览代码
     *
     * @param tableId 表ID
     */
    @ApiOperation("预览代码")
    @SaCheckPermission("tool:gen:preview")
    @GetMapping("/preview/{tableId}")
    public R<Map<String, String>> preview(@PathVariable("tableId") Long tableId) throws IOException {
@@ -142,8 +141,9 @@
    /**
     * 生成代码(下载方式)
     *
     * @param tableName 表名
     */
    @ApiOperation("生成代码(下载方式)")
    @SaCheckPermission("tool:gen:code")
    @Log(title = "代码生成", businessType = BusinessType.GENCODE)
    @GetMapping("/download/{tableName}")
@@ -154,8 +154,9 @@
    /**
     * 生成代码(自定义路径)
     *
     * @param tableName 表名
     */
    @ApiOperation("生成代码(自定义路径)")
    @SaCheckPermission("tool:gen:code")
    @Log(title = "代码生成", businessType = BusinessType.GENCODE)
    @GetMapping("/genCode/{tableName}")
@@ -166,8 +167,9 @@
    /**
     * 同步数据库
     *
     * @param tableName 表名
     */
    @ApiOperation("同步数据库")
    @SaCheckPermission("tool:gen:edit")
    @Log(title = "代码生成", businessType = BusinessType.UPDATE)
    @GetMapping("/synchDb/{tableName}")
@@ -178,8 +180,9 @@
    /**
     * 批量生成代码
     *
     * @param tables 表名串
     */
    @ApiOperation("批量生成代码")
    @SaCheckPermission("tool:gen:code")
    @Log(title = "代码生成", businessType = BusinessType.GENCODE)
    @GetMapping("/batchGenCode")