Преглед изворни кода

根据表名获取表单所有信息

shiqian пре 4 година
родитељ
комит
38428eb81d

+ 2 - 2
boman-common/boman-common-datascope/src/main/java/com/boman/common/datascope/aspect/DataScopeAspect.java

@@ -81,11 +81,11 @@ public class DataScopeAspect
      */
     @AfterReturning(returning = "rvt", pointcut = "@annotation(com.boman.common.datascope.annotation.DataScope)")
     public Object AfterExec(JoinPoint joinPoint, Object rvt) {
-        System.out.println("AfterReturning增强:获取目标方法的返回值:" + rvt);
+//        System.out.println("AfterReturning增强:获取目标方法的返回值:" + rvt);
         MethodSignature signature = (MethodSignature) joinPoint.getSignature();
         Method method = signature.getMethod();
         String name = method.getName();
-        System.out.println("AfterReturning增强:获取目标方法的方法:" + name);
+//        System.out.println("AfterReturning增强:获取目标方法的方法:" + name);
         return rvt;
     }
 

+ 11 - 17
boman-web-core/src/main/java/com/boman/web/core/controller/TableController.java

@@ -1,14 +1,12 @@
 package com.boman.web.core.controller;
 
+import com.boman.common.redis.RedisKey;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.domain.GenTable;
 import com.boman.web.core.service.TableServiceCmdService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-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 org.springframework.web.bind.annotation.*;
 
 
 /**
@@ -17,27 +15,23 @@ import org.springframework.web.bind.annotation.RestController;
  * @date 2021年03月22日 09:19
  **/
 @RestController
-@RequestMapping("/p/cs/table")
+@RequestMapping("/p/cs/table/")
 public class TableController {
 
     @Autowired
-    private TableServiceCmdService tableServiceCmdService;
+    private TableServiceCmdService cmdService;
 
     /**
      * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值
-     *                {
-     *                    "table": "sys_config",
-     *                }
      *
-     *
-     * @param condition condition
+     * @param tableName tableName
      * @return com.boman.domain.dto.AjaxResult
      */
-//    @ApiOperation(value = "根据表名获取表单所有信息")
-//    @PostMapping("/getByTableName")
-//    public AjaxResult getByTableName(@RequestBody BaseTableSaveDTO condition) {
-//        return tableServiceCmdService.getByTableName(condition);
-//    }
+    @ApiOperation(value = "根据表名获取表单所有信息")
+    @GetMapping("/getByTableName/{tableName}")
+    public AjaxResult getByTableName(@PathVariable("tableName") String tableName) {
+        return AjaxResult.success(cmdService.getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName));
+    }
 
     /**
      * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值
@@ -51,7 +45,7 @@ public class TableController {
     @ApiOperation(value = "根据表名获取表单所有信息, 没有过滤")
     @PostMapping("/listAllColumnsByTableId")
     public AjaxResult listAllColumnsByTableId(@RequestBody GenTable table) {
-        return tableServiceCmdService.listAllColumnsByTableId(table);
+        return cmdService.listAllColumnsByTableId(table);
     }
 
 

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardMapper.java

@@ -83,7 +83,7 @@ public interface StandardMapper {
 
 
     /* ***************************************************** select ******************************************************/
-    @Select("select max(${pkName} from ${tableName}")
+    @Select("select max(${pkName}) from ${tableName}")
     int selectMaxId(@Param("tableName") String tableName, @Param("pkName") String pkName);
 
     /**