baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.3k stars 4.3k forks source link

Mybatis-Plus Comment #333

Closed qmdx closed 6 years ago

qmdx commented 6 years ago

提问方式参考: https://github.com/baomidou/mybatis-plus/issues/332

不符合一律不予回复!!

darren-wang commented 6 years ago

逻辑删除的视频能不能换个清楚一点的,上面的字什么都看不到。

zapollox commented 6 years ago

同一个主键,插入两次如何处理

MissJin commented 6 years ago

@xzsanmm 类User对象属性office指向类Office. 以前用mybatis,写sql:select a.id,a.office_id as office.id ,o.name as office.name from user a left join office o on a.office_id=o.id 通过该sql,可以在返回的user对象中获取office对象(id和name属性有值),一个查询就可以。 在plus中,好像就直接用officeId的属性来指明外部对象关联情况(查看了很多例子,sql查询只返回user对象,然后遍历user对象,通过officeId获取office对象再赋值) 在sql中,basemapper默认实现的select*函数中,该如何配置相关信息,以到达类似上面sql语句效果(不用另外编写xml文件中的sql语句,而是通过annonation的配置,获取在xml中额外配置部分语句)。

可以使用 在mapper中的定义一个 resultMap , 级联的表 可以用 collection 关键字

wangyijue commented 6 years ago

List list = new ArrayList(){{ add("015bce6e7d084693beb58c6a8ea39ea0"); add("01ba84356bb049e190d9ac77791c14b1"); add("01df182396d3473fae79ce52af078b34"); add("0246cae1e472429c857b33c5ff5f2cd3"); add("073bca8a41db4c429cd49d8eb4620079"); add("0753dcdc6f844dbc94f919abc1cfcc9c"); add("079e7fd492bb4d44abd662380c36b738"); }}; return this.selectList(new EntityWrapper().in("id",list)); 整合的spring boot2.0 每次这么写都会报错 类似这种 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'type' not found. Available parameters are [ew, param1] 请问怎么解决

qmdx commented 6 years ago

@wangyijue 这个才是重点 Parameter 'type' not found.

miYox-z commented 6 years ago

yml文件有误吧 为什么db-config节点没了

kallima55206086 commented 6 years ago

这个以后还要维护吗

kallima55206086 commented 6 years ago

还是3.0 就是终结版了

kallima55206086 commented 6 years ago

sql-injector: com.baomidou.mybatisplus.extension.injector.LogicSqlInjector 3.0 这个在spring boot 中直接配置就报错啊,该怎么配置啊

qmdx commented 6 years ago

@kallima55206086 2.3 是 2.x 的终结, 3.x 是新的开始 ,你的错请看我们的 sb demo 3 的注入方式不是这样的

suollk commented 6 years ago

@darren-wang 你这个问题 其实可以直接重写他的生成代码

Z-Beatles commented 5 years ago

/* 前缀处理 / String property = fieldInfo.getProperty(); Class propertyType = fieldInfo.getPropertyType(); property = StringUtils.removeIsPrefixIfBoolean(property, propertyType);

    • 去除boolean类型is开头的字符串
    • @param propertyName 字段名
    • @param propertyType 字段类型
    • @return */ public static String removeIsPrefixIfBoolean(String propertyName, Class propertyType)这个能不能配置啊别强制转 这个强制去除很头疼啊,新版本解决了吗。或者老铁们有什么优雅的方法吗?