我们在写 mybatis多表关联查询的时候 ,要配置  resultmap ,实在太麻烦。而这个超级父类 可以省去我们查询多表时的map


  1. public class SuperPojo extends TreeMap<String, Object> implements Serializable {
  2. /**
  3. *
  4. */
  5. private static final long serialVersionUID = 1L;
  6. public SuperPojo setProperty(String key , Object value){
  7. this.put(key, value);
  8. return this ;
  9. }
  10. }


我们在只需要在 多表查询的时候  制定 type 为 这个SuperPojo 就可以  , mybatis  会 自动将我们 数据库中多表查询 的数据  以  数据库字段  为 key 值   。数据库字段 对应的 值 为 value  装入 这个类中 

 如果我们页面要用这些数据 ,则直接 ${SuperPojo.数据库字段}  就可以。

原文地址:https://blog.csdn.net/superPojo/article/details/72777911

相关文章:

  • 2022-12-23
  • 2021-07-01
  • 2022-01-16
  • 2022-02-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-19
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
相关资源
相似解决方案