globalConfig::setMetaObjectHandler);//TODO 注入主键生成器this.getBeanThen(IKeyGenerator.class, i ->globalConfig.getDbConfig().setKeyGenerator(i));//TODO 注入sql注入器this.getBeanThen(ISqlInjector.class, globalConfig::setSqlInjector);//TODO...
having having ( sql 语句 ) 例:having("sum(age) > {0}", 18) ---> having sum(age) > 18 func func 方法(主要方便在出现 if...else 下调用不同方法能不断链) 例:func(i -> if(true) {i.eq("id", 1)} else {i.ne("id", 2)}) ...
getKeyProperty(); // 去除转义符 keyColumn = SqlInjectionUtils.removeEscapeCharacter(tableInfo.getKeyColumn()); } else { if (null != tableInfo.getKeySequence()) { keyGenerator = TableInfoHelper.genKeyGenerator(this.methodName, tableInfo, builderAssistant); keyProperty = tableInfo.getKeyProperty(...
} else if (MatchSegment.GROUP_BY.match(firstSqlSegment)) { groupBy.addAll(list); } else if (MatchSegment.HAVING.match(firstSqlSegment)) { having.addAll(list); } else { normal.addAll(list); } cacheSqlSegment = false; } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14...
这是SQL拦截器,在上面使用自定义的查询器添加了关联查询之后就可以使用SQL拦截器进行sql的构造 类关系图如下: 代码实现 实现连接条件构造器 packagecom.jenkin.common.config;importcn.hutool.core.util.ArrayUtil;importcom.baomidou.mybatisplus.core.toolkit.StringUtils;importlombok.extern.slf4j.Slf4j;importnet.sf....
定义sql 方法名、sql 模板、实现 sql 的拼接组装 /** * 新增一个通用sql */ public class SelectByErp extends AbstractMethod { // 需要查询的列名 private final String erpColumn = "erp"; // sql方法名 private final String method = "selectByErp"; ...
INSERT) { setTimeIfNeccesary(parameter, CREATE_TIME_SETTER); setTimeIfNeccesary(parameter, UPDATE_TIME_SETTER); } else if (ms.getSqlCommandType() == SqlCommandType.UPDATE) { setTimeIfNeccesary(parameter, UPDATE_TIME_SETTER); } return invocation.getMethod().invoke(invocation.getTarget(), ...
}elseif(parameterinstanceofDouble[]) { typename = TYPE_NAME_NUMERIC; }if(typename ==null) {thrownewTypeException("arraytypehandler parameter typename error, your type is "+ parameter.getClass().getName()); }// 这2行是关键的代码,创建array,然后ps.setarray(i, array)就可以了Arrayarray=ps.get...
1、< if> <if test="problemId !=null and problemId !=''"> AND PROBLEM_ID =#{problemId,jdbcType=VARCHAR} </if> 1. 2. 3. 2、< choose>...< when>...< otherwise> 相当于if…else <choose> <when test="orderType =='asc'"> ...