代码补正
This commit is contained in:
parent
f67a6a1098
commit
0f9fb58281
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.custom.controller.admin;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
|
||||
@ -23,6 +24,7 @@ import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
@ -190,11 +192,13 @@ public class CustomerMainController {
|
||||
@PostMapping("/getByNameAndMobile")
|
||||
@Operation(summary = "根据姓名和电话查询单条记录")
|
||||
public CommonResult<?> getByNameAndMobile(@Valid @RequestBody CustomerMain customerMain) {
|
||||
CustomerMain one = customerMainService.getOne(new LambdaQueryWrapper<CustomerMain>().and(item -> {
|
||||
List<CustomerMain> list = customerMainService.list(new LambdaQueryWrapper<CustomerMain>().and(item -> {
|
||||
item.eq(CustomerMain::getCusName, customerMain.getCusName())
|
||||
.eq(CustomerMain::getPhoneNumber, customerMain.getPhoneNumber());
|
||||
}));
|
||||
return success(one);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
return success(list.get(0));
|
||||
}
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user