新增主设备维修记录逻辑
This commit is contained in:
parent
e056f1931f
commit
87c6d31eb4
@ -0,0 +1,103 @@
|
||||
package com.yfd.platform.modules.basedata.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationMaindeviceResume;
|
||||
import com.yfd.platform.modules.basedata.service.ISubstationMaindeviceResumeService;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 主设备维修记录
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhengsl
|
||||
* @since 2025-06-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/basedata/substation-maindevice-resume")
|
||||
@Api(value = "SubstationMaindeviceResumeController", tags = "主设备维修记录")
|
||||
public class SubstationMaindeviceResumeController {
|
||||
|
||||
@Resource
|
||||
private ISubstationMaindeviceResumeService resumeService;
|
||||
|
||||
/**
|
||||
* 分页查看主设备维修记录
|
||||
*
|
||||
* @param page 分页参宿和
|
||||
* @param stationCode 变电站编码
|
||||
* @param areaId 区域id
|
||||
* @param bayId 间隔id
|
||||
* @param deviceType 主设备类型
|
||||
* @param mainDeviceName 主设备名称
|
||||
* @param startDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getMaindeviceResume")
|
||||
@ApiOperation("分页查看主设备维修记录")
|
||||
public ResponseResult getMaindeviceResume(Page<Map<String, Object>> page, String stationCode, String areaId,
|
||||
String bayId, String deviceType, String mainDeviceName,
|
||||
String startDate, String endDate) {
|
||||
|
||||
Page<Map<String, Object>> mapPage = resumeService.getMaindeviceResume(page, stationCode, areaId, bayId,
|
||||
deviceType, mainDeviceName, startDate, endDate);
|
||||
return ResponseResult.successData(mapPage);
|
||||
}
|
||||
|
||||
@GetMapping("/getMaindeviceResumeById")
|
||||
@ApiOperation("通过id查询主设备维修记录")
|
||||
public ResponseResult getMaindeviceResumeById(String id) {
|
||||
if (id == null) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
SubstationMaindeviceResume substationMaindeviceResume = resumeService.getById(id);
|
||||
return ResponseResult.successData(substationMaindeviceResume);
|
||||
}
|
||||
|
||||
@PostMapping("/addMaindeviceResume")
|
||||
@ApiOperation("新增主设备维修记录")
|
||||
public ResponseResult addMaindeviceResume(@RequestBody SubstationMaindeviceResume substationMaindeviceResume) {
|
||||
substationMaindeviceResume.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
substationMaindeviceResume.setLastmodifydate(LocalDateTime.now());
|
||||
boolean isOk = resumeService.saveOrUpdate(substationMaindeviceResume);
|
||||
if (!isOk) {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updateMaindeviceResume")
|
||||
@ApiOperation("修改主设备维修记录")
|
||||
public ResponseResult updateMaindeviceResume(@RequestBody SubstationMaindeviceResume substationMaindeviceResume) {
|
||||
substationMaindeviceResume.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
substationMaindeviceResume.setLastmodifydate(LocalDateTime.now());
|
||||
boolean isOk = resumeService.saveOrUpdate(substationMaindeviceResume);
|
||||
if (!isOk) {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteMaindeviceResume")
|
||||
@ApiOperation("删除主设备维修记录")
|
||||
public ResponseResult deleteMaindeviceResume(String id) {
|
||||
if (id == null) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
boolean isOk = resumeService.removeById(id);
|
||||
if (!isOk) {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
}
|
@ -80,6 +80,7 @@ public class SubstationMaindevice implements Serializable {
|
||||
/**
|
||||
* 初始运行时间,设备第一次运行的时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime runTime;
|
||||
|
||||
/**
|
||||
@ -87,6 +88,16 @@ public class SubstationMaindevice implements Serializable {
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 关联点位id,用于展示主设备全景画面
|
||||
*/
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 是否关联点位0:未关联;1:已关联
|
||||
*/
|
||||
private String contactFlag;
|
||||
|
||||
/**
|
||||
* 数据状态
|
||||
*/
|
||||
@ -124,4 +135,5 @@ public class SubstationMaindevice implements Serializable {
|
||||
@TableField("material_id")
|
||||
private String materialId;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,120 @@
|
||||
package com.yfd.platform.modules.basedata.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zhengsl
|
||||
* @since 2025-06-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("iis_substation_maindevice_resume")
|
||||
public class SubstationMaindeviceResume implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 类型:1:缺陷记录;2:大修记录;3:退出再投运记录
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 数据状态
|
||||
*/
|
||||
private String datastatus;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String lastmodifier;
|
||||
|
||||
/**
|
||||
* 最近修改时间
|
||||
*/
|
||||
private LocalDateTime lastmodifydate;
|
||||
|
||||
/**
|
||||
* 备用1
|
||||
*/
|
||||
private String custom1;
|
||||
|
||||
/**
|
||||
* 备用2
|
||||
*/
|
||||
private String custom2;
|
||||
|
||||
/**
|
||||
* 备用3
|
||||
*/
|
||||
private String custom3;
|
||||
|
||||
/**
|
||||
* 主设备id
|
||||
*/
|
||||
private String mainDeviceId;
|
||||
|
||||
/**
|
||||
* 主设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 主设备名称
|
||||
*/
|
||||
private String mainDeviceName;
|
||||
|
||||
/**
|
||||
* 间隔id
|
||||
*/
|
||||
private String bayId;
|
||||
|
||||
/**
|
||||
* 间隔名称
|
||||
*/
|
||||
private String bayName;
|
||||
|
||||
/**
|
||||
* 变电站编号
|
||||
*/
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
* 变电站名称
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 区域id
|
||||
*/
|
||||
private String areaId;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String areaName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.yfd.platform.modules.basedata.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationMaindeviceResume;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhengsl
|
||||
* @since 2025-06-05
|
||||
*/
|
||||
public interface SubstationMaindeviceResumeMapper extends BaseMapper<SubstationMaindeviceResume> {
|
||||
|
||||
Page<Map<String, Object>> getMaindeviceResume(Page<Map<String, Object>> page, String stationCode, String areaId,
|
||||
String bayId, String deviceType, String mainDeviceName,
|
||||
String startDate, String endDate);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.yfd.platform.modules.basedata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationMaindeviceResume;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zhengsl
|
||||
* @since 2025-06-05
|
||||
*/
|
||||
public interface ISubstationMaindeviceResumeService extends IService<SubstationMaindeviceResume> {
|
||||
|
||||
Page<Map<String, Object>> getMaindeviceResume(Page<Map<String, Object>> page, String stationCode, String areaId,
|
||||
String bayId, String deviceType, String mainDeviceName,
|
||||
String startDate, String endDate);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.yfd.platform.modules.basedata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationMaindeviceResume;
|
||||
import com.yfd.platform.modules.basedata.mapper.SubstationMaindeviceResumeMapper;
|
||||
import com.yfd.platform.modules.basedata.service.ISubstationMaindeviceResumeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhengsl
|
||||
* @since 2025-06-05
|
||||
*/
|
||||
@Service
|
||||
public class SubstationMaindeviceResumeServiceImpl extends ServiceImpl<SubstationMaindeviceResumeMapper, SubstationMaindeviceResume> implements ISubstationMaindeviceResumeService {
|
||||
|
||||
@Resource
|
||||
private SubstationMaindeviceResumeMapper maindeviceResumeMapper;
|
||||
@Override
|
||||
public Page<Map<String, Object>> getMaindeviceResume(Page<Map<String, Object>> page, String stationCode, String areaId, String bayId, String deviceType, String mainDeviceName, String startDate, String endDate) {
|
||||
return maindeviceResumeMapper.getMaindeviceResume(page, stationCode, areaId, bayId,deviceType, mainDeviceName,startDate,endDate);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yfd.platform.modules.basedata.mapper.SubstationMaindeviceResumeMapper">
|
||||
|
||||
<select id="getMaindeviceResume" resultType="java.util.Map">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
iis_substation_maindevice_resume
|
||||
WHERE 1=1
|
||||
<if test="stationCode != null and stationCode != ''">
|
||||
AND station_code= #{stationCode}
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
AND area_id= #{areaId}
|
||||
</if>
|
||||
<if test="bayId != null and bayId != ''">
|
||||
AND bay_id= #{bayId}
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
AND device_type= #{deviceType}
|
||||
</if>
|
||||
<if test="mainDeviceName != null and mainDeviceName != ''">
|
||||
AND main_device_name LIKE CONCAT('%',#{mainDeviceName},'%')
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
AND str_to_date(resume_date, '%Y-%m-%d %H:%i:%s') >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
AND resume_date < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user