提交
This commit is contained in:
@@ -18,5 +18,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface CsEventDetailPOMapper extends BaseMapper<CsEventDetailPO> {
|
||||
|
||||
Page<CsEventDetailVO> queryPage(Page<CsEventDetailVO> returnpage, @Param("csEventDetailPageParm") CsEventDetailParm.CsEventDetailPageParm csEventDetailPageParm);
|
||||
Page<CsEventDetailVO> queryPage(Page<CsEventDetailVO> returnpage, @Param("lineIds") List<String> lineIds);
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import com.njcn.cswarn.pojo.po.CsStatLimitRateDPO;
|
||||
import com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -16,5 +18,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsStatLimitRateDPOMapper extends BaseMapper<CsStatLimitRateDPO> {
|
||||
Page<CsStatLimitRateDVO> queryPage(Page<CsStatLimitRateDVO> returnpage, @Param("csStatLimitRatePageParm") CsStatLimitRatePageParm csStatLimitRatePageParm);
|
||||
Page<CsStatLimitRateDVO> queryPage(Page<CsStatLimitRateDVO> returnpage, @Param("lineIds") List<String> lineIds);
|
||||
}
|
||||
@@ -40,33 +40,12 @@
|
||||
|
||||
<select id="queryPage" resultType="com.njcn.cswarn.pojo.vo.CsEventDetailVO">
|
||||
SELECT
|
||||
temp.*, cs.*
|
||||
*
|
||||
FROM
|
||||
cs_event_detail cs
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
a.line_id,
|
||||
a. NAME line_name,
|
||||
c.id project_id,
|
||||
c. NAME project_name
|
||||
FROM
|
||||
cs_line a,
|
||||
cs_project_equipment b,
|
||||
cs_project c
|
||||
WHERE
|
||||
1 = 1
|
||||
AND c.id = b.project_id
|
||||
AND b.equipment_id = a.dev_id
|
||||
<if test="csEventDetailPageParm.projectId != null and csEventDetailPageParm.projectId != ''">
|
||||
AND c.id = #{csEventDetailPageParm.projectId }
|
||||
</if>
|
||||
) temp ON cs.measurement_point_id = temp.line_id
|
||||
where 1=1
|
||||
<if test="csEventDetailPageParm.startTime != null and csEventDetailPageParm.startTime != ''">
|
||||
AND cs.start_time >= #{csEventDetailPageParm.startTime }
|
||||
</if>
|
||||
<if test="csEventDetailPageParm.endTime != null and csEventDetailPageParm.endTime != ''">
|
||||
AND cs.start_time <= #{csEventDetailPageParm.endTime }
|
||||
</if>
|
||||
cs_event_detail a
|
||||
where a.measurement_point_id in
|
||||
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -100,34 +100,14 @@
|
||||
</sql>
|
||||
|
||||
<select id="queryPage" resultType="com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO">
|
||||
|
||||
SELECT
|
||||
temp.*, cs.*
|
||||
*
|
||||
FROM
|
||||
cs_stat_limit_rate_d cs
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
a.line_id,
|
||||
a. NAME line_name,
|
||||
c.id project_id,
|
||||
c. NAME project_name
|
||||
FROM
|
||||
cs_line a,
|
||||
cs_project_equipment b,
|
||||
cs_project c
|
||||
WHERE
|
||||
1 = 1
|
||||
AND c.id = b.project_id
|
||||
AND b.equipment_id = a.dev_id
|
||||
<if test="csStatLimitRatePageParm.projectId != null and csStatLimitRatePageParm.projectId != ''">
|
||||
AND c.id = #{csStatLimitRatePageParm.projectId }
|
||||
</if>
|
||||
) temp ON cs.my_index = temp.line_id
|
||||
where 1=1
|
||||
<if test="csStatLimitRatePageParm.startTime != null and csStatLimitRatePageParm.startTime != ''">
|
||||
AND cs.time_id >= #{csStatLimitRatePageParm.startTime }
|
||||
</if>
|
||||
<if test="csStatLimitRatePageParm.endTime != null and csStatLimitRatePageParm.endTime != ''">
|
||||
AND cs.time_id <= #{csStatLimitRatePageParm.endTime }
|
||||
</if>
|
||||
cs_stat_limit_rate_d a
|
||||
where a.my_index in
|
||||
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -3,6 +3,9 @@ package com.njcn.cswarn.service.impl;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.cswarn.mapper.CsEventDetailPOMapper;
|
||||
import com.njcn.cswarn.pojo.parm.CsEventDetailParm;
|
||||
import com.njcn.cswarn.pojo.po.CsEventDetailPO;
|
||||
@@ -10,9 +13,14 @@ import com.njcn.cswarn.pojo.vo.CsEventDetailVO;
|
||||
import com.njcn.cswarn.service.CsEventDetailPOService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,11 +34,25 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CsEventDetailPOServiceImpl extends ServiceImpl<CsEventDetailPOMapper, CsEventDetailPO> implements CsEventDetailPOService {
|
||||
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
@Override
|
||||
public IPage<CsEventDetailVO> queryPage(CsEventDetailParm.CsEventDetailPageParm csEventDetailPageParm) {
|
||||
Page<CsEventDetailVO> returnpage = new Page<> (csEventDetailPageParm.getPageNum ( ), csEventDetailPageParm.getPageSize ( ));
|
||||
returnpage = this.getBaseMapper().queryPage(returnpage,csEventDetailPageParm);
|
||||
List<String> lineIds = new ArrayList<>();
|
||||
if(Objects.nonNull(csEventDetailPageParm.getLineId())){
|
||||
lineIds.add(csEventDetailPageParm.getLineId());
|
||||
}else {
|
||||
LineParamDTO lineParamDTO = new LineParamDTO();
|
||||
BeanUtils.copyProperties(csEventDetailPageParm, lineParamDTO);
|
||||
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
||||
List<String> collect = data.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
lineIds.addAll(collect);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(lineIds)){
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
returnpage = this.getBaseMapper().queryPage(returnpage,lineIds);
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,25 @@ package com.njcn.cswarn.service.impl;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.cswarn.mapper.CsStatLimitRateDPOMapper;
|
||||
import com.njcn.cswarn.pojo.parm.CsStatLimitRatePageParm;
|
||||
import com.njcn.cswarn.pojo.po.CsStatLimitRateDPO;
|
||||
import com.njcn.cswarn.pojo.vo.CsEventDetailVO;
|
||||
import com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO;
|
||||
import com.njcn.cswarn.service.CsStatLimitRateDPOService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -19,12 +32,29 @@ import org.springframework.stereotype.Service;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CsStatLimitRateDPOServiceImpl extends ServiceImpl<CsStatLimitRateDPOMapper, CsStatLimitRateDPO> implements CsStatLimitRateDPOService {
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
public IPage<CsStatLimitRateDVO> queryPage(CsStatLimitRatePageParm csStatLimitRatePageParm) {
|
||||
Page<CsStatLimitRateDVO> returnpage = new Page<> (csStatLimitRatePageParm.getPageNum ( ), csStatLimitRatePageParm.getPageSize ( ));
|
||||
returnpage = this.getBaseMapper().queryPage(returnpage,csStatLimitRatePageParm);
|
||||
List<String> lineIds = new ArrayList<>();
|
||||
if(Objects.nonNull(csStatLimitRatePageParm.getLineId())){
|
||||
lineIds.add(csStatLimitRatePageParm.getLineId());
|
||||
}else {
|
||||
LineParamDTO lineParamDTO = new LineParamDTO();
|
||||
BeanUtils.copyProperties(csStatLimitRatePageParm, lineParamDTO);
|
||||
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
||||
List<String> collect = data.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
lineIds.addAll(collect);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(lineIds)){
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
returnpage = this.getBaseMapper().queryPage(returnpage,lineIds);
|
||||
return returnpage;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user