refactor(sip): 重构维护记录查询功能
- 在 ApiDataQueryDto 中添加 serialNumber 字段 - 在 DeliveryListMapper.xml 中添加 serialNumber 的查询条件 - 修改 IMaintenanceService 接口,返回类型变更为 List<DeliveryInfoVo.ServiceInfo> - 重构 MaintenanceServiceImpl 中的 query 方法,使用 DeliveryListService 获取数据 - 更新前端模板,显示新的服务信息字段master
parent
3623c5564f
commit
e20f2bbad4
|
@ -209,11 +209,11 @@
|
|||
str=``
|
||||
res.data.forEach((ele)=>{
|
||||
str+=`<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>${ele.startDate}</td>
|
||||
<td>${ele.endDate}</td>
|
||||
<td>${ele.status == 0 ? '有效' : '无效'}</td>
|
||||
<td>${ele.serviceLevel}</td>
|
||||
<td>${ele.serviceDescribe}</td>
|
||||
<td>${ele.serviceStartTime}</td>
|
||||
<td>${ele.serviceEndTime}</td>
|
||||
<td>有效</td>
|
||||
</tr>`
|
||||
})
|
||||
}
|
||||
|
|
|
@ -28,5 +28,6 @@ public class ApiDataQueryDto {
|
|||
@NotNull(message = "查询结束时间不能为空")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date queryEndTime;
|
||||
private String serialNumber;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,10 @@ package com.ruoyi.sip.service;
|
|||
|
||||
import com.ruoyi.sip.domain.MaintenanceRecord;
|
||||
import com.ruoyi.sip.domain.MaintenanceRecordsDto;
|
||||
import com.ruoyi.sip.vo.DeliveryInfoVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMaintenanceService {
|
||||
List<MaintenanceRecord> query(MaintenanceRecordsDto dto);
|
||||
List<DeliveryInfoVo.ServiceInfo> query(MaintenanceRecordsDto dto);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
package com.ruoyi.sip.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.sip.domain.MaintenanceRecord;
|
||||
import com.ruoyi.sip.domain.MaintenanceRecordsDto;
|
||||
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
||||
import com.ruoyi.sip.mapper.MaintenanceMapper;
|
||||
import com.ruoyi.sip.service.IDeliveryListService;
|
||||
import com.ruoyi.sip.service.IMaintenanceService;
|
||||
import com.ruoyi.sip.vo.DeliveryInfoVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -30,10 +36,19 @@ public class MaintenanceServiceImpl implements IMaintenanceService {
|
|||
|
||||
@Resource
|
||||
private MaintenanceMapper mapper;
|
||||
@Autowired
|
||||
private IDeliveryListService deliveryListService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MaintenanceRecord> query(MaintenanceRecordsDto dto) {
|
||||
return mapper.query(dto);
|
||||
public List<DeliveryInfoVo.ServiceInfo> query(MaintenanceRecordsDto dto) {
|
||||
|
||||
ApiDataQueryDto apiDataQueryDto = new ApiDataQueryDto();
|
||||
apiDataQueryDto.setSerialNumber(dto.getSerialNumber());
|
||||
List<DeliveryInfoVo> numberInfo = deliveryListService.getNumberInfo(apiDataQueryDto);
|
||||
if (CollUtil.isEmpty(numberInfo)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return numberInfo.get(0).getServiceInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and t1.updated_at <![CDATA[ <= ]]> #{queryEndTime}
|
||||
</when>
|
||||
</choose>
|
||||
<if test="serialNumber!=null and serialNumber!=''">
|
||||
and t1.serial_number = #{serialNumber}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
Loading…
Reference in New Issue