jiangping
2024-09-24 6a2689a44840490a64cf66b37eb09e45eb1da244
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java
@@ -14,6 +14,7 @@
import com.doumee.dao.business.join.PlatformJoinMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.openapi.response.PlatformNumByStatusResponse;
import com.doumee.dao.openapi.response.PlatformStatusListResponse;
import com.doumee.service.business.PlatformDeviceService;
import com.doumee.service.business.PlatformService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -333,6 +334,35 @@
    @Override
    public List<PlatformStatusListResponse>  getPlatformStatusList(){
        List<Platform> platformList =  platformJoinMapper.selectJoinList(Platform.class,new MPJLambdaWrapper<Platform>()
                .selectAll(Platform.class)
                .select(" ( select count(1) from platform_job pj where t.id = pj.PLATFORM_ID and pj.STATUS = "+Constants.PlatformJobStatus.WORKING.getKey()+" ) as workStatus ")
                .select(" ( select pj.CAR_CODE_FRONT from platform_job pj where t.id = pj.PLATFORM_ID and pj.STATUS = "+Constants.PlatformJobStatus.WORKING.getKey()+" limit 1  ) as workCarCode ")
                .eq(Platform::getIsdeleted,Constants.ZERO)
        );
        List<PlatformStatusListResponse> platformStatusListResponses = new ArrayList<>();
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformList)){
            for (Platform platform:platformList) {
                PlatformStatusListResponse response = new PlatformStatusListResponse();
                response.setPlatformHkId(platform.getHkId());
                response.setPlatformName(platform.getName());
                response.setStatus(platform.getPlatformStatus());
                if(Constants.equalsInteger(platform.getPlatformStatus(),Constants.ONE)){
                    response.setCarCode(platform.getWorkCarCode());
                }
            }
        }
        return platformStatusListResponses;
    }
}