正则匹配规则
| 查找 | 替换 | 替换说明 |
| import com.baomidou.mybatisplus.annotations.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | | |
| import com.baomidou.mybatisplus.annotations.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | | |
| import com.baomidou.mybatisplus.annotations.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | | |
| import com.baomidou.mybatisplus.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | | |
| import com.baomidou.mybatisplus.mapper.EntityWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | | |
| EntityWrapper | QueryWrapper | | |
| import com.baomidou.mybatisplus.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | | |
| import com.baomidou.mybatisplus.mapper.BaseMapper; | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | | |
| import com.baomidou.mybatisplus.toolkit.StringUtils; | import com.baomidou.mybatisplus.core.toolkit.StringUtils; | | |
| Service.selectOne( | Service.getOne( | | |
| this.selectOne( | this.getOne( | | |
| selectOne( | getOne( | | |
| import com.baomidou.mybatisplus.mapper.SqlHelper; | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; | | |
| SqlHelper.getObject( | SqlHelper.getObject(1, | | |
| this.insert( | this.save( | | |
| .and() | | | |
| .and( | .apply( | | |
| import com.baomidou.mybatisplus.toolkit.IdWorker; | import com.baomidou.mybatisplus.core.toolkit.IdWorker; | | |
| import com.baomidou.mybatisplus.enums.IdType; | import com.baomidou.mybatisplus.annotation.IdType; | | |
| import com.baomidou.mybatisplus.activerecord.Model; | import com.baomidou.mybatisplus.extension.activerecord.Model; | | |
| protected Serializable pkVal() | public Serializable pkVal() | | |
| import com.baomidou.mybatisplus.annotations.Version; | import com.baomidou.mybatisplus.annotation.Version; | | |
| import com.baomidou.mybatisplus.enums.FieldFill; | import com.baomidou.mybatisplus.annotation.FieldFill; | | |
| import com.baomidou.mybatisplus.plugins.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | | |
| import com.baomidou.mybatisplus.plugins.pagination.Pagination; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | | |
| Pagination | Page | | |
| Service.selectList( | Service.list( | | |
| Service.delete( | Service.remove( | | |
| .orderDesc( | .orderByDesc( | | |
| \.like\((.*), (.*), SqlLike\.DEFAULT\)\; | .like($1, $2); | | |
| \.like\((.*), (.*), SqlLike\.DEFAULT\)\; | .like($1, $2); | | |
| import com.baomidou.mybatisplus.mapper.MetaObjectHandler; | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; | | |
| extends MetaObjectHandler | implements MetaObjectHandler | | |
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | import org.apache.commons.lang3.StringUtils; | | |
| Service.selectById( | Service.getById( | | |
| Service.deleteById( | Service.removeById( | | |
| this.delete( | this.remove( | | |
| .orNew() | .or() | | |
| .selectMap( | .getMap( | | |
| com.baomidou.mybatisplus.toolkit.StringUtils | org.apache.commons.lang3.StringUtils | | |
| this.deleteById( | this.removeById( | | |
| tobeInput | tobeInput | | |
| 正则查找 | 正则替换 | 需要手动另外操作 | 替换说明 |
| apper\.selectOne\((.*)\) | apper.selectOne(new QueryWrapper<>($1)) | | | 3.x不再支持mapper的selectOne(T entity)方法,需要更改调用该方法的方式 |
| ([ |\t]*)this\.updateForSet\((.*)\, (.*)\)\; | $1$3.setSql($2); $1this.update($3); |
更改updateForSet()中第二个参数的类型为UpdateWrapper | 3.x不再支持service的updateForSet(String setSql, EntityWrapper wrapper)方法,需要更改调用该方法的方式为service.update(UpdateWrapper uw) |
| ([ |\t]*)([a-z|A-Z]*)Service\.updateForSet\((.*)\, (.*)\)\; | $1$4.setSql($3); $1$2Service.update($4); |
更改updateForSet()中第二个参数的类型为UpdateWrapper | 3.x不再支持service的updateForSet(String setSql, EntityWrapper wrapper)方法,需要更改调用该方法的方式为service.update(UpdateWrapper uw) |
| ([ |\t]*)([a-z|A-Z]*)apper\.updateForSet\((.*)\, (.*)\)\; | $1this.setSql($3); $1update($4); |
更改updateForSet()中第二个参数的类型为UpdateWrapper | BaseMapper类不支持update(UpdateWrapper)方法,如果调用类包含IService方法,需要替换为service.update(),如果不包含IService |
| (^[ \t]+)updateForSet\((.*)\, (.*)\)\; | $1$3.setSql($2); $1update($3); |
更改updateForSet()中第二个参数的类型为UpdateWrapper | 3.x不再支持service的updateForSet(String setSql, EntityWrapper wrapper)方法,需要更改调用该方法的方式为service.update(UpdateWrapper uw) |
| .andNew\(([^\)]) | .andNew().apply($1 | | | | |
| \.or\(([^\)]) | .or().apply($1 | | | | |
| ([a-z|A-Z|0-9]*)\.andNew\(\)([^;]*)\.or\(\)([^;]*); | $1.and($1_1->$1_1$2.or()$3); | | | | |
| .andNew() | | | | | |
| \.insertBatch\( | .saveBatch( | | | | |
| \.orderBy\((.*),([ ]*)false\) | .orderByDesc($1) | | | | |
| \.orderBy\((.*),([ ]*)true\) | .orderByAsc($1) | | | | |
| \.orderBy\( | .orderByAsc( | | | | |
| \.like\((.*), (.*), SqlLike\.DEFAULT\)\; | .like($1, $2); | | | | |
| \.like\((.*),(.*), SqlLike\.RIGHT\)\; | .likeRight($1,$2) | | | | |
| \.(like|notLike)\((.*),(.*),( *)SqlLike\.RIGHT\)\; | .$1Right($2, $3); | | | | |
| \.like\((.*),(.*), SqlLike\.CUSTOM\) | .apply($1+" like "+$2) | | | | |
| \nimport com\.baomidou\.mybatisplus\.enums\.SqlLike\; | | | | | |
| ([ +])selectList\( | $1list( | | | | |
| this\.selectList\( | this.list( | | | | |
| ([ |\t]+)delete\(([a-z|A-Z|0-9]*)\); | $1remove($2); | | | | |
| ([ |\t]+)insert\(([a-z|A-Z|0-9]*)\); | $1save($2); | | | | |
| ([ |\t]+)insertBatch\(([a-z|A-Z|0-9]*)\); | $1saveBatch($2); | | | | |
| tobeInput | tobeInput | | | | |