From b6294bd36b3023e18606c77553fe136e6500a4b2 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Wed, 17 Apr 2024 15:42:34 +0800
Subject: [PATCH] 完善DB数据配置

---
 src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java b/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java
index 3c2e22a..afaab62 100644
--- a/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java
+++ b/src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java
@@ -11,6 +11,7 @@
 import com.dji.sample.patches.model.Param.PatchesParam;
 import com.dji.sample.patches.model.entity.LotInfo;
 import com.dji.sample.patches.service.GetPatchesService;
+import com.dji.sample.wayline.model.entity.WaylineFileEntity;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import java.util.List;
@@ -23,9 +24,16 @@
     @Autowired
     private IFileMapper fileMapper;
 
+    /**
+     * 分页获取数据的接口实现。
+     * @param param 包含分页信息和查询条件的工作空间ID。
+     * @return 返回一个包含查询结果和分页信息的PaginationData对象。
+     */
     @Override
     public PaginationData<LotInfo> limitGet(PatchesParam param) {
-        Page<LotInfo> page = mapper.selectPage(new Page<LotInfo>(param.getPage(), param.getPageSize()), null);
+        Page<LotInfo> page = mapper.selectPage(new Page<LotInfo>(param.getPage(), param.getPageSize()),
+                new LambdaQueryWrapper<LotInfo>()
+                        .eq(LotInfo::getWorkspaceId,param.getWorkspaceId()));
         List<LotInfo> records = page.getRecords()
                 .stream()
                 .collect(Collectors.toList());
@@ -36,7 +44,13 @@
     public void delPatches() {
         mapper.delete(null);
     }
-
+    /**
+     * 根据条件获取照片的分页数据
+     *
+     * @param param 包含分页信息和查询条件的参数对象
+     * @param dkbh 查询条件中带有地块编号关键字,用于文件名的模糊搜索
+     * @return 返回照片的分页数据,包括分页信息和照片实体列表
+     */
     @Override
     public PaginationData<MediaFileEntity> getPhoto(PatchesParam param,String dkbh) {
         Page<MediaFileEntity> page=fileMapper.selectPage(new Page<MediaFileEntity>(param.getPage(), param.getPageSize()),
@@ -46,4 +60,28 @@
                 .collect(Collectors.toList());
         return new PaginationData<MediaFileEntity>(records, new Pagination(page));
     }
+    /**
+     * 根据条件获取照片的分页数据
+     *
+     * @param workspaceId 工作空间的ID,用于指定查询的工作空间
+     * @param dkbh 查询条件中带有地块编号关键字,用于文件名的模糊搜索
+     * @return 返回照片的分页数据,包括分页信息和照片实体列表
+     */
+    public List<MediaFileEntity> listPohto(String dkbh,String workspaceId){
+       return fileMapper.selectList(new LambdaQueryWrapper<MediaFileEntity>().like(MediaFileEntity::getFileName, "%" + dkbh + "%")
+               .eq(MediaFileEntity::getWorkspaceId,workspaceId));
+    }
+    /**
+     * 根据地块编号和工作空间ID获取地块信息。
+     * @param dkbh 地块编号,用于查询特定定单的地块信息。
+     * @param workspaceId 工作空间ID,用于查询属于特定工作空间的地块信息。
+     * @return 返回匹配给定地块编号和工作空间ID的地块信息对象。如果找不到匹配的记录,则返回null。
+     */
+    public LotInfo getLotinfo(String dkbh,String workspaceId) {
+       return mapper.selectOne(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getDkbh, dkbh)
+                .eq(LotInfo::getWorkspaceId, workspaceId));
+    }
+    public List<LotInfo>listLotinfo(){
+        return mapper.selectList(null);
+    }
 }

--
Gitblit v1.9.3