lau572
9 months ago
10 changed files with 337 additions and 81 deletions
@ -0,0 +1,194 @@ |
|||||
|
package com.zc.business.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.ruoyi.common.annotation.Excel; |
||||
|
|
||||
|
/** |
||||
|
* @Description 中间库设备数据 |
||||
|
* |
||||
|
* @author liuwenge |
||||
|
* @date 2024/2/20 17:30 |
||||
|
*/ |
||||
|
public class MdDeviceData { |
||||
|
|
||||
|
/** 主键 */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 设备编号 */ |
||||
|
@Excel(name = "设备编号") |
||||
|
private String devNo; |
||||
|
|
||||
|
/** 设备类型 */ |
||||
|
@Excel(name = "设备类型") |
||||
|
private String devType; |
||||
|
|
||||
|
/** 时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date timeStamp; |
||||
|
|
||||
|
/** 自定义字段 */ |
||||
|
@Excel(name = "自定义字段") |
||||
|
private String expands; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date creationTime; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@Excel(name = "创建人") |
||||
|
private String creatorUserId; |
||||
|
|
||||
|
/** 最后修改时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date lastModificationTime; |
||||
|
|
||||
|
/** 最后修改人 */ |
||||
|
@Excel(name = "最后修改人") |
||||
|
private Long lastModifierUserId; |
||||
|
|
||||
|
/** 是否删除 */ |
||||
|
@Excel(name = "是否删除") |
||||
|
private Integer isDeleted; |
||||
|
|
||||
|
/** 删除人 */ |
||||
|
@Excel(name = "删除人") |
||||
|
private Long deleterUserId; |
||||
|
|
||||
|
/** 删除时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date deletionTime; |
||||
|
|
||||
|
public void setId(Long id) |
||||
|
{ |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getId() |
||||
|
{ |
||||
|
return id; |
||||
|
} |
||||
|
public void setDevNo(String devNo) |
||||
|
{ |
||||
|
this.devNo = devNo; |
||||
|
} |
||||
|
|
||||
|
public String getDevNo() |
||||
|
{ |
||||
|
return devNo; |
||||
|
} |
||||
|
|
||||
|
public String getDevType() { |
||||
|
return devType; |
||||
|
} |
||||
|
|
||||
|
public void setDevType(String devType) { |
||||
|
this.devType = devType; |
||||
|
} |
||||
|
|
||||
|
public void setTimeStamp(Date timeStamp) |
||||
|
{ |
||||
|
this.timeStamp = timeStamp; |
||||
|
} |
||||
|
|
||||
|
public Date getTimeStamp() |
||||
|
{ |
||||
|
return timeStamp; |
||||
|
} |
||||
|
public void setExpands(String expands) |
||||
|
{ |
||||
|
this.expands = expands; |
||||
|
} |
||||
|
|
||||
|
public String getExpands() |
||||
|
{ |
||||
|
return expands; |
||||
|
} |
||||
|
public void setCreationTime(Date creationTime) |
||||
|
{ |
||||
|
this.creationTime = creationTime; |
||||
|
} |
||||
|
|
||||
|
public Date getCreationTime() |
||||
|
{ |
||||
|
return creationTime; |
||||
|
} |
||||
|
public void setCreatorUserId(String creatorUserId) |
||||
|
{ |
||||
|
this.creatorUserId = creatorUserId; |
||||
|
} |
||||
|
|
||||
|
public String getCreatorUserId() |
||||
|
{ |
||||
|
return creatorUserId; |
||||
|
} |
||||
|
public void setLastModificationTime(Date lastModificationTime) |
||||
|
{ |
||||
|
this.lastModificationTime = lastModificationTime; |
||||
|
} |
||||
|
|
||||
|
public Date getLastModificationTime() |
||||
|
{ |
||||
|
return lastModificationTime; |
||||
|
} |
||||
|
public void setLastModifierUserId(Long lastModifierUserId) |
||||
|
{ |
||||
|
this.lastModifierUserId = lastModifierUserId; |
||||
|
} |
||||
|
|
||||
|
public Long getLastModifierUserId() |
||||
|
{ |
||||
|
return lastModifierUserId; |
||||
|
} |
||||
|
public void setIsDeleted(Integer isDeleted) |
||||
|
{ |
||||
|
this.isDeleted = isDeleted; |
||||
|
} |
||||
|
|
||||
|
public Integer getIsDeleted() |
||||
|
{ |
||||
|
return isDeleted; |
||||
|
} |
||||
|
public void setDeleterUserId(Long deleterUserId) |
||||
|
{ |
||||
|
this.deleterUserId = deleterUserId; |
||||
|
} |
||||
|
|
||||
|
public Long getDeleterUserId() |
||||
|
{ |
||||
|
return deleterUserId; |
||||
|
} |
||||
|
public void setDeletionTime(Date deletionTime) |
||||
|
{ |
||||
|
this.deletionTime = deletionTime; |
||||
|
} |
||||
|
|
||||
|
public Date getDeletionTime() |
||||
|
{ |
||||
|
return deletionTime; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("id", getId()) |
||||
|
.append("devNo", getDevNo()) |
||||
|
.append("timeStamp", getTimeStamp()) |
||||
|
.append("expands", getExpands()) |
||||
|
.append("creationTime", getCreationTime()) |
||||
|
.append("creatorUserId", getCreatorUserId()) |
||||
|
.append("lastModificationTime", getLastModificationTime()) |
||||
|
.append("lastModifierUserId", getLastModifierUserId()) |
||||
|
.append("isDeleted", getIsDeleted()) |
||||
|
.append("deleterUserId", getDeleterUserId()) |
||||
|
.append("deletionTime", getDeletionTime()) |
||||
|
.toString(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.zc.business.mapper; |
||||
|
|
||||
|
import com.zc.business.domain.DcBoardReleaseLog; |
||||
|
import com.zc.business.domain.MdDeviceData; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 中间库Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-01-05 |
||||
|
*/ |
||||
|
public interface MiddleDatabaseMapper |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 中间库新增设备数据 |
||||
|
* |
||||
|
* @param mdDeviceData 气象检测器数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
Boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData); |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.zc.business.service; |
||||
|
|
||||
|
import com.ruoyi.common.core.domain.AjaxResult; |
||||
|
import com.zc.business.domain.DcBoardPublish; |
||||
|
import com.zc.business.domain.MdDeviceData; |
||||
|
|
||||
|
/** |
||||
|
* 中间库Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-01-03 |
||||
|
*/ |
||||
|
public interface IMiddleDatabaseService |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 中间库新增设备数据 |
||||
|
* |
||||
|
* @param mdDeviceData 气象检测器数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData); |
||||
|
|
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
package com.zc.business.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.ruoyi.common.annotation.DataSource; |
||||
|
import com.ruoyi.common.constant.HttpStatus; |
||||
|
import com.ruoyi.common.core.domain.AjaxResult; |
||||
|
import com.ruoyi.common.core.domain.model.LoginUser; |
||||
|
import com.ruoyi.common.enums.DataSourceType; |
||||
|
import com.ruoyi.common.utils.SecurityUtils; |
||||
|
import com.ruoyi.common.utils.StringUtils; |
||||
|
import com.zc.business.controller.DcDeviceController; |
||||
|
import com.zc.business.domain.DcBoardPublish; |
||||
|
import com.zc.business.domain.DcBoardReleaseLog; |
||||
|
import com.zc.business.domain.MdDeviceData; |
||||
|
import com.zc.business.mapper.DcBoardReleaseLogMapper; |
||||
|
import com.zc.business.mapper.MiddleDatabaseMapper; |
||||
|
import com.zc.business.service.IDcBoardService; |
||||
|
import com.zc.business.service.IMiddleDatabaseService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 中间库Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-01-03 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private MiddleDatabaseMapper middleDatabaseMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private DcDeviceController deviceController; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 中间库新增设备数据 |
||||
|
* |
||||
|
* @param mdDeviceData 气象检测器数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@DataSource(value = DataSourceType.SLAVE)//切换数据源
|
||||
|
@Override |
||||
|
public boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData) |
||||
|
{ |
||||
|
return middleDatabaseMapper.insertMiddleDatabaseDeviceData(mdDeviceData); |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
<?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.zc.business.mapper.MiddleDatabaseMapper"> |
||||
|
|
||||
|
<insert id="insertMiddleDatabaseDeviceData" parameterType="MdDeviceData" useGeneratedKeys="true" keyProperty="id"> |
||||
|
insert into device_data |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="devNo != null">devNo,</if> |
||||
|
<if test="devType != null">devType,</if> |
||||
|
<if test="timeStamp != null">`timeStamp`,</if> |
||||
|
<if test="expands != null">expands,</if> |
||||
|
<if test="creatorUserId != null">CreatorUserId,</if> |
||||
|
<if test="lastModificationTime != null">LastModificationTime,</if> |
||||
|
<if test="lastModifierUserId != null">LastModifierUserId,</if> |
||||
|
<if test="isDeleted != null">IsDeleted,</if> |
||||
|
<if test="deleterUserId != null">DeleterUserId,</if> |
||||
|
<if test="deletionTime != null">DeletionTime,</if> |
||||
|
CreationTime |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="devNo != null">#{devNo},</if> |
||||
|
<if test="devType != null">#{devType},</if> |
||||
|
<if test="timeStamp != null">#{timeStamp},</if> |
||||
|
<if test="expands != null">#{expands},</if> |
||||
|
<if test="creatorUserId != null">#{creatorUserId},</if> |
||||
|
<if test="lastModificationTime != null">#{lastModificationTime},</if> |
||||
|
<if test="isDeleted != null">#{isDeleted},</if> |
||||
|
<if test="deleterUserId != null">#{deleterUserId},</if> |
||||
|
<if test="deletionTime != null">#{deletionTime},</if> |
||||
|
current_date |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue