package com.by4cloud.platformx.device.entity; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.by4cloud.platformx.admin.api.utils.UpmsCacheUtil; import com.by4cloud.platformx.common.data.mybatis.BaseModel; import io.swagger.v3.oas.annotations.media.Schema; import javax.persistence.Column; import javax.persistence.Id; import javax.persistence.MappedSuperclass; import javax.persistence.Transient; import java.time.LocalDateTime; /** * @author kdq * @version 1.0.0 * @ClassName DeviceBaseModel.java * @Description TODO * @createTime 2025年03月04日 13:58:00 */ @MappedSuperclass public class DeviceBaseModel> extends Model { @Id @TableId( value = "id", type = IdType.ASSIGN_ID ) private Long id; @Schema( description = "申请人" ) @TableField( fill = FieldFill.INSERT ) @Column( columnDefinition = "varchar(50) comment '申请人'" ) private String createBy; @Column( columnDefinition = "varchar(50) comment '修改人'" ) @Schema( description = "修改人" ) @TableField( fill = FieldFill.UPDATE ) private String updateBy; @Schema( description = "提交时间" ) @TableField( fill = FieldFill.INSERT ) @Column( columnDefinition = "datetime(6) comment '提交时间'" ) private LocalDateTime createTime; @Schema( description = "修改时间" ) @TableField( fill = FieldFill.UPDATE ) @Column( columnDefinition = "datetime(6) comment '修改时间'" ) private LocalDateTime updateTime; @Schema( description = "删除标记 0/正常 1/删除" ) @TableLogic @Column( length = 2, columnDefinition = "char(1) default '0'" ) private String delFlag = "0"; @Schema( description = "单位id" ) @TableField( fill = FieldFill.INSERT ) private Long compId; @Transient @TableField( exist = false ) @Schema( description = "单位名称" ) private String compName; @Column( columnDefinition = "varchar(100) comment '名称'" ) private String name; @Column( columnDefinition = "varchar(200) comment '规格型号'" ) private String specification; @Column( columnDefinition = "int comment '到货月份'" ) private Integer month; @Column( columnDefinition = "int comment '数量'" ) private Integer num; @Column( columnDefinition = "varchar(20) comment '单位'" ) private String unit; @Column( columnDefinition = "double(10,2) comment '单价'" ) private Double price; public String getCompName() { if (StrUtil.isEmpty(this.compName)) { UpmsCacheUtil upmsCacheUtil = (UpmsCacheUtil) SpringUtil.getBean(UpmsCacheUtil.class); this.compName = upmsCacheUtil.getCompNameById(this.compId); } return this.compName; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSpecification() { return specification; } public void setSpecification(String specification) { this.specification = specification; } public Integer getMonth() { return month; } public void setMonth(Integer month) { this.month = month; } public Integer getNum() { return num; } public void setNum(Integer num) { this.num = num; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public void setCompId(final Long compId) { this.compId = compId; } public Long getCompId() { return this.compId; } public void setCompName(final String compName) { this.compName = compName; } public Double getAmount() { return amount; } public void setAmount(Double amount) { this.amount = amount; } @Column( columnDefinition = "double(10,2) comment '计划总额'" ) private Double amount; public DeviceBaseModel() { } public Long getId() { return this.id; } public String getCreateBy() { return this.createBy; } public String getUpdateBy() { return this.updateBy; } public LocalDateTime getCreateTime() { return this.createTime; } public LocalDateTime getUpdateTime() { return this.updateTime; } public String getDelFlag() { return this.delFlag; } public void setId(final Long id) { this.id = id; } public void setCreateBy(final String createBy) { this.createBy = createBy; } public void setUpdateBy(final String updateBy) { this.updateBy = updateBy; } public void setCreateTime(final LocalDateTime createTime) { this.createTime = createTime; } public void setUpdateTime(final LocalDateTime updateTime) { this.updateTime = updateTime; } public void setDelFlag(final String delFlag) { this.delFlag = delFlag; } public boolean equals(final Object o) { if (o == this) { return true; } else if (!(o instanceof DeviceBaseModel)) { return false; } else { DeviceBaseModel other = (DeviceBaseModel)o; if (!other.canEqual(this)) { return false; } else { Object this$id = this.getId(); Object other$id = other.getId(); if (this$id == null) { if (other$id != null) { return false; } } else if (!this$id.equals(other$id)) { return false; } Object this$createBy = this.getCreateBy(); Object other$createBy = other.getCreateBy(); if (this$createBy == null) { if (other$createBy != null) { return false; } } else if (!this$createBy.equals(other$createBy)) { return false; } Object this$updateBy = this.getUpdateBy(); Object other$updateBy = other.getUpdateBy(); if (this$updateBy == null) { if (other$updateBy != null) { return false; } } else if (!this$updateBy.equals(other$updateBy)) { return false; } label62: { Object this$createTime = this.getCreateTime(); Object other$createTime = other.getCreateTime(); if (this$createTime == null) { if (other$createTime == null) { break label62; } } else if (this$createTime.equals(other$createTime)) { break label62; } return false; } label55: { Object this$updateTime = this.getUpdateTime(); Object other$updateTime = other.getUpdateTime(); if (this$updateTime == null) { if (other$updateTime == null) { break label55; } } else if (this$updateTime.equals(other$updateTime)) { break label55; } return false; } Object this$delFlag = this.getDelFlag(); Object other$delFlag = other.getDelFlag(); if (this$delFlag == null) { if (other$delFlag != null) { return false; } } else if (!this$delFlag.equals(other$delFlag)) { return false; } return true; } } } protected boolean canEqual(final Object other) { return other instanceof DeviceBaseModel; } public int hashCode() { int result = 1; Object $id = this.getId(); result = result * 59 + ($id == null ? 43 : $id.hashCode()); Object $createBy = this.getCreateBy(); result = result * 59 + ($createBy == null ? 43 : $createBy.hashCode()); Object $updateBy = this.getUpdateBy(); result = result * 59 + ($updateBy == null ? 43 : $updateBy.hashCode()); Object $createTime = this.getCreateTime(); result = result * 59 + ($createTime == null ? 43 : $createTime.hashCode()); Object $updateTime = this.getUpdateTime(); result = result * 59 + ($updateTime == null ? 43 : $updateTime.hashCode()); Object $delFlag = this.getDelFlag(); result = result * 59 + ($delFlag == null ? 43 : $delFlag.hashCode()); return result; } public String toString() { return "DeviceBaseModel(id=" + this.getId() + ", createBy=" + this.getCreateBy() + ", updateBy=" + this.getUpdateBy() + ", createTime=" + this.getCreateTime() + ", updateTime=" + this.getUpdateTime() + ", delFlag=" + this.getDelFlag() + ")"; } }