Commit 1dd9c450 authored by zhangsen's avatar zhangsen

fix-bug:6065首页报错

parent 0b979bf4
...@@ -28,4 +28,11 @@ public interface IPowerTransferCompanyResourcesService { ...@@ -28,4 +28,11 @@ public interface IPowerTransferCompanyResourcesService {
* @return 车辆状态 * @return 车辆状态
*/ */
PowerTransferCompanyResources getResourceById(String resourceId); PowerTransferCompanyResources getResourceById(String resourceId);
/**
* 根据ID获取资源数量 getResourceById修改
* @param resourceId
* @return
*/
int getCarExecutingCountById(String resourceId, String status);
} }
...@@ -93,4 +93,13 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT ...@@ -93,4 +93,13 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
powerTransferCompanyResourcesQueryWrapper.eq("resources_id", resourceId); powerTransferCompanyResourcesQueryWrapper.eq("resources_id", resourceId);
return powerTransferCompanyResourcesMapper.selectOne(powerTransferCompanyResourcesQueryWrapper); return powerTransferCompanyResourcesMapper.selectOne(powerTransferCompanyResourcesQueryWrapper);
} }
@Override
public int getCarExecutingCountById(String resourceId, String status) {
QueryWrapper<PowerTransferCompanyResources> powerTransferCompanyResourcesQueryWrapper = new QueryWrapper<>();
powerTransferCompanyResourcesQueryWrapper.eq("resources_id", resourceId);
powerTransferCompanyResourcesQueryWrapper.eq("status", status);
powerTransferCompanyResourcesQueryWrapper.eq("is_deleted", 0);
return powerTransferCompanyResourcesMapper.selectCount(powerTransferCompanyResourcesQueryWrapper);
}
} }
...@@ -81,15 +81,17 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa ...@@ -81,15 +81,17 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
if (userCar == null) { if (userCar == null) {
return 0; return 0;
} }
PowerTransferCompanyResources resource = companyResourcesService.getResourceById(userCar.getCarId().toString()); return companyResourcesService.getCarExecutingCountById(userCar.getRecUserId(), "executing");
if (resource == null) { //bug 6065 首页报错,接口selectOne 一个资源对应多条数据。
return 0; // PowerTransferCompanyResources resource = companyResourcesService.getResourceById(userCar.getCarId().toString());
} // if (resource == null) {
if ("executing".equals(resource.getCarStatus())) { // return 0;
return 1; // }
} else { // if ("executing".equals(resource.getCarStatus())) {
return 0; // return 1;
} // } else {
// return 0;
// }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment