|
|
@ -2,17 +2,22 @@ package com.cloud.kicc.system.devtools.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.cloud.kicc.common.core.api.R; |
|
|
|
import com.cloud.kicc.common.core.api.R; |
|
|
|
import com.cloud.kicc.common.core.constant.AppConstants; |
|
|
|
import com.cloud.kicc.common.core.constant.AppConstants; |
|
|
|
import com.cloud.kicc.system.api.devtools.entity.GenDatabaseType; |
|
|
|
import com.cloud.kicc.system.api.devtools.entity.GenDatabaseType; |
|
|
|
|
|
|
|
import com.cloud.kicc.system.api.devtools.entity.GenTableFieldType; |
|
|
|
import com.cloud.kicc.system.devtools.service.IGenDatabaseTypeService; |
|
|
|
import com.cloud.kicc.system.devtools.service.IGenDatabaseTypeService; |
|
|
|
|
|
|
|
import com.cloud.kicc.system.devtools.service.IGenTableFieldTypeService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -28,6 +33,7 @@ import java.util.Arrays; |
|
|
|
public class GenDatabaseTypeController { |
|
|
|
public class GenDatabaseTypeController { |
|
|
|
|
|
|
|
|
|
|
|
private final IGenDatabaseTypeService iGenDatabaseTypeService; |
|
|
|
private final IGenDatabaseTypeService iGenDatabaseTypeService; |
|
|
|
|
|
|
|
private final IGenTableFieldTypeService iGenTableFieldTypeService; |
|
|
|
|
|
|
|
|
|
|
|
private LambdaQueryWrapper<GenDatabaseType> getQueryWrapper(GenDatabaseType genDatabaseType) { |
|
|
|
private LambdaQueryWrapper<GenDatabaseType> getQueryWrapper(GenDatabaseType genDatabaseType) { |
|
|
|
return new LambdaQueryWrapper<GenDatabaseType>() |
|
|
|
return new LambdaQueryWrapper<GenDatabaseType>() |
|
|
@ -43,7 +49,10 @@ public class GenDatabaseTypeController { |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/{id:\\w+}") |
|
|
|
@GetMapping("/{id:\\w+}") |
|
|
|
public R getById(@PathVariable("id") String id) { |
|
|
|
public R getById(@PathVariable("id") String id) { |
|
|
|
return R.ok(iGenDatabaseTypeService.getById(id)); |
|
|
|
GenDatabaseType genDatabaseType = iGenDatabaseTypeService.getById(id); |
|
|
|
|
|
|
|
genDatabaseType.setGenTableFieldTypeList(iGenTableFieldTypeService |
|
|
|
|
|
|
|
.list(Wrappers.<GenTableFieldType>lambdaQuery().eq(GenTableFieldType::getTypeId, genDatabaseType.getId()))); |
|
|
|
|
|
|
|
return R.ok(genDatabaseType); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/save") |
|
|
|
@PostMapping("/save") |
|
|
@ -58,6 +67,12 @@ public class GenDatabaseTypeController { |
|
|
|
return R.ok(); |
|
|
|
return R.ok(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PutMapping("/saveAndGenTableFieldType") |
|
|
|
|
|
|
|
public R saveAndGenTableFieldType(@RequestBody GenDatabaseType genDatabaseType) { |
|
|
|
|
|
|
|
iGenDatabaseTypeService.saveAndGenTableFieldType(genDatabaseType); |
|
|
|
|
|
|
|
return R.ok(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@DeleteMapping("/remove/{id:[\\w,]+}") |
|
|
|
@DeleteMapping("/remove/{id:[\\w,]+}") |
|
|
|
public R remove(@PathVariable String[] id) { |
|
|
|
public R remove(@PathVariable String[] id) { |
|
|
|
iGenDatabaseTypeService.removeByIds(Arrays.asList(id)); |
|
|
|
iGenDatabaseTypeService.removeByIds(Arrays.asList(id)); |
|
|
|