diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/other/controller/admin/DlRepairOtherController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/other/controller/admin/DlRepairOtherController.java index e892afbe..bd059a11 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/other/controller/admin/DlRepairOtherController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/other/controller/admin/DlRepairOtherController.java @@ -5,12 +5,16 @@ import cn.iocoder.yudao.module.other.entity.DlRepairOther; import cn.iocoder.yudao.module.other.service.DlRepairOtherService; import cn.iocoder.yudao.module.other.vo.DlRepairOtherReqVO; import cn.iocoder.yudao.module.other.vo.DlRepairOtherRespVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.Comparator; +import java.util.List; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** @@ -73,5 +77,12 @@ public class DlRepairOtherController { dlRepairOtherService.deleteOther(id); return CommonResult.ok(); } + + @GetMapping("/getByName") + @Operation(summary = "根据名称获取最新的数据") + public CommonResult getOtherByName(@RequestParam("name") String name){ + List list = dlRepairOtherService.list(new LambdaQueryWrapper().eq(DlRepairOther::getName, name)); + return success(list.stream().max(Comparator.comparing(DlRepairOther::getCreateTime)).orElse(null)); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java index 00b2d455..497366ce 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.project.service.RepairProjectService; import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO; import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO; import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; @@ -19,6 +20,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Comparator; +import java.util.List; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 维修项目") @@ -117,4 +121,16 @@ public class RepairProjectController { return success(repairProjectService.queryListPage(pageReqVO,page)); } + /** + * 根据名称获取最新的数据 + * + * @author 小李 + * @date 18:01 2024/9/25 + **/ + @GetMapping("/getByName") + @Operation(summary = "根据名称获取最新的数据") + public CommonResult getRepairProjectByName(@RequestParam("name") String name) { + List list = repairProjectService.list(new LambdaQueryWrapper().eq(RepairProject::getName, name)); + return success(list.stream().max(Comparator.comparing(RepairProject::getCreateTime)).orElse(null)); + } } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairWaresController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairWaresController.java index 344ca666..8ee4ad67 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairWaresController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairWaresController.java @@ -1,10 +1,12 @@ package cn.iocoder.yudao.module.project.controller.admin; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.project.service.RepairWaresService; import cn.iocoder.yudao.module.project.vo.RepairWaresPageReqVO; import cn.iocoder.yudao.module.project.vo.RepairWaresRespVO; import cn.iocoder.yudao.module.project.vo.RepairWaresSaveReqVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; @@ -17,6 +19,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Comparator; +import java.util.List; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 配件库") @@ -113,5 +118,18 @@ public class RepairWaresController { return success(waresService.getWaresPage(pageReqVO, page)); } + /** + * 根据名称获取最新的数据 + * + * @author 小李 + * @date 18:03 2024/9/25 + **/ + @GetMapping("/getByName") + @Operation(summary = "根据名称获取最新的数据") + public CommonResult getWaresByName(@RequestParam("name") String name) { + List list = waresService.list(new LambdaQueryWrapper().eq(RepairWares::getName, name)); + return success(list.stream().max(Comparator.comparing(RepairWares::getCreateTime)).orElse(null)); + } + } \ No newline at end of file