Prechádzať zdrojové kódy

fix bug:修复查询报该方法仅能传入 lambda 表达式产生的合成类错误

lijie 3 rokov pred
rodič
commit
047a749ab5

+ 14 - 11
labsl/src/main/kotlin/com/persagy/labsl/service/impl/GraphServiceImpl.kt

@@ -4,7 +4,9 @@ import cn.hutool.core.bean.BeanUtil
 import cn.hutool.core.collection.CollUtil
 import cn.hutool.core.util.ObjectUtil
 import cn.hutool.core.util.StrUtil
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
 import com.baomidou.mybatisplus.core.toolkit.Wrappers
+import com.baomidou.mybatisplus.extension.kotlin.KtQueryChainWrapper
 import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
 import com.persagy.database.SFilter
@@ -170,18 +172,20 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
         /** 图 id */
         graph1.graphId = graphPub.graphId
         /** 设置表明,查询 */
-        val graphEntity = getOne(Wrappers.lambdaQuery(GraphEntity::class.java)
-                .eq(StrUtil.isNotBlank(Opts.projectId),GraphEntity::projectId,Opts.projectId!!)
-                .eq(StrUtil.isNotBlank(graphPub.id),GraphEntity::id,graphPub.id!!)
-                .eq(StrUtil.isNotBlank(graphPub.graphId),GraphEntity::graphId,graphPub.graphId!!)
-                .eq(GraphEntity::state,1))
-        if (ObjectUtil.isNull(graphEntity)){
+        val queryWrapper: KtQueryWrapper<GraphEntity> = KtQueryWrapper(GraphEntity())
+        queryWrapper.eq(StrUtil.isNotBlank(Opts.projectId), GraphEntity::projectId, Opts.projectId)
+                .eq(StrUtil.isNotBlank(graphPub.id), GraphEntity::id, graphPub.id)
+                .eq(StrUtil.isNotBlank(graphPub.graphId), GraphEntity::graphId, graphPub.graphId)
+                .eq(GraphEntity::state, 1)
+        val graphEntities = list(queryWrapper)
+        if (CollUtil.isEmpty(graphEntities)){
             /** 返回标志 */
             sCreateResponse.result = SResponseType.failure
             sCreateResponse.message = "草稿箱中没有待发布图形"
             /** 返回对象 */
             return sCreateResponse
         }
+        val graphEntity = graphEntities.get(0)
         val graph = BeanUtil.copyProperties(graphEntity, GraphPubEntity::class.java)
         /** 清除已发布的老数据 */
         delOldDataPub(graph1)
@@ -197,7 +201,7 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
         graph.isAvailable = true
         graphPubService.save(graph)
         /** 设置表明,查询 */
-        val nodeList = nodeService.list(Wrappers.lambdaQuery(NodeEntity::class.java)
+        val nodeList = nodeService.list(KtQueryWrapper(NodeEntity())
                 .eq(StrUtil.isNotBlank(graphPub.id),NodeEntity::id,graphPub.id!!)
                 .eq(StrUtil.isNotBlank(graphPub.graphId),NodeEntity::graphId,graph.graphId!!)
                 .eq(NodeEntity::state,1))
@@ -220,7 +224,7 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
             nodePubService.saveBatch(CollUtil.newArrayList(nodePubList))
         }
         /** 设置表明,查询 */
-        val markersList = markerService.list(Wrappers.lambdaQuery(MarkerEntity::class.java)
+        val markersList = markerService.list(KtQueryWrapper(MarkerEntity())
                 .eq(StrUtil.isNotBlank(graphPub.id),MarkerEntity::id,graphPub.id!!)
                 .eq(StrUtil.isNotBlank(graphPub.graphId),MarkerEntity::graphId,graph.graphId!!)
                 .eq(MarkerEntity::state,1))
@@ -241,7 +245,7 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
             markerPubService.saveBatch(CollUtil.newArrayList(markerPubList))
         }
         /** 设置表明,查询 */
-        val relationList = relationService.list(Wrappers.lambdaQuery(RelationEntity::class.java)
+        val relationList = relationService.list(KtQueryWrapper(RelationEntity())
                 .eq(StrUtil.isNotBlank(graphPub.id),RelationEntity::id,graphPub.id!!)
                 .eq(StrUtil.isNotBlank(graphPub.graphId),RelationEntity::graphId,graph.graphId!!)
                 .eq(RelationEntity::state,1))
@@ -263,7 +267,7 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
         }
 
         /** 设置表明,查询 */
-        val anchorList = anchorService.list(Wrappers.lambdaQuery(AnchorEntity::class.java)
+        val anchorList = anchorService.list(KtQueryWrapper(AnchorEntity())
                 .eq(StrUtil.isNotBlank(graphPub.id),AnchorEntity::id,graphPub.id!!)
                 .eq(StrUtil.isNotBlank(graphPub.graphId),AnchorEntity::graphId,graph.graphId!!)
                 .eq(AnchorEntity::state,1))
@@ -283,7 +287,6 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
             }
             anchorPubService.saveBatch(CollUtil.newArrayList(anchorPubList))
         }
-
         /** 清除草稿箱图 */
         delOldData(graph1)
         /** 对象列表 */