注解小记

1.@jsaonIgnoreProperties

忽略类中不需要的字段

@JsonIgnoreProperties(value = {
        "available",
        "driverVehicleBindings"
})
public class User extends BaseEntity{

}

2.@Convert

jpa中实体属性类型转换器

参考链接:https://blog.csdn.net/hong0220/article/details/50909211

3.@Embeddable

一个实体类在多个不同实体类使用,本身不需要独立生成数据库表

public class User{
    
    @Id
    @GeneratedValue(generator = "user-uuid")
    @Column(name="user_id")
    private String userId;

    //映射Station的stationId
    @Embedded
    @AttributeOverrides({
	@AttributeOverride(name="stationId",
	column=@Column(name="start_station_id"))
    })
    private Station original;
    
    //将Price中所有属性都映射
    private Price price;
}

@Embeddable
@Data
public class Station {
		private String stationId;

		@Transient
		private String name;
		
		@Transient
		private String type; 
		
}

@Embeddable
@Data
public class Price {
	/**
	 * 应付价格
	 */
	private double price;
	
	/**
	 * 实付价格
	 */
	private double actualPrice;
	
	/**
	 * 价格类型
	 */
	private String priceType;
}

4.@FixMethodOrder(MethodSorters.NAME_ASCENDING )

测试 按照方法名字顺序执行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值