Эх сурвалжийг харах

CommonController 增加几个接口

shiqian 4 жил өмнө
parent
commit
6da14c3ac2

+ 34 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/CommonController.java

@@ -1,5 +1,6 @@
 package com.boman.web.core.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.domain.dto.FormDataDto;
 import com.boman.web.core.service.common.ICommonService;
@@ -41,6 +42,17 @@ public class CommonController {
         return AjaxResult.success(commonService.getByMap(dto.getTable(), dto.getFixedData()));
     }
 
+    /**
+     * 功能描述: 根据表名和自定义字段查找
+     *
+     * @param dto dto
+     * @return com.boman.domain.dto.AjaxResult
+     */
+    @PostMapping
+    public JSONObject getOneByMap(@RequestBody FormDataDto dto) {
+        return commonService.getOneByMap(dto.getTable(), dto.getFixedData());
+    }
+
     /**
      * 功能描述: getMaxId
      *
@@ -53,4 +65,26 @@ public class CommonController {
         return commonService.getMaxId(tableName, pkName);
     }
 
+    /**
+     * 功能描述: count
+     *
+     * @param dto dto
+     * @return com.boman.domain.dto.AjaxResult
+     */
+    @GetMapping("count/{tableName}/pkName/{pkName}")
+    public int count(@RequestBody FormDataDto dto) {
+        return commonService.count(dto);
+    }
+
+    /**
+     * 功能描述: 获取最新的一条数据 create_time desc
+     *
+     * @param tableName tableName
+     * @return com.boman.domain.dto.AjaxResult
+     */
+    @GetMapping("count/{tableName}")
+    public JSONObject getNewest(@PathVariable("tableName") String tableName) {
+        return commonService.getNewest(tableName);
+    }
+
 }