|
|
@@ -1,15 +1,13 @@
|
|
|
package com.vber.generator.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
-import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
|
|
+import com.vber.common.constant.DataSourceConstants;
|
|
|
import com.vber.common.core.controller.BaseController;
|
|
|
import com.vber.common.core.domain.entity.SysDictType;
|
|
|
import com.vber.common.core.domain.entity.SysMenu;
|
|
|
import com.vber.generator.domain.ZTree;
|
|
|
import com.vber.generator.service.IGenDictTypeService;
|
|
|
import com.vber.generator.service.IGenMenuService;
|
|
|
-import com.vber.generator.service.IGenTableService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@@ -26,16 +24,11 @@ import java.util.List;
|
|
|
@SaIgnore
|
|
|
@Controller
|
|
|
public class HomeController extends BaseController {
|
|
|
- private final IGenTableService genTableService;
|
|
|
private final IGenMenuService menuService;
|
|
|
private final IGenDictTypeService dictTypeService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private DynamicDataSourceAutoConfiguration dynamicDSConfig;
|
|
|
|
|
|
-
|
|
|
- public HomeController(IGenTableService genTableService, IGenMenuService menuService, IGenDictTypeService dictTypeService) {
|
|
|
- this.genTableService = genTableService;
|
|
|
+ public HomeController(IGenMenuService menuService, IGenDictTypeService dictTypeService) {
|
|
|
this.menuService = menuService;
|
|
|
this.dictTypeService = dictTypeService;
|
|
|
}
|
|
|
@@ -44,7 +37,8 @@ public class HomeController extends BaseController {
|
|
|
* 访问首页
|
|
|
*/
|
|
|
@RequestMapping("/")
|
|
|
- public String index() {
|
|
|
+ public String index(ModelMap mMap) {
|
|
|
+ mMap.put("dataSource", DataSourceConstants.MASTER);
|
|
|
return "index";
|
|
|
}
|
|
|
|
|
|
@@ -54,17 +48,17 @@ public class HomeController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/gen/importTable/{dataSource}")
|
|
|
- public String importTable(@PathVariable("dataSource") String dataSource, ModelMap mmap) {
|
|
|
- mmap.put("dataSource", dataSource);
|
|
|
+ public String importTable(@PathVariable("dataSource") String dataSource, ModelMap mMap) {
|
|
|
+ mMap.put("dataSource", dataSource);
|
|
|
return "importTable";
|
|
|
}
|
|
|
|
|
|
@GetMapping("/gen/edit/{datasource}/{tableId}")
|
|
|
- public String edit(@PathVariable("datasource") String datasource, @PathVariable("tableId") Long tableId, ModelMap mmap) {
|
|
|
+ public String edit(@PathVariable("datasource") String datasource, @PathVariable("tableId") Long tableId, ModelMap mMap) {
|
|
|
List<SysDictType> dictList = dictTypeService.selectDictList();
|
|
|
- mmap.put("tableId", tableId);
|
|
|
- mmap.put("dictList", dictList);
|
|
|
- mmap.put("datasource", datasource);
|
|
|
+ mMap.put("tableId", tableId);
|
|
|
+ mMap.put("dictList", dictList);
|
|
|
+ mMap.put("datasource", datasource);
|
|
|
return "edit";
|
|
|
}
|
|
|
|
|
|
@@ -72,9 +66,9 @@ public class HomeController extends BaseController {
|
|
|
* 选择菜单树
|
|
|
*/
|
|
|
@GetMapping("/gen/selectMenuTree/{menuId}")
|
|
|
- public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) {
|
|
|
+ public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mMap) {
|
|
|
SysMenu menu = menuService.selectMenuById(menuId);
|
|
|
- mmap.put("menu", menu);
|
|
|
+ mMap.put("menu", menu);
|
|
|
return "tree/menuTree";
|
|
|
}
|
|
|
|
|
|
@@ -93,9 +87,9 @@ public class HomeController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/gen/selectDictTree/{columnId}/{dictType}")
|
|
|
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
|
|
|
- ModelMap mmap) {
|
|
|
- mmap.put("columnId", columnId);
|
|
|
- mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
|
|
+ ModelMap mMap) {
|
|
|
+ mMap.put("columnId", columnId);
|
|
|
+ mMap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
|
|
return "tree/dicTree";
|
|
|
}
|
|
|
|
|
|
@@ -112,13 +106,13 @@ public class HomeController extends BaseController {
|
|
|
* 加载字典列表树
|
|
|
*/
|
|
|
@GetMapping("/gen/project")
|
|
|
- public String project(ModelMap mmap) {
|
|
|
- mmap.put("groupId", "com.vap");
|
|
|
- mmap.put("artifactId", "VberAdminPlus");
|
|
|
- mmap.put("packageName", "com.vber");
|
|
|
- mmap.put("title", "VberAdminPlus后台管理系统");
|
|
|
- mmap.put("modulePrefix", "vber-");
|
|
|
- mmap.put("projectDir", "D:\\Project\\VbAdminPlus_New\\");
|
|
|
+ public String project(ModelMap mMap) {
|
|
|
+ mMap.put("groupId", "com.vap");
|
|
|
+ mMap.put("artifactId", "VberAdminPlus");
|
|
|
+ mMap.put("packageName", "com.vber");
|
|
|
+ mMap.put("title", "VberAdminPlus后台管理系统");
|
|
|
+ mMap.put("modulePrefix", "vber-");
|
|
|
+ mMap.put("projectDir", "D:\\Project\\VbAdminPlus_New\\");
|
|
|
return "project";
|
|
|
}
|
|
|
}
|