| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.domain.ColumnInfo; |
| | | import com.oying.domain.dto.TableInfo; |
| | | import com.oying.service.GenConfigService; |
| | | import com.oying.service.GeneratorService; |
| | | import com.oying.utils.R; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.PageUtil; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | private final GeneratorService generatorService; |
| | | private final GenConfigService genConfigService; |
| | | |
| | | @Value("${generator.enabled}") |
| | | private Boolean generatorEnabled; |
| | | @Value("${oying.enabled}") |
| | | private Boolean oyingEnabled; |
| | | |
| | | @ApiOperation("查询数据库数据") |
| | | @GetMapping(value = "/tables") |
| | |
| | | @ApiOperation("生成代码") |
| | | @PostMapping(value = "/{tableName}/{type}") |
| | | public ResponseEntity<Object> generatorCode(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response) { |
| | | if (!generatorEnabled && type == 0) { |
| | | if (!oyingEnabled && type == 0) { |
| | | throw new BadRequestException("此环境不允许生成代码,请选择预览或者下载查看!"); |
| | | } |
| | | switch (type) { |