Browse Source

fix bug: 修复自研框架无法找到对应mapper问题

lijie 2 years ago
parent
commit
e24e180cd7

+ 9 - 13
labsl/src/main/kotlin/com/persagy/labsl/controller/GraphController.kt

@@ -5,7 +5,6 @@ import com.persagy.labsl.Opts
 import com.persagy.labsl.models.entities.tpt.Graph
 import com.persagy.labsl.models.entities.tpt.pub.GraphPub
 import com.persagy.labsl.models.response.SCommonResponse
-import com.persagy.labsl.services.GraphLogicService
 import com.persagy.labsl.services.GraphService
 import com.persagy.labsl.services.pub.GraphPubService
 import com.persagy.service.models.requests.SCreateRequest
@@ -16,7 +15,6 @@ import com.persagy.service.models.responses.SCreateResponse
 import com.persagy.service.models.responses.SQueryResponse
 import io.swagger.v3.oas.annotations.Operation
 import io.swagger.v3.oas.annotations.tags.Tag
-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
@@ -31,8 +29,6 @@ import org.springframework.web.bind.annotation.RestController
 @RestController
 @RequestMapping("/graph")
 class GraphController {
-    @Autowired
-    lateinit var graphLogicService: GraphLogicService
 
     /**
      * 创建图
@@ -43,7 +39,7 @@ class GraphController {
     @Operation(summary ="草稿箱-创建图", description = "id和graphId为必填,图中会包含多个节点,详细节点结构见示例")
     @PostMapping("/drafts/create")
     fun create(@RequestBody request: SCreateRequest<Graph>): SCreateResponse<Graph> {
-        return graphLogicService.draftsCreate(request)
+        return GraphService.draftsCreateLogic(request)
     } // Function create()
 
     /**
@@ -55,7 +51,7 @@ class GraphController {
     @Operation(summary = "草稿箱-保存图形", description = "")
     @PostMapping("/drafts/save")
     fun save(@RequestBody graph: Graph): SCreateResponse<Graph> {
-        return graphLogicService.save(graph)
+        return GraphService.saveLogic(graph)
     } // Function save()
 
     /**
@@ -67,7 +63,7 @@ class GraphController {
    @Operation(summary="草稿箱-发布图形", description =" Id 和 GraphId 必须填写")
     @PostMapping("/drafts/publish")
     fun pubDrawings(@RequestBody graph: GraphPub): SCreateResponse<GraphPub>{
-        return graphLogicService.pubDrawings(graph)
+        return GraphService.pubDrawings(graph)
     } // Function pubDrawings()
 
 
@@ -80,7 +76,7 @@ class GraphController {
    @Operation(summary = "草稿箱-移至回收站", description = " Id 和 GraphId 必填")
     @PostMapping(value = ["/drafts/recycle"])
     fun recycle(@RequestBody idList: ArrayList<Graph>): SBaseResponse {
-        return graphLogicService.recycle(idList)
+        return GraphService.recycle(idList)
     } // Function recycle()
 
     /**
@@ -92,7 +88,7 @@ class GraphController {
    @Operation(summary = "已发布-图形移至回收站", description = "Id 和 GraphId 必填")
     @PostMapping(value = ["/pub/recycle"])
     fun recyclePub(@RequestBody idList: ArrayList<Graph>): SBaseResponse{
-        return graphLogicService.recyclePub(idList)
+        return GraphService.recyclePub(idList)
     } // Function recyclePub()
 
     /**
@@ -104,7 +100,7 @@ class GraphController {
    @Operation(summary = "草稿箱-更新图形信息", description = "Id 和 GraphId 必填")
     @PostMapping(value = ["/drafts/update"])
     fun update(@RequestBody request: SUpdateRequest<Graph>): SBaseResponse {
-        return graphLogicService.draftsUpdate(request)
+        return GraphService.draftsUpdate(request)
     } // Function update()
 
     /**
@@ -164,7 +160,7 @@ class GraphController {
    @Operation(summary = "已发布-更新图形信息", description = "")
     @PostMapping(value = ["/pub/update"])
     fun updatePub(@RequestBody request: SUpdateRequest<GraphPub>): SBaseResponse {
-        return graphLogicService.pubUpdate(request)
+        return GraphService.pubUpdate(request)
     } // Function update()
 
     /**
@@ -176,7 +172,7 @@ class GraphController {
     @Operation(summary = "回收站- 恢复图形", description = "Id 和 GraphId 必填 ")
     @PostMapping(value = ["recycle/recovery"])
     fun recovery(@RequestBody graph: Graph): SBaseResponse{
-    return graphLogicService.recovery(graph)
+    return GraphService.recovery(graph)
     } // Fun recovery()
 
     /**
@@ -188,7 +184,7 @@ class GraphController {
    @Operation(summary = "回收站-根据id删除图形信息,删除草稿箱图形", description = "Id 和 GraphId 必填 ")
     @PostMapping(value = ["recycle/delete"])
     fun delete(@RequestBody idList: ArrayList<Graph>): SBaseResponse {
-        return graphLogicService.deleteByKeysList(idList)
+        return GraphService.deleteByKeysList(idList)
     } // Function delete()
 
 

+ 9 - 9
labsl/src/main/kotlin/com/persagy/labsl/services/GraphLogicService.kt

@@ -20,7 +20,7 @@ interface GraphLogicService {
      * @author : lijie
      * Update By 2022/5/27 18:24
      */
-    fun draftsCreate(request: SCreateRequest<Graph>): SCreateResponse<Graph>
+    fun draftsCreateLogic(request: SCreateRequest<Graph>): SCreateResponse<Graph>
 
     /**
      * 保存草稿
@@ -29,48 +29,48 @@ interface GraphLogicService {
      * @author : lijie
      * Update By 2022/5/27 18:24
      */
-    fun save(graph: Graph): SCreateResponse<Graph>
+    fun saveLogic(graph: Graph): SCreateResponse<Graph>
     /**
      * 发布图形
      * @author : lijie
      * Update By 2022/5/27 18:42
      */
-    fun pubDrawings(graph: GraphPub): SCreateResponse<GraphPub>
+    fun pubDrawingsLogic(graph: GraphPub): SCreateResponse<GraphPub>
 
     /**
      * 图移至/移出回收站
      * @author : lijie
      * Update By 2022/5/31 19:20
      */
-    fun recycle(idList: ArrayList<Graph>): SBaseResponse
+    fun recycleLogic(idList: ArrayList<Graph>): SBaseResponse
     /**
      * 已发布图形移至/移出回收站
      * @author : lijie
      * Update By 2022/5/31 19:23
      */
-    fun recyclePub(idList: ArrayList<Graph>): SBaseResponse
+    fun recyclePubLogic(idList: ArrayList<Graph>): SBaseResponse
     /**
      * 草稿图形的更新操作
      * @author : lijie
      * Update By 2022/5/31 19:27
      */
-    fun draftsUpdate(request: SUpdateRequest<Graph>): SBaseResponse
+    fun draftsUpdateLogic(request: SUpdateRequest<Graph>): SBaseResponse
     /**
      * 已发布图形的更新操作
      * @author : lijie
      * Update By 2022/5/31 19:30
      */
-    fun pubUpdate(request: SUpdateRequest<GraphPub>): SBaseResponse
+    fun pubUpdateLogic(request: SUpdateRequest<GraphPub>): SBaseResponse
     /**
      * 恢复回收站的图形
      * @author : lijie
      * Update By 2022/5/31 19:39
      */ 
-    fun recovery(graph: Graph): SBaseResponse
+    fun recoveryLogic(graph: Graph): SBaseResponse
     /**
      * 根据id删除图形
      * @author : lijie
      * Update By 2022/5/31 19:42
      */
-    fun deleteByKeysList(idList: ArrayList<Graph>): SBaseResponse
+    fun deleteByKeysListLogic(idList: ArrayList<Graph>): SBaseResponse
 }

