@TableName(value = “WaterHigh“, excludeProperty = {“createTime“, “updateTime“})注解【@TableName】过滤列

在mybatis-plus中,通常使用生成器生成的实体类,封装的create和time,但是有时候我们的表并不对应:
在这里插入图片描述

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public abstract class BaseDomain implements Serializable {

	private static final long serialVersionUID = -3281418615869606867L;

	/**
	 * 主键
	 */
	@JsonFormat(shape = JsonFormat.Shape.STRING)
	@TableId(value = "id", type = IdType.AUTO)
	private Long id;

	/**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(value = "create_time", fill = FieldFill.INSERT)
	private LocalDateTime createTime;

	/**
	 * 更新时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
	private LocalDateTime updateTime;

}

这时候使用mybatis-plus时会报错,因为列不对应,所以使用注解将数据库中没有的列进行排除:
@TableName(value = "WaterHigh", excludeProperty = {"id", "createTime", "updateTime"})注解
“id”, “createTime”, "updateTime为排除的列

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
@Data public class StorageLocationVo extends StorageLocation { @ApiModelProperty(value = "货架名") private String shelfName; private String type; private Integer sectionNum; private Integer layerNum; } @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_storage_location") @ApiModel(value="StorageLocation对象", description="储位表") public class StorageLocation implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "ID") @TableId(value = "id", type = IdType.AUTO) private Long id; @ApiModelProperty(value = "储位名称") private String name; @ApiModelProperty(value = "储位编码") private String code; @ApiModelProperty(value = "库房id") private Long storeroomId; @ApiModelProperty(value = "站点id") private Long siteId; @ApiModelProperty(value = "识别编码") private String identifyCode; @ApiModelProperty(value = "货架id") private Long shelfId; @ApiModelProperty(value = "是否删除 0:正常 1:删除") @TableLogic private String isDelete; @ApiModelProperty(value = "创建时间") @TableField(fill = FieldFill.INSERT) private Date createTime; @ApiModelProperty(value = "更新时间") @TableField(fill = FieldFill.UPDATE) private Date updateTime; @ApiModelProperty(value = "所属站点名称") @TableField(exist = false) private String siteName; @ApiModelProperty(value = "所属库房名称") @TableField(exist = false) private String storeroomName; @ApiModelProperty(value = "所属货架名称") @TableField(exist = false) private String shelfName; @ApiModelProperty(value = "所属货架编码类型") @TableField(exist = false) private String codeRule; @ApiModelProperty(value = "所属货架节数") @TableField(exist = false) private Integer sectionNum; @ApiModelProperty(value = "所属货架层数") @TableField(exist = false) private Integer layerNum; } 分析一下为什么报java: com.tuimi.gwznkf.storage.entity.vo.StorageLocationVo中的setShelfName(java.lang.String)无法覆盖com.tuimi.gwznkf.storage.entity.StorageLocation中的setShelfName(java.lang.String) 返回类型void与com.tuimi.gwznkf.storage.entity.StorageLocation不兼容 问题解决
最新发布
05-28

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

杵意

谢谢金主打赏呀!!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值