Skip to content
jwpttcg66 edited this page Apr 18, 2017 · 6 revisions

存储实体

注解讲解

  1. EntitySave 对象需要存储
  2. FieldSave 字段映射到数据库
  3. DbMapper 对象存储到mybatis的映射

代码使用

@EntitySave
@DbMapper(mapper = OrderMapper.class)
public class Order extends BaseLongIDEntity implements RedisInterface, AsyncSave {

    @FieldSave
    private String status;

    /**
     * @return status
     */
    public String getStatus() {
        return status;
    }

    /**
     * @param status
     */
    @MethodSaveProxy(proxy="status")
    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + getId() +
                ", userId=" + getUserId() +
                ", status='" + status + '\'' +
                '}';
    }

    @Override
    public String getUnionKey() {
        return String.valueOf(getUserId()+ EntityUtils.ENTITY_SPLIT_STRING + getId());
    }

    @Override
    public String getRedisKeyEnumString() {
        return RedisKeyEnum.PLAYER.getKey();
    }

}
Clone this wiki locally