实体 entity

【强制】 继承

以下描述的是三种场景下的继承,普通模块已经存在通用字段定义,如:id、createBy、createDate等,更详细的参考实体的介绍

  • basic的扩展模块(即basic模块+新模块组合成新的模块),继承 com.mingsoft.basic.entity,BasicEntity
  • 非basic扩展模块,但是需要区分应用数据(多站点),继承 com.mingsoft.basic.entity.BaseEntity
  • 普通模块,继承 com.mingsoft.base.eneity.BaseEntity;

【强制】 命名

  • 实体名与表名一致后面加Entity,例如:表名为news对应NewsEntity.java

  • 实体属性名必选与字段名、字段类型一致,例如:字段名为news_title对应属性定义 private String newsTitle

【参考】 属性处理

  • 整型推荐使用integer;

【参考】 相关注解

  • DateTimeFormate :入参

  • JsonFormat :出参

  • 时间类型要在属性之上添加@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")和 @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")注解。
  • 注意事项:在实体中运用了时间的主界,在返回数据的list.do的方法中就避免用this.outjson 的方式返回数据,从而导致DateTimeFormat注解无效,在dao中resultmap避免用mybits的collection 和 association中的select属性去查询相关数据(暂时不支持)
  • 相关实例:

Copyright © mingsoft.net 2018 all right reserved,powered by Gitbook该文件修订时间: 2020-05-25 13:43:14

results matching ""

    No results matching ""

    results matching ""

      No results matching ""