+ 84 - 4
labsl/src/main/kotlin/com/persagy/labsl/services/GraphService.kt

@@ -19,6 +19,8 @@ import com.persagy.service.models.responses.SCreateResponse
 import com.persagy.service.models.responses.SQueryResponse
 import com.persagy.service.utils.SSpringContextUtil
 import org.slf4j.LoggerFactory
+import org.springframework.stereotype.Service
+import org.springframework.transaction.annotation.Transactional
 import java.text.SimpleDateFormat
 import java.util.*
 import kotlin.collections.ArrayList
@@ -28,8 +30,7 @@ import kotlin.collections.ArrayList
  *
  * @author wx  <zhangweixin@sagacloud.com>
  */
-object GraphService : SObjectService<Graph>(SMybatisDao(
-    Graph::class.java)) {
+object GraphService : SObjectService<Graph>(SMybatisDao(Graph::class.java)),GraphLogicService {
 
     /** 自定义sql */
     private val customMapper by lazy {
@@ -201,8 +202,87 @@ object GraphService : SObjectService<Graph>(SMybatisDao(
         }
         return sBaseResponse
     }
-
-
+    /**
+     * 创建草稿
+     * @author : lijie
+     * Update By 2022/6/1 11:01
+     */
+    @Transactional
+    override fun draftsCreateLogic(request: SCreateRequest<Graph>): SCreateResponse<Graph> {
+       return draftsCreate(request)
+    }
+    /**
+     * 保存草稿
+     * @author : lijie
+     * Update By 2022/6/1 11:01
+     */
+    @Transactional
+    override fun saveLogic(graph: Graph): SCreateResponse<Graph> {
+       return save(graph)
+    }
+    /**
+     * 发布草稿
+     * @author : lijie
+     * Update By 2022/6/1 11:36
+     */
+    @Transactional
+    override fun pubDrawingsLogic(graph: GraphPub): SCreateResponse<GraphPub> {
+        return pubDrawings(graph)
+    }
+    /**
+     * 移至/移除回收站
+     * @author : lijie
+     * Update By 2022/6/1 11:37
+     */
+    @Transactional
+    override fun recycleLogic(idList: ArrayList<Graph>): SBaseResponse {
+        return recycle(idList)
+    }
+    /**
+     * 将已发布图移至/移除回收站
+     * @author : lijie
+     * Update By 2022/6/1 11:38
+     */
+    @Transactional
+    override fun recyclePubLogic(idList: ArrayList<Graph>): SBaseResponse {
+        return recyclePub(idList)
+    }
+    /**
+     * 草稿更新
+     * @author : lijie
+     * Update By 2022/6/1 11:39
+     */
+    @Transactional
+    override fun draftsUpdateLogic(request: SUpdateRequest<Graph>): SBaseResponse {
+        return draftsUpdate(request)
+    }
+    /**
+     * 已发布图更新
+     * @author : lijie
+     * Update By 2022/6/1 11:39
+     */
+    @Transactional
+    override fun pubUpdateLogic(request: SUpdateRequest<GraphPub>): SBaseResponse {
+        return pubUpdate(request)
+    }
+    /**
+     * 恢复图形
+     * @author : lijie
+     * Update By 2022/6/1 11:40
+     */
+    @Transactional
+    override fun recoveryLogic(graph: Graph): SBaseResponse {
+        return recovery(graph)
+    }
+    /**
+     * 删除图形
+     * @author : lijie
+     * Update By 2022/6/1 11:40
+     */
+    @Transactional
+    override fun deleteByKeysListLogic(idList: ArrayList<Graph>): SBaseResponse {
+        return deleteByKeysList(idList)
+    }
 
     /**
      * 创建图

+ 0 - 104
labsl/src/main/kotlin/com/persagy/labsl/services/impl/GraphLogicServiceImpl.kt

@@ -1,104 +0,0 @@
-package com.persagy.labsl.services.impl
-
-import com.persagy.labsl.models.entities.tpt.Graph
-import com.persagy.labsl.models.entities.tpt.pub.GraphPub
-import com.persagy.labsl.services.GraphLogicService
-import com.persagy.labsl.services.GraphService
-import com.persagy.service.models.requests.SCreateRequest
-import com.persagy.service.models.requests.SUpdateRequest
-import com.persagy.service.models.responses.SBaseResponse
-import com.persagy.service.models.responses.SCreateResponse
-import lombok.extern.slf4j.Slf4j
-import org.springframework.stereotype.Service
-import org.springframework.transaction.annotation.Transactional
-
-/**
- * 图逻辑处理
- * @author : lijie
- * Update By 2022/5/27 18:25
- */
-@Slf4j
-@Service
-open class GraphLogicServiceImpl : GraphLogicService {
-    /**
-     * 草稿箱-创建图
-     * @author : lijie
-     * Update By 2022/5/27 18:26
-     */
-    @Transactional
-    override fun draftsCreate(request: SCreateRequest<Graph>): SCreateResponse<Graph> {
-        return GraphService.draftsCreate(request);
-    }
-    /**
-     * 草稿箱-保存图
-     * @author : lijie
-     * Update By 2022/5/27 18:35
-     */
-    @Transactional
-    override fun save(graph: Graph): SCreateResponse<Graph> {
-        return GraphService.save(graph);
-    }
-    /**
-     * 发布草稿图
-     * @author : lijie
-     * Update By 2022/5/27 18:48
-     */
-    @Transactional
-    override fun pubDrawings(graph: GraphPub): SCreateResponse<GraphPub> {
-        return GraphService.pubDrawings(graph)
-    }
-    /**
-     * 草稿移出/移至回收站
-     * @author : lijie
-     * Update By 2022/5/31 19:23
-     */
-    @Transactional
-    override fun recycle(idList: ArrayList<Graph>): SBaseResponse {
-        return GraphService.recycle(idList)
-    }
-    /**
-     * 已发布图形移出/移至回收站
-     * @author : lijie
-     * Update By 2022/5/31 19:24
-     */
-    @Transactional
-    override fun recyclePub(idList: ArrayList<Graph>): SBaseResponse {
-        return GraphService.recyclePub(idList)
-    }
-    /**
-     * 草稿的更新操作
-     * @author : lijie
-     * Update By 2022/5/31 19:31
-     */
-    @Transactional
-    override fun draftsUpdate(request: SUpdateRequest<Graph>): SBaseResponse {
-        return GraphService.draftsUpdate(request)
-    }
-    /**
-     * 已发布操作的更新操作
-     * @author : lijie
-     * Update By 2022/5/31 19:31
-     */
-    @Transactional
-    override fun pubUpdate(request: SUpdateRequest<GraphPub>): SBaseResponse {
-       return GraphService.pubUpdate(request)
-    }
-    /**
-     * 从回收站恢复图形
-     * @author : lijie
-     * Update By 2022/5/31 19:40
-     */
-    @Transactional
-    override fun recovery(graph: Graph): SBaseResponse {
-       return GraphService.recovery(graph)
-    }
-    /**
-     * 根据id删除图形
-     * @author : lijie
-     * Update By 2022/5/31 19:43
-     */
-    @Transactional
-    override fun deleteByKeysList(idList: ArrayList<Graph>): SBaseResponse {
-       return GraphService.deleteByKeysList(idList)
-    }
-}