Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhangxuanming 2024-12-30 11:41:17 +08:00
commit dc7cd7be18
18 changed files with 1655 additions and 12 deletions

View File

@ -175,6 +175,9 @@ create table dv_check_record (
machinery_brand varchar(255) comment '品牌', machinery_brand varchar(255) comment '品牌',
machinery_spec varchar(255) comment '规格型号', machinery_spec varchar(255) comment '规格型号',
check_time datetime not null comment '点检时间', check_time datetime not null comment '点检时间',
user_id bigint(20) comment '点检人',
user_name varchar(64) comment '点检人用户名',
nick_name varchar(255) comment '点检人名称',
status varchar(64) default 'PREPARE' comment '状态', status varchar(64) default 'PREPARE' comment '状态',
remark varchar(500) default '' comment '备注', remark varchar(500) default '' comment '备注',
attr1 varchar(64) default null comment '预留字段1', attr1 varchar(64) default null comment '预留字段1',
@ -236,6 +239,9 @@ create table dv_mainten_record (
machinery_brand varchar(255) comment '品牌', machinery_brand varchar(255) comment '品牌',
machinery_spec varchar(255) comment '规格型号', machinery_spec varchar(255) comment '规格型号',
mainten_time datetime not null comment '保养时间', mainten_time datetime not null comment '保养时间',
user_id bigint(20) comment '用户ID',
user_name varchar(64) comment '用户名',
nick_name varchar(128) comment '昵称',
status varchar(64) default 'PREPARE' comment '状态', status varchar(64) default 'PREPARE' comment '状态',
remark varchar(500) default '' comment '备注', remark varchar(500) default '' comment '备注',
attr1 varchar(64) default null comment '预留字段1', attr1 varchar(64) default null comment '预留字段1',

View File

@ -42,6 +42,14 @@ logging:
# Spring配置 # Spring配置
spring: spring:
rabbitmq:
host: 192.168.1.194 # RabbitMQ 服务的地址
port: 5672 # RabbitMQ 服务的端口
username: mes # RabbitMQ 服务的账号
password: mes # RabbitMQ 服务的密码
virtual-host: / # 默认虚拟主机
consumer:
batchSize: 100 # 消费者每次拉取消息的数量
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
@ -63,7 +71,7 @@ spring:
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
host: localhost host: 192.168.1.254
# 端口默认为6379 # 端口默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
@ -126,7 +134,7 @@ xss:
#Mino配置 #Mino配置
minio: minio:
url: http://127.0.0.1:9000 url: http://192.168.1.254:9000
accessKey: your_key accessKey: minioadmin
secretKey: your_secret secretKey: minioadmin
bucketName: ktg-mes bucketName: lx-mes

View File

@ -60,6 +60,16 @@
<groupId>commons-collections</groupId> <groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId> <artifactId>commons-collections</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!--webSocket-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.2.13.RELEASE</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,104 @@
package com.ktg.mes.dv.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.dv.domain.DvMaintenRecord;
import com.ktg.mes.dv.service.IDvMaintenRecordService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 设备保养记录Controller
*
* @author yinjinlu
* @date 2024-12-26
*/
@RestController
@RequestMapping("/mes/dv/maintenrecord")
public class DvMaintenRecordController extends BaseController
{
@Autowired
private IDvMaintenRecordService dvMaintenRecordService;
/**
* 查询设备保养记录列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:maintenrecord:list')")
@GetMapping("/list")
public TableDataInfo list(DvMaintenRecord dvMaintenRecord)
{
startPage();
List<DvMaintenRecord> list = dvMaintenRecordService.selectDvMaintenRecordList(dvMaintenRecord);
return getDataTable(list);
}
/**
* 导出设备保养记录列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:maintenrecord:export')")
@Log(title = "设备保养记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DvMaintenRecord dvMaintenRecord)
{
List<DvMaintenRecord> list = dvMaintenRecordService.selectDvMaintenRecordList(dvMaintenRecord);
ExcelUtil<DvMaintenRecord> util = new ExcelUtil<DvMaintenRecord>(DvMaintenRecord.class);
util.exportExcel(response, list, "设备保养记录数据");
}
/**
* 获取设备保养记录详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:dv:maintenrecord:query')")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
{
return AjaxResult.success(dvMaintenRecordService.selectDvMaintenRecordByRecordId(recordId));
}
/**
* 新增设备保养记录
*/
@PreAuthorize("@ss.hasPermi('mes:dv:maintenrecord:add')")
@Log(title = "设备保养记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DvMaintenRecord dvMaintenRecord)
{
return toAjax(dvMaintenRecordService.insertDvMaintenRecord(dvMaintenRecord));
}
/**
* 修改设备保养记录
*/
@PreAuthorize("@ss.hasPermi('mes:dv:maintenrecord:edit')")
@Log(title = "设备保养记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DvMaintenRecord dvMaintenRecord)
{
return toAjax(dvMaintenRecordService.updateDvMaintenRecord(dvMaintenRecord));
}
/**
* 删除设备保养记录
*/
@PreAuthorize("@ss.hasPermi('mes:dv:maintenrecord:remove')")
@Log(title = "设备保养记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable Long[] recordIds)
{
return toAjax(dvMaintenRecordService.deleteDvMaintenRecordByRecordIds(recordIds));
}
}

View File

@ -0,0 +1,104 @@
package com.ktg.mes.dv.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.dv.domain.DvMaintenRecordLine;
import com.ktg.mes.dv.service.IDvMaintenRecordLineService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 设备保养记录行Controller
*
* @author yinjinlu
* @date 2024-12-26
*/
@RestController
@RequestMapping("/mes/dv/maintenrecordline")
public class DvMaintenRecordLineController extends BaseController
{
@Autowired
private IDvMaintenRecordLineService dvMaintenRecordLineService;
/**
* 查询设备保养记录行列表
*/
@PreAuthorize("@ss.hasPermi('dv:maintenrecordline:list')")
@GetMapping("/list")
public TableDataInfo list(DvMaintenRecordLine dvMaintenRecordLine)
{
startPage();
List<DvMaintenRecordLine> list = dvMaintenRecordLineService.selectDvMaintenRecordLineList(dvMaintenRecordLine);
return getDataTable(list);
}
/**
* 导出设备保养记录行列表
*/
@PreAuthorize("@ss.hasPermi('dv:maintenrecordline:export')")
@Log(title = "设备保养记录行", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DvMaintenRecordLine dvMaintenRecordLine)
{
List<DvMaintenRecordLine> list = dvMaintenRecordLineService.selectDvMaintenRecordLineList(dvMaintenRecordLine);
ExcelUtil<DvMaintenRecordLine> util = new ExcelUtil<DvMaintenRecordLine>(DvMaintenRecordLine.class);
util.exportExcel(response, list, "设备保养记录行数据");
}
/**
* 获取设备保养记录行详细信息
*/
@PreAuthorize("@ss.hasPermi('dv:maintenrecordline:query')")
@GetMapping(value = "/{lineId}")
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
{
return AjaxResult.success(dvMaintenRecordLineService.selectDvMaintenRecordLineByLineId(lineId));
}
/**
* 新增设备保养记录行
*/
@PreAuthorize("@ss.hasPermi('dv:maintenrecordline:add')")
@Log(title = "设备保养记录行", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DvMaintenRecordLine dvMaintenRecordLine)
{
return toAjax(dvMaintenRecordLineService.insertDvMaintenRecordLine(dvMaintenRecordLine));
}
/**
* 修改设备保养记录行
*/
@PreAuthorize("@ss.hasPermi('dv:maintenrecordline:edit')")
@Log(title = "设备保养记录行", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DvMaintenRecordLine dvMaintenRecordLine)
{
return toAjax(dvMaintenRecordLineService.updateDvMaintenRecordLine(dvMaintenRecordLine));
}
/**
* 删除设备保养记录行
*/
@PreAuthorize("@ss.hasPermi('dv:maintenrecordline:remove')")
@Log(title = "设备保养记录行", businessType = BusinessType.DELETE)
@DeleteMapping("/{lineIds}")
public AjaxResult remove(@PathVariable Long[] lineIds)
{
return toAjax(dvMaintenRecordLineService.deleteDvMaintenRecordLineByLineIds(lineIds));
}
}

View File

@ -0,0 +1,293 @@
package com.ktg.mes.dv.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* 设备保养记录对象 dv_mainten_record
*
* @author yinjinlu
* @date 2024-12-26
*/
public class DvMaintenRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 计划ID */
private Long recordId;
/** 计划ID */
@Excel(name = "计划ID")
private Long planId;
/** 计划编码 */
@Excel(name = "计划编码")
private String planCode;
/** 计划名称 */
@Excel(name = "计划名称")
private String planName;
/** 计划类型 */
@Excel(name = "计划类型")
private String planType;
/** 设备ID */
@Excel(name = "设备ID")
private Long machineryId;
/** 设备编码 */
@Excel(name = "设备编码")
private String machineryCode;
/** 设备名称 */
@Excel(name = "设备名称")
private String machineryName;
/** 品牌 */
@Excel(name = "品牌")
private String machineryBrand;
/** 规格型号 */
@Excel(name = "规格型号")
private String machinerySpec;
/** 保养时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "保养时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date maintenTime;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 用户名 */
@Excel(name = "用户名")
private String userName;
/** 昵称 */
@Excel(name = "昵称")
private String nickName;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setRecordId(Long recordId)
{
this.recordId = recordId;
}
public Long getRecordId()
{
return recordId;
}
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public void setPlanCode(String planCode)
{
this.planCode = planCode;
}
public String getPlanCode()
{
return planCode;
}
public void setPlanName(String planName)
{
this.planName = planName;
}
public String getPlanName()
{
return planName;
}
public void setPlanType(String planType)
{
this.planType = planType;
}
public String getPlanType()
{
return planType;
}
public void setMachineryId(Long machineryId)
{
this.machineryId = machineryId;
}
public Long getMachineryId()
{
return machineryId;
}
public void setMachineryCode(String machineryCode)
{
this.machineryCode = machineryCode;
}
public String getMachineryCode()
{
return machineryCode;
}
public void setMachineryName(String machineryName)
{
this.machineryName = machineryName;
}
public String getMachineryName()
{
return machineryName;
}
public void setMachineryBrand(String machineryBrand)
{
this.machineryBrand = machineryBrand;
}
public String getMachineryBrand()
{
return machineryBrand;
}
public void setMachinerySpec(String machinerySpec)
{
this.machinerySpec = machinerySpec;
}
public String getMachinerySpec()
{
return machinerySpec;
}
public void setMaintenTime(Date maintenTime)
{
this.maintenTime = maintenTime;
}
public Date getMaintenTime()
{
return maintenTime;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(Long attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
{
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("recordId", getRecordId())
.append("planId", getPlanId())
.append("planCode", getPlanCode())
.append("planName", getPlanName())
.append("planType", getPlanType())
.append("machineryId", getMachineryId())
.append("machineryCode", getMachineryCode())
.append("machineryName", getMachineryName())
.append("machineryBrand", getMachineryBrand())
.append("machinerySpec", getMachinerySpec())
.append("maintenTime", getMaintenTime())
.append("userId", getUserId())
.append("userName", getUserName())
.append("nickName", getNickName())
.append("status", getStatus())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,219 @@
package com.ktg.mes.dv.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* 设备保养记录行对象 dv_mainten_record_line
*
* @author yinjinlu
* @date 2024-12-26
*/
public class DvMaintenRecordLine extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 计划ID */
private Long lineId;
/** 计划ID */
@Excel(name = "计划ID")
private Long recordId;
/** 项目ID */
@Excel(name = "项目ID")
private Long subjectId;
/** 项目编码 */
@Excel(name = "项目编码")
private String subjectCode;
/** 项目名称 */
@Excel(name = "项目名称")
private String subjectName;
/** 项目类型 */
@Excel(name = "项目类型")
private String subjectType;
/** 项目内容 */
@Excel(name = "项目内容")
private String subjectContent;
/** 标准 */
@Excel(name = "标准")
private String subjectStandard;
/** 保养结果 */
@Excel(name = "保养结果")
private String maintenStatus;
/** 异常描述 */
@Excel(name = "异常描述")
private String maintenResult;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setLineId(Long lineId)
{
this.lineId = lineId;
}
public Long getLineId()
{
return lineId;
}
public void setRecordId(Long recordId)
{
this.recordId = recordId;
}
public Long getRecordId()
{
return recordId;
}
public void setSubjectId(Long subjectId)
{
this.subjectId = subjectId;
}
public Long getSubjectId()
{
return subjectId;
}
public void setSubjectCode(String subjectCode)
{
this.subjectCode = subjectCode;
}
public String getSubjectCode()
{
return subjectCode;
}
public void setSubjectName(String subjectName)
{
this.subjectName = subjectName;
}
public String getSubjectName()
{
return subjectName;
}
public void setSubjectType(String subjectType)
{
this.subjectType = subjectType;
}
public String getSubjectType()
{
return subjectType;
}
public void setSubjectContent(String subjectContent)
{
this.subjectContent = subjectContent;
}
public String getSubjectContent()
{
return subjectContent;
}
public void setSubjectStandard(String subjectStandard)
{
this.subjectStandard = subjectStandard;
}
public String getSubjectStandard()
{
return subjectStandard;
}
public void setMaintenStatus(String maintenStatus)
{
this.maintenStatus = maintenStatus;
}
public String getMaintenStatus()
{
return maintenStatus;
}
public void setMaintenResult(String maintenResult)
{
this.maintenResult = maintenResult;
}
public String getMaintenResult()
{
return maintenResult;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(Long attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
{
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("lineId", getLineId())
.append("recordId", getRecordId())
.append("subjectId", getSubjectId())
.append("subjectCode", getSubjectCode())
.append("subjectName", getSubjectName())
.append("subjectType", getSubjectType())
.append("subjectContent", getSubjectContent())
.append("subjectStandard", getSubjectStandard())
.append("maintenStatus", getMaintenStatus())
.append("maintenResult", getMaintenResult())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.dv.mapper;
import java.util.List;
import com.ktg.mes.dv.domain.DvMaintenRecordLine;
/**
* 设备保养记录行Mapper接口
*
* @author yinjinlu
* @date 2024-12-26
*/
public interface DvMaintenRecordLineMapper
{
/**
* 查询设备保养记录行
*
* @param lineId 设备保养记录行主键
* @return 设备保养记录行
*/
public DvMaintenRecordLine selectDvMaintenRecordLineByLineId(Long lineId);
/**
* 查询设备保养记录行列表
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 设备保养记录行集合
*/
public List<DvMaintenRecordLine> selectDvMaintenRecordLineList(DvMaintenRecordLine dvMaintenRecordLine);
/**
* 新增设备保养记录行
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 结果
*/
public int insertDvMaintenRecordLine(DvMaintenRecordLine dvMaintenRecordLine);
/**
* 修改设备保养记录行
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 结果
*/
public int updateDvMaintenRecordLine(DvMaintenRecordLine dvMaintenRecordLine);
/**
* 删除设备保养记录行
*
* @param lineId 设备保养记录行主键
* @return 结果
*/
public int deleteDvMaintenRecordLineByLineId(Long lineId);
/**
* 批量删除设备保养记录行
*
* @param lineIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteDvMaintenRecordLineByLineIds(Long[] lineIds);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.dv.mapper;
import java.util.List;
import com.ktg.mes.dv.domain.DvMaintenRecord;
/**
* 设备保养记录Mapper接口
*
* @author yinjinlu
* @date 2024-12-26
*/
public interface DvMaintenRecordMapper
{
/**
* 查询设备保养记录
*
* @param recordId 设备保养记录主键
* @return 设备保养记录
*/
public DvMaintenRecord selectDvMaintenRecordByRecordId(Long recordId);
/**
* 查询设备保养记录列表
*
* @param dvMaintenRecord 设备保养记录
* @return 设备保养记录集合
*/
public List<DvMaintenRecord> selectDvMaintenRecordList(DvMaintenRecord dvMaintenRecord);
/**
* 新增设备保养记录
*
* @param dvMaintenRecord 设备保养记录
* @return 结果
*/
public int insertDvMaintenRecord(DvMaintenRecord dvMaintenRecord);
/**
* 修改设备保养记录
*
* @param dvMaintenRecord 设备保养记录
* @return 结果
*/
public int updateDvMaintenRecord(DvMaintenRecord dvMaintenRecord);
/**
* 删除设备保养记录
*
* @param recordId 设备保养记录主键
* @return 结果
*/
public int deleteDvMaintenRecordByRecordId(Long recordId);
/**
* 批量删除设备保养记录
*
* @param recordIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteDvMaintenRecordByRecordIds(Long[] recordIds);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.dv.service;
import java.util.List;
import com.ktg.mes.dv.domain.DvMaintenRecordLine;
/**
* 设备保养记录行Service接口
*
* @author yinjinlu
* @date 2024-12-26
*/
public interface IDvMaintenRecordLineService
{
/**
* 查询设备保养记录行
*
* @param lineId 设备保养记录行主键
* @return 设备保养记录行
*/
public DvMaintenRecordLine selectDvMaintenRecordLineByLineId(Long lineId);
/**
* 查询设备保养记录行列表
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 设备保养记录行集合
*/
public List<DvMaintenRecordLine> selectDvMaintenRecordLineList(DvMaintenRecordLine dvMaintenRecordLine);
/**
* 新增设备保养记录行
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 结果
*/
public int insertDvMaintenRecordLine(DvMaintenRecordLine dvMaintenRecordLine);
/**
* 修改设备保养记录行
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 结果
*/
public int updateDvMaintenRecordLine(DvMaintenRecordLine dvMaintenRecordLine);
/**
* 批量删除设备保养记录行
*
* @param lineIds 需要删除的设备保养记录行主键集合
* @return 结果
*/
public int deleteDvMaintenRecordLineByLineIds(Long[] lineIds);
/**
* 删除设备保养记录行信息
*
* @param lineId 设备保养记录行主键
* @return 结果
*/
public int deleteDvMaintenRecordLineByLineId(Long lineId);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.dv.service;
import java.util.List;
import com.ktg.mes.dv.domain.DvMaintenRecord;
/**
* 设备保养记录Service接口
*
* @author yinjinlu
* @date 2024-12-26
*/
public interface IDvMaintenRecordService
{
/**
* 查询设备保养记录
*
* @param recordId 设备保养记录主键
* @return 设备保养记录
*/
public DvMaintenRecord selectDvMaintenRecordByRecordId(Long recordId);
/**
* 查询设备保养记录列表
*
* @param dvMaintenRecord 设备保养记录
* @return 设备保养记录集合
*/
public List<DvMaintenRecord> selectDvMaintenRecordList(DvMaintenRecord dvMaintenRecord);
/**
* 新增设备保养记录
*
* @param dvMaintenRecord 设备保养记录
* @return 结果
*/
public int insertDvMaintenRecord(DvMaintenRecord dvMaintenRecord);
/**
* 修改设备保养记录
*
* @param dvMaintenRecord 设备保养记录
* @return 结果
*/
public int updateDvMaintenRecord(DvMaintenRecord dvMaintenRecord);
/**
* 批量删除设备保养记录
*
* @param recordIds 需要删除的设备保养记录主键集合
* @return 结果
*/
public int deleteDvMaintenRecordByRecordIds(Long[] recordIds);
/**
* 删除设备保养记录信息
*
* @param recordId 设备保养记录主键
* @return 结果
*/
public int deleteDvMaintenRecordByRecordId(Long recordId);
}

View File

@ -0,0 +1,96 @@
package com.ktg.mes.dv.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.dv.mapper.DvMaintenRecordLineMapper;
import com.ktg.mes.dv.domain.DvMaintenRecordLine;
import com.ktg.mes.dv.service.IDvMaintenRecordLineService;
/**
* 设备保养记录行Service业务层处理
*
* @author yinjinlu
* @date 2024-12-26
*/
@Service
public class DvMaintenRecordLineServiceImpl implements IDvMaintenRecordLineService
{
@Autowired
private DvMaintenRecordLineMapper dvMaintenRecordLineMapper;
/**
* 查询设备保养记录行
*
* @param lineId 设备保养记录行主键
* @return 设备保养记录行
*/
@Override
public DvMaintenRecordLine selectDvMaintenRecordLineByLineId(Long lineId)
{
return dvMaintenRecordLineMapper.selectDvMaintenRecordLineByLineId(lineId);
}
/**
* 查询设备保养记录行列表
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 设备保养记录行
*/
@Override
public List<DvMaintenRecordLine> selectDvMaintenRecordLineList(DvMaintenRecordLine dvMaintenRecordLine)
{
return dvMaintenRecordLineMapper.selectDvMaintenRecordLineList(dvMaintenRecordLine);
}
/**
* 新增设备保养记录行
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 结果
*/
@Override
public int insertDvMaintenRecordLine(DvMaintenRecordLine dvMaintenRecordLine)
{
dvMaintenRecordLine.setCreateTime(DateUtils.getNowDate());
return dvMaintenRecordLineMapper.insertDvMaintenRecordLine(dvMaintenRecordLine);
}
/**
* 修改设备保养记录行
*
* @param dvMaintenRecordLine 设备保养记录行
* @return 结果
*/
@Override
public int updateDvMaintenRecordLine(DvMaintenRecordLine dvMaintenRecordLine)
{
dvMaintenRecordLine.setUpdateTime(DateUtils.getNowDate());
return dvMaintenRecordLineMapper.updateDvMaintenRecordLine(dvMaintenRecordLine);
}
/**
* 批量删除设备保养记录行
*
* @param lineIds 需要删除的设备保养记录行主键
* @return 结果
*/
@Override
public int deleteDvMaintenRecordLineByLineIds(Long[] lineIds)
{
return dvMaintenRecordLineMapper.deleteDvMaintenRecordLineByLineIds(lineIds);
}
/**
* 删除设备保养记录行信息
*
* @param lineId 设备保养记录行主键
* @return 结果
*/
@Override
public int deleteDvMaintenRecordLineByLineId(Long lineId)
{
return dvMaintenRecordLineMapper.deleteDvMaintenRecordLineByLineId(lineId);
}
}

View File

@ -0,0 +1,96 @@
package com.ktg.mes.dv.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.dv.mapper.DvMaintenRecordMapper;
import com.ktg.mes.dv.domain.DvMaintenRecord;
import com.ktg.mes.dv.service.IDvMaintenRecordService;
/**
* 设备保养记录Service业务层处理
*
* @author yinjinlu
* @date 2024-12-26
*/
@Service
public class DvMaintenRecordServiceImpl implements IDvMaintenRecordService
{
@Autowired
private DvMaintenRecordMapper dvMaintenRecordMapper;
/**
* 查询设备保养记录
*
* @param recordId 设备保养记录主键
* @return 设备保养记录
*/
@Override
public DvMaintenRecord selectDvMaintenRecordByRecordId(Long recordId)
{
return dvMaintenRecordMapper.selectDvMaintenRecordByRecordId(recordId);
}
/**
* 查询设备保养记录列表
*
* @param dvMaintenRecord 设备保养记录
* @return 设备保养记录
*/
@Override
public List<DvMaintenRecord> selectDvMaintenRecordList(DvMaintenRecord dvMaintenRecord)
{
return dvMaintenRecordMapper.selectDvMaintenRecordList(dvMaintenRecord);
}
/**
* 新增设备保养记录
*
* @param dvMaintenRecord 设备保养记录
* @return 结果
*/
@Override
public int insertDvMaintenRecord(DvMaintenRecord dvMaintenRecord)
{
dvMaintenRecord.setCreateTime(DateUtils.getNowDate());
return dvMaintenRecordMapper.insertDvMaintenRecord(dvMaintenRecord);
}
/**
* 修改设备保养记录
*
* @param dvMaintenRecord 设备保养记录
* @return 结果
*/
@Override
public int updateDvMaintenRecord(DvMaintenRecord dvMaintenRecord)
{
dvMaintenRecord.setUpdateTime(DateUtils.getNowDate());
return dvMaintenRecordMapper.updateDvMaintenRecord(dvMaintenRecord);
}
/**
* 批量删除设备保养记录
*
* @param recordIds 需要删除的设备保养记录主键
* @return 结果
*/
@Override
public int deleteDvMaintenRecordByRecordIds(Long[] recordIds)
{
return dvMaintenRecordMapper.deleteDvMaintenRecordByRecordIds(recordIds);
}
/**
* 删除设备保养记录信息
*
* @param recordId 设备保养记录主键
* @return 结果
*/
@Override
public int deleteDvMaintenRecordByRecordId(Long recordId)
{
return dvMaintenRecordMapper.deleteDvMaintenRecordByRecordId(recordId);
}
}

View File

@ -0,0 +1,26 @@
package com.ktg.mes.rabbitmq;
import com.ktg.mes.websocket.MesWebSocket;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
/**
* 直连队列 处理器
*
* @author raft
*/
@Slf4j
@Component
public class DirectQueueHandler {
@RabbitListener(queues = "iot.original.mes")
public void directHandlerRegister_origin(String message) {
try {
// log.info("Mes:消息队列,拉取原始数据:{}", message);
MesWebSocket.pushData(message);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,46 @@
package com.ktg.mes.rabbitmq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class RabbitMqConfig {
/**
* 设备事件上报队列
*/
@Bean
public Queue deviceEventQueue() {
return new Queue("iot.original.mes");
}
/**
* RabbitMQ默认的topic交换机
* @return
*/
@Bean
public TopicExchange topicExchange() {
return new TopicExchange("amq.topic");
}
/**
* 绑定队列和交换机
* @param topicExchange
* @param deviceEventQueue
* @return
*/
@Bean
public Binding bindingDeviceEventQueue(TopicExchange topicExchange, Queue deviceEventQueue) {
return BindingBuilder.bind(deviceEventQueue).to(topicExchange).with("iot.origin"); // 替换为实际的路由键
}
}

View File

@ -0,0 +1,106 @@
package com.ktg.mes.websocket;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* mes websocket服务端 为组态大屏提供数据推送
*/
@ServerEndpoint("/websocket/mes")
@Slf4j
@Component
public class MesWebSocket {
private static Map<String, Session> sessionMap = new ConcurrentHashMap<>();
public final static String WEBSOCKET_HEARTBEAT = "heartbeat-iot";
/**
* 客户端成功连接时调用
*
* @param session 存储的session
*/
@OnOpen
public void openSession(Session session) {
log.warn("Mes WebSocket{} 已连接", session.getId());
sessionMap.put(session.getId(),session);
}
/**
* 服务端接收到消息
*
* @param session 会话每个访问对象都会有一个单独的会话
* @param message 服务端接收到的消息 格式 deviceCode:nodeCode:pointCode1,pointCode2,pointCode3
*/
@OnMessage(maxMessageSize = 10485760)
public void onMessage(Session session, String message) {
log.warn("Mes WebSocket接收到 {} 的消息 {}", session.getId(), message);
if(WEBSOCKET_HEARTBEAT.equals(message)){
sendMessage(session,"OK");
}
}
/**
* 客户端断开连接时调用
*
* @param session 存储的session
*/
@OnClose
public void onClose(Session session) {
log.warn("Mes WebSocket{} 断开连接", session.getId());
removeSessionData(session);
}
@OnError
public void onError(Session session, Throwable throwable) {
removeSessionData(session);
}
private void removeSessionData(Session session) {
String sessionId = session.getId();
sessionMap.remove(sessionId);
}
/**
* 向指定Session(用户)发送message
*
* @param session 用session进行判断
* @param message 发送的消息
*/
private static void sendMessage(Session session, String message) {
try {
session.getBasicRemote().sendText(message);
log.warn("Mes sendData {}", message);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 给对应的测点session客户端集合发送测点实时数据
*
* @param message 发送消息
* @param sessionMap 获取sessionIds发送实时数据
*/
private static synchronized void sendMessageAll(String message, Map<String, Session> sessionMap) {
for (String key : sessionMap.keySet()) {
log.info("sessionId: {}", key);
sendMessage(sessionMap.get(key), message);
}
}
/**
* 检查是否有客户端监听此设备的实时数据
*
* @param message 发送消息内容
*/
public static void pushData(String message) {
if (ObjectUtils.isNotEmpty(sessionMap)) {
sendMessageAll(message, sessionMap);
}
}
}

View File

@ -0,0 +1,128 @@
<?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.ktg.mes.dv.mapper.DvMaintenRecordLineMapper">
<resultMap type="DvMaintenRecordLine" id="DvMaintenRecordLineResult">
<result property="lineId" column="line_id" />
<result property="recordId" column="record_id" />
<result property="subjectId" column="subject_id" />
<result property="subjectCode" column="subject_code" />
<result property="subjectName" column="subject_name" />
<result property="subjectType" column="subject_type" />
<result property="subjectContent" column="subject_content" />
<result property="subjectStandard" column="subject_standard" />
<result property="maintenStatus" column="mainten_status" />
<result property="maintenResult" column="mainten_result" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDvMaintenRecordLineVo">
select line_id, record_id, subject_id, subject_code, subject_name, subject_type, subject_content, subject_standard, mainten_status, mainten_result, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_mainten_record_line
</sql>
<select id="selectDvMaintenRecordLineList" parameterType="DvMaintenRecordLine" resultMap="DvMaintenRecordLineResult">
<include refid="selectDvMaintenRecordLineVo"/>
<where>
<if test="recordId != null "> and record_id = #{recordId}</if>
<if test="subjectId != null "> and subject_id = #{subjectId}</if>
<if test="subjectCode != null and subjectCode != ''"> and subject_code = #{subjectCode}</if>
<if test="subjectName != null and subjectName != ''"> and subject_name like concat('%', #{subjectName}, '%')</if>
<if test="subjectType != null and subjectType != ''"> and subject_type = #{subjectType}</if>
<if test="subjectContent != null and subjectContent != ''"> and subject_content = #{subjectContent}</if>
<if test="subjectStandard != null and subjectStandard != ''"> and subject_standard = #{subjectStandard}</if>
<if test="maintenStatus != null and maintenStatus != ''"> and mainten_status = #{maintenStatus}</if>
<if test="maintenResult != null and maintenResult != ''"> and mainten_result = #{maintenResult}</if>
</where>
</select>
<select id="selectDvMaintenRecordLineByLineId" parameterType="Long" resultMap="DvMaintenRecordLineResult">
<include refid="selectDvMaintenRecordLineVo"/>
where line_id = #{lineId}
</select>
<insert id="insertDvMaintenRecordLine" parameterType="DvMaintenRecordLine" useGeneratedKeys="true" keyProperty="lineId">
insert into dv_mainten_record_line
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null">record_id,</if>
<if test="subjectId != null">subject_id,</if>
<if test="subjectCode != null and subjectCode != ''">subject_code,</if>
<if test="subjectName != null">subject_name,</if>
<if test="subjectType != null">subject_type,</if>
<if test="subjectContent != null and subjectContent != ''">subject_content,</if>
<if test="subjectStandard != null">subject_standard,</if>
<if test="maintenStatus != null and maintenStatus != ''">mainten_status,</if>
<if test="maintenResult != null">mainten_result,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
<if test="subjectId != null">#{subjectId},</if>
<if test="subjectCode != null and subjectCode != ''">#{subjectCode},</if>
<if test="subjectName != null">#{subjectName},</if>
<if test="subjectType != null">#{subjectType},</if>
<if test="subjectContent != null and subjectContent != ''">#{subjectContent},</if>
<if test="subjectStandard != null">#{subjectStandard},</if>
<if test="maintenStatus != null and maintenStatus != ''">#{maintenStatus},</if>
<if test="maintenResult != null">#{maintenResult},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDvMaintenRecordLine" parameterType="DvMaintenRecordLine">
update dv_mainten_record_line
<trim prefix="SET" suffixOverrides=",">
<if test="recordId != null">record_id = #{recordId},</if>
<if test="subjectId != null">subject_id = #{subjectId},</if>
<if test="subjectCode != null and subjectCode != ''">subject_code = #{subjectCode},</if>
<if test="subjectName != null">subject_name = #{subjectName},</if>
<if test="subjectType != null">subject_type = #{subjectType},</if>
<if test="subjectContent != null and subjectContent != ''">subject_content = #{subjectContent},</if>
<if test="subjectStandard != null">subject_standard = #{subjectStandard},</if>
<if test="maintenStatus != null and maintenStatus != ''">mainten_status = #{maintenStatus},</if>
<if test="maintenResult != null">mainten_result = #{maintenResult},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where line_id = #{lineId}
</update>
<delete id="deleteDvMaintenRecordLineByLineId" parameterType="Long">
delete from dv_mainten_record_line where line_id = #{lineId}
</delete>
<delete id="deleteDvMaintenRecordLineByLineIds" parameterType="String">
delete from dv_mainten_record_line where line_id in
<foreach item="lineId" collection="array" open="(" separator="," close=")">
#{lineId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,157 @@
<?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.ktg.mes.dv.mapper.DvMaintenRecordMapper">
<resultMap type="DvMaintenRecord" id="DvMaintenRecordResult">
<result property="recordId" column="record_id" />
<result property="planId" column="plan_id" />
<result property="planCode" column="plan_code" />
<result property="planName" column="plan_name" />
<result property="planType" column="plan_type" />
<result property="machineryId" column="machinery_id" />
<result property="machineryCode" column="machinery_code" />
<result property="machineryName" column="machinery_name" />
<result property="machineryBrand" column="machinery_brand" />
<result property="machinerySpec" column="machinery_spec" />
<result property="maintenTime" column="mainten_time" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDvMaintenRecordVo">
select record_id, plan_id, plan_code, plan_name, plan_type, machinery_id, machinery_code, machinery_name, machinery_brand, machinery_spec, mainten_time, user_id, user_name, nick_name, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_mainten_record
</sql>
<select id="selectDvMaintenRecordList" parameterType="DvMaintenRecord" resultMap="DvMaintenRecordResult">
<include refid="selectDvMaintenRecordVo"/>
<where>
<if test="planId != null "> and plan_id = #{planId}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
<if test="planType != null and planType != ''"> and plan_type = #{planType}</if>
<if test="machineryId != null "> and machinery_id = #{machineryId}</if>
<if test="machineryCode != null and machineryCode != ''"> and machinery_code = #{machineryCode}</if>
<if test="machineryName != null and machineryName != ''"> and machinery_name like concat('%', #{machineryName}, '%')</if>
<if test="machineryBrand != null and machineryBrand != ''"> and machinery_brand = #{machineryBrand}</if>
<if test="machinerySpec != null and machinerySpec != ''"> and machinery_spec = #{machinerySpec}</if>
<if test="maintenTime != null "> and mainten_time = #{maintenTime}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectDvMaintenRecordByRecordId" parameterType="Long" resultMap="DvMaintenRecordResult">
<include refid="selectDvMaintenRecordVo"/>
where record_id = #{recordId}
</select>
<insert id="insertDvMaintenRecord" parameterType="DvMaintenRecord" useGeneratedKeys="true" keyProperty="recordId">
insert into dv_mainten_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planId != null">plan_id,</if>
<if test="planCode != null">plan_code,</if>
<if test="planName != null">plan_name,</if>
<if test="planType != null">plan_type,</if>
<if test="machineryId != null">machinery_id,</if>
<if test="machineryCode != null and machineryCode != ''">machinery_code,</if>
<if test="machineryName != null and machineryName != ''">machinery_name,</if>
<if test="machineryBrand != null">machinery_brand,</if>
<if test="machinerySpec != null">machinery_spec,</if>
<if test="maintenTime != null">mainten_time,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="nickName != null">nick_name,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planId != null">#{planId},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planName != null">#{planName},</if>
<if test="planType != null">#{planType},</if>
<if test="machineryId != null">#{machineryId},</if>
<if test="machineryCode != null and machineryCode != ''">#{machineryCode},</if>
<if test="machineryName != null and machineryName != ''">#{machineryName},</if>
<if test="machineryBrand != null">#{machineryBrand},</if>
<if test="machinerySpec != null">#{machinerySpec},</if>
<if test="maintenTime != null">#{maintenTime},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="nickName != null">#{nickName},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDvMaintenRecord" parameterType="DvMaintenRecord">
update dv_mainten_record
<trim prefix="SET" suffixOverrides=",">
<if test="planId != null">plan_id = #{planId},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planName != null">plan_name = #{planName},</if>
<if test="planType != null">plan_type = #{planType},</if>
<if test="machineryId != null">machinery_id = #{machineryId},</if>
<if test="machineryCode != null and machineryCode != ''">machinery_code = #{machineryCode},</if>
<if test="machineryName != null and machineryName != ''">machinery_name = #{machineryName},</if>
<if test="machineryBrand != null">machinery_brand = #{machineryBrand},</if>
<if test="machinerySpec != null">machinery_spec = #{machinerySpec},</if>
<if test="maintenTime != null">mainten_time = #{maintenTime},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where record_id = #{recordId}
</update>
<delete id="deleteDvMaintenRecordByRecordId" parameterType="Long">
delete from dv_mainten_record where record_id = #{recordId}
</delete>
<delete id="deleteDvMaintenRecordByRecordIds" parameterType="String">
delete from dv_mainten_record where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
</mapper>