package com.zy.system.entity; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.enums.IdType; import com.core.common.Cools; import com.core.common.SpringUtils; import com.zy.system.service.UserService; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Date; @Data @TableName("sys_saas_log") public class SaasLog implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @ApiModelProperty(value= "id") @TableId(value = "id", type = IdType.AUTO) private Long id; /** * {0:入库,1:出库,2.调拨入,3.调拨出,4.领料出} */ @ApiModelProperty(value= "{0:入库,1:出库}") private Integer type; @ApiModelProperty(value= "") @TableField("loc_no") private String locNo; @ApiModelProperty(value= "") private String matnr; @ApiModelProperty(value= "批次") private String batch; @ApiModelProperty(value= "") @TableField("io_time") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date ioTime; @ApiModelProperty(value= "") @TableField("create_by") private Long createBy; @TableField("anfme") private Double anfme; public SaasLog() {} public SaasLog(Long id,Integer type,String locNo,String matnr,Date ioTime,Long createBy) { this.id = id; this.type = type; this.locNo = locNo; this.matnr = matnr; this.ioTime = ioTime; this.createBy = createBy; } // SaasLog saasLog = new SaasLog( // null, // id[非空] // null, // {0:入库,1:出库} // null, // // null, // // null, // // null // // ); public String getIoTime$(){ if (Cools.isEmpty(this.ioTime)){ return ""; } return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime); } /** * {0:入库,1:出库,2.调拨入,3.调拨出,4.领料出} */ public String getType$() { switch (this.type) { case 0: return "入库"; case 1: return "出库"; case 2: return "调拨入"; case 3: return "调拨出"; case 4: return "领料出"; default: return ""; } } public String getCreateBy$(){ UserService service = SpringUtils.getBean(UserService.class); User user = service.selectById(this.createBy); if (!Cools.isEmpty(user)){ return String.valueOf(user.getUsername()); } return null; } }