feat: 新增字段更新时间

This commit is contained in:
niushuai233 2022-10-27 16:27:06 +08:00
parent 5c1da90259
commit 5eab389001
5 changed files with 34 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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());

View File

@ -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());
// 对当前设备引用重新赋值

View File

@ -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;
}