优化接口传参
This commit is contained in:
parent
3044462c09
commit
13900a0c4b
@ -51,31 +51,11 @@ public class ExaminePlanController {
|
||||
@Resource
|
||||
private HttpServerConfig httpServerConfig;
|
||||
|
||||
@GetMapping("/getTaskList")
|
||||
@GetMapping("/getExaminePlanPage")
|
||||
@ApiOperation("分页查询检修计划")
|
||||
public ResponseResult getExaminePlanList(Page<Map<String, Object>> page, String configName, String bindStatus) {
|
||||
LambdaQueryWrapper<ExaminePlan> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(configName)) {
|
||||
queryWrapper.like(ExaminePlan::getConfigName, configName);
|
||||
}
|
||||
if (StrUtil.isNotBlank(bindStatus)) {
|
||||
if ("0".equals(bindStatus)) {
|
||||
queryWrapper.isNull(ExaminePlan::getDeviceList).or().eq(ExaminePlan::getDeviceList, "");
|
||||
} else {
|
||||
queryWrapper.isNotNull(ExaminePlan::getDeviceList).ne(ExaminePlan::getDeviceList, "");
|
||||
}
|
||||
}
|
||||
Page<Map<String, Object>> mapPage = examinePlanService.pageMaps(page, queryWrapper);
|
||||
List<Map<String, Object>> records = mapPage.getRecords();
|
||||
records.forEach(r -> {
|
||||
if (!Objects.isNull(r.get("stationId"))) {
|
||||
String stationId = r.get("stationId").toString();
|
||||
Substation substation = substationService.getById(stationId);
|
||||
r.put("isStationFlag", substation.getIsStationFlag());
|
||||
r.put("online", substation.getOnline());
|
||||
}
|
||||
});
|
||||
mapPage.setRecords(records);
|
||||
public ResponseResult getExaminePlanPage(Page<Map<String, Object>> page, String stationId, String configName,
|
||||
String bindStatus) {
|
||||
Page<Map<String, Object>> mapPage = examinePlanService.getExaminePlanPage(page, stationId, configName, bindStatus);
|
||||
return ResponseResult.successData(mapPage);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class TaskController {
|
||||
|
||||
@GetMapping("/getTaskList")
|
||||
@ApiOperation("分页查询巡视任务")
|
||||
public ResponseResult getTaskList(Page<Map<String, Object>> page, String type, String taskName, String enable,
|
||||
public ResponseResult getTaskList(Page<Map<String, Object>> page,String stationId, String type, String taskName, String enable,
|
||||
String taskType,
|
||||
String taskTodoType,
|
||||
String startDate,
|
||||
@ -74,7 +74,7 @@ public class TaskController {
|
||||
if (StrUtil.isBlank(type)) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
Page<Map<String, Object>> taskList = taskService.getTaskList(page, startDate, endDate, type, taskName, enable
|
||||
Page<Map<String, Object>> taskList = taskService.getTaskList(page,stationId, startDate, endDate, type, taskName, enable
|
||||
, taskType, taskTodoType);
|
||||
return ResponseResult.successData(taskList);
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.yfd.platform.modules.patroltask.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.patroltask.domain.ExaminePlan;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 检修计划表 Mapper 接口
|
||||
@ -13,4 +16,14 @@ import com.yfd.platform.modules.patroltask.domain.ExaminePlan;
|
||||
*/
|
||||
public interface ExaminePlanMapper extends BaseMapper<ExaminePlan> {
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询检修计划
|
||||
* 参数说明 page 分页参数
|
||||
* 参数说明 stationId 变电站id
|
||||
* 参数说明 configName 检修计划名称
|
||||
* 参数说明 bindStatus 绑定状态
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<java.util.Map<java.lang.String,java.lang.Object>>
|
||||
***********************************/
|
||||
Page<Map<String, Object>> getExaminePlanPage(Page<Map<String, Object>> page, String stationId, String configName, String bindStatus);
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.util.Map;
|
||||
*/
|
||||
public interface TaskMapper extends BaseMapper<Task> {
|
||||
|
||||
Page<Map<String, Object>> getTaskList(Page<Map<String, Object>> page, String startDate, String endDate,
|
||||
Page<Map<String, Object>> getTaskList(Page<Map<String, Object>> page,String stationId, String startDate, String endDate,
|
||||
String type, String taskName, String enable, String taskType,
|
||||
String taskTodoType);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.patroltask.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationDevice;
|
||||
import com.yfd.platform.modules.patroltask.domain.ExaminePlan;
|
||||
@ -31,4 +32,14 @@ public interface IExaminePlanService extends IService<ExaminePlan> {
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.basedata.domain.SubstationDevice>
|
||||
***********************************/
|
||||
List<SubstationDevice> getBindExamineDevice(String id);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询检修计划
|
||||
* 参数说明 page 分页参数
|
||||
* 参数说明 stationId 变电站id
|
||||
* 参数说明 configName 检修计划名称
|
||||
* 参数说明 bindStatus 绑定状态
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<java.util.Map<java.lang.String,java.lang.Object>>
|
||||
***********************************/
|
||||
Page<Map<String, Object>> getExaminePlanPage(Page<Map<String, Object>> page, String stationId, String configName, String bindStatus);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public interface ITaskService extends IService<Task> {
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<java.util.Map<java.lang.String,java.lang
|
||||
* .Object>>
|
||||
***********************************/
|
||||
Page<Map<String, Object>> getTaskList(Page<Map<String, Object>> page, String startDate, String endDate,
|
||||
Page<Map<String, Object>> getTaskList(Page<Map<String, Object>> page,String stationId, String startDate, String endDate,
|
||||
String type, String taskName, String enable, String taskType, String taskTodoType) throws ParseException;
|
||||
|
||||
/**********************************
|
||||
|
@ -3,6 +3,7 @@ package com.yfd.platform.modules.patroltask.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationBay;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationComponent;
|
||||
@ -45,6 +46,9 @@ public class ExaminePlanServiceImpl extends ServiceImpl<ExaminePlanMapper, Exami
|
||||
|
||||
@Resource
|
||||
private SubstationDeviceMapper substationDeviceMapper;
|
||||
@Resource
|
||||
private ExaminePlanMapper examinePlanMapper;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据Id查询关联信息
|
||||
* 参数说明 id
|
||||
@ -129,4 +133,20 @@ public class ExaminePlanServiceImpl extends ServiceImpl<ExaminePlanMapper, Exami
|
||||
List<SubstationDevice> deviceList = substationDeviceMapper.selectList(queryWrapper);
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询检修计划
|
||||
* 参数说明 page 分页参数
|
||||
* 参数说明 stationId 变电站id
|
||||
* 参数说明 configName 检修计划名称
|
||||
* 参数说明 bindStatus 绑定状态
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<java.util.Map<java.lang.String,java.lang.Object>>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<Map<String, Object>> getExaminePlanPage(Page<Map<String, Object>> page, String stationId,
|
||||
String configName, String bindStatus) {
|
||||
return examinePlanMapper.getExaminePlanPage(page, stationId, configName, bindStatus);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -164,10 +164,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
||||
* .Object>>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<Map<String, Object>> getTaskList(Page<Map<String, Object>> page, String startDate, String endDate,
|
||||
public Page<Map<String, Object>> getTaskList(Page<Map<String, Object>> page,String stationId, String startDate, String endDate,
|
||||
String type, String taskName, String enable, String taskType,
|
||||
String taskTodoType) throws ParseException {
|
||||
Page<Map<String, Object>> mapPage = taskMapper.getTaskList(page, startDate, endDate, type, taskName, enable,
|
||||
Page<Map<String, Object>> mapPage = taskMapper.getTaskList(page,stationId, startDate, endDate, type, taskName, enable,
|
||||
taskType, taskTodoType);
|
||||
return mapPage;
|
||||
}
|
||||
|
@ -2,4 +2,26 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yfd.platform.modules.patroltask.mapper.ExaminePlanMapper">
|
||||
|
||||
<select id="getExaminePlanPage" resultType="java.util.Map">
|
||||
SELECT
|
||||
iep.*,ss.is_station_flag,ss.`online`
|
||||
FROM
|
||||
`iis_examine_plan` iep
|
||||
INNER JOIN iis_substation ss ON iep.station_id = ss.station_id
|
||||
WHERE iep.station_id=#{stationId}
|
||||
<if test="configName != null and configName != ''">
|
||||
AND iepconfig_name LIKE concat('%',#{configName},'%')
|
||||
</if>
|
||||
<choose>
|
||||
<when test="bindStatus == 0">
|
||||
<!-- 当 bindStatus 等于 0 时执行的逻辑 -->
|
||||
AND (iep.device_list IS NULL OR iep.device_list='')
|
||||
</when>
|
||||
<otherwise>
|
||||
<!-- 当 bindStatus 不等于 0 时执行的逻辑 -->
|
||||
AND (iep.device_list IS NOT NULL AND iep.device_list!='')
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.yfd.platform.modules.patroltask.mapper.TaskMapper">
|
||||
<select id="getTaskList" resultType="java.util.Map">
|
||||
SELECT t.*,s.is_station_flag,s.station_id FROM `iis_task` t left join iis_substation s on t.station_code=s.station_code
|
||||
WHERE 1 = 1
|
||||
WHERE s.station_id = #{stationId}
|
||||
and t.datastatus != '3'
|
||||
<if test="startDate != null and startDate != ''">
|
||||
and str_to_date(t.fixed_start_time, '%Y-%m-%d') >= #{startDate}
|
||||
|
Loading…
Reference in New Issue
Block a user