diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/base/entity/BaseVO.java b/app/src/main/java/cc/niushuai/project/devcontrol/base/entity/BaseVO.java index c699762..ad3e779 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/base/entity/BaseVO.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/base/entity/BaseVO.java @@ -21,6 +21,8 @@ public class BaseVO implements Serializable { private Date createTime; + private Date updateTime; + public String getId() { return id; } @@ -52,4 +54,12 @@ public class BaseVO implements Serializable { public void setCreateTime(Date createTime) { this.createTime = createTime; } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } } diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/db/entity/Device.java b/app/src/main/java/cc/niushuai/project/devcontrol/db/entity/Device.java index 5f3bef1..5efc7ed 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/db/entity/Device.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/db/entity/Device.java @@ -83,11 +83,16 @@ public class Device implements Serializable { */ private String createTime; - @Generated(hash = 1723639212) - public Device(Long id, Integer order, String deviceName, String deviceType, - String onOff, Integer iconId, String commandPath, String commandStatus, - String commandOpen, String commandClose, Integer isDeleted, - String remark, String createTime) { + /** + * 创建时间 + */ + private String updateTime; + + @Generated(hash = 1105838321) + public Device(Long id, Integer order, String deviceName, String deviceType, String onOff, + Integer iconId, String commandPath, String commandStatus, String commandOpen, + String commandClose, Integer isDeleted, String remark, String createTime, + String updateTime) { this.id = id; this.order = order; this.deviceName = deviceName; @@ -101,6 +106,7 @@ public class Device implements Serializable { this.isDeleted = isDeleted; this.remark = remark; this.createTime = createTime; + this.updateTime = updateTime; } @Generated(hash = 1469582394) @@ -210,4 +216,12 @@ public class Device implements Serializable { public void setCommandStatus(String commandStatus) { this.commandStatus = commandStatus; } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } } diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/deviceadd/DeviceAddPowerSwitchActivity.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/deviceadd/DeviceAddPowerSwitchActivity.java index b5749a7..0901566 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/ui/deviceadd/DeviceAddPowerSwitchActivity.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/deviceadd/DeviceAddPowerSwitchActivity.java @@ -75,6 +75,7 @@ public class DeviceAddPowerSwitchActivity extends BaseActivity { device.setOnOff(OnOffEnum.OFF.getValue()); device.setCreateTime(DateUtil.now()); + device.setUpdateTime(DateUtil.now()); device.setOrder(1); device.setIsDeleted(YesNoEnum.NO.getIntegerValue()); diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetParamActivity.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetParamActivity.java index 94d3863..5ecba74 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetParamActivity.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/powerswitch/PowerSwitchSetParamActivity.java @@ -5,6 +5,8 @@ import android.view.View; import androidx.annotation.Nullable; +import java.util.Date; + import cc.niushuai.project.devcontrol.R; import cc.niushuai.project.devcontrol.base.ui.BaseActivity; import cc.niushuai.project.devcontrol.base.util.CommonUiUtil; @@ -67,6 +69,7 @@ public class PowerSwitchSetParamActivity extends BaseActivity { // deviceInfo.setIconId(device.getIconId()); deviceInfo.setIsDeleted(device.getIsDeleted()); deviceInfo.setCreateTime(device.getCreateTime()); + deviceInfo.setUpdateTime(new Date()); DB.getDeviceDao().update(deviceInfo.toDevice()); // 对当前设备引用重新赋值 diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/vo/DeviceInfo.java b/app/src/main/java/cc/niushuai/project/devcontrol/vo/DeviceInfo.java index 2bb692b..6edad0a 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/vo/DeviceInfo.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/vo/DeviceInfo.java @@ -231,6 +231,7 @@ public class DeviceInfo extends BaseVO { to.setOrder(this.getOrder()); to.setIsDeleted(this.getIsDeleted()); to.setCreateTime(DateFormatUtil.formatDateTime(this.getCreateTime())); + to.setUpdateTime(DateFormatUtil.formatDateTime(this.getUpdateTime())); return to; }