更新代码

This commit is contained in:
xiao-fajia 2024-09-25 18:15:11 +08:00
parent 1f7788224b
commit ff665a49cf
3 changed files with 45 additions and 0 deletions

View File

@ -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<DlRepairOther> list = dlRepairOtherService.list(new LambdaQueryWrapper<DlRepairOther>().eq(DlRepairOther::getName, name));
return success(list.stream().max(Comparator.comparing(DlRepairOther::getCreateTime)).orElse(null));
}
}

View File

@ -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<RepairProject> list = repairProjectService.list(new LambdaQueryWrapper<RepairProject>().eq(RepairProject::getName, name));
return success(list.stream().max(Comparator.comparing(RepairProject::getCreateTime)).orElse(null));
}
}

View File

@ -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<RepairWares> list = waresService.list(new LambdaQueryWrapper<RepairWares>().eq(RepairWares::getName, name));
return success(list.stream().max(Comparator.comparing(RepairWares::getCreateTime)).orElse(null));
}
}