return false; } else { Class<?> cls = entity.getClass(); TableInfo tableInfo = TableInfoHelper.getTableInfo(cls); Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!", new Object[0]); String keyProperty = tableInfo.getKeyProperty();...
MONTH_DATA.remove(); }//动态表名接口实现方法@OverridepublicStringdynamicTableName(String sql, String tableName){if(this.tableNames.contains(tableName)){returntableName +"_"+ MONTH_DATA.get();//表名增加月份后缀}else{returntableName;//表名原样返回} } } 大家先对上面的代码有一个基础了解,看...
metaObject.setValue(tableInfo.getKeyProperty(), IdWorker.getId()); } else if (tableInfo.getIdType() == IdType.ID_WORKER_STR) { metaObject.setValue(tableInfo.getKeyProperty(), IdWorker.getIdStr()); } else if (tableInfo.getIdType() == IdType.UUID) { metaObject.setValue(tableInfo.getK...
情况2,进入else分支(物理删除): 可以看出,最终是选择LOGIC_DELETE_BY_ID sql模板还是DELETE_BY_ID sql模板,主要是tableInfo.isWithLogicDelete()这个变量来决定的; 这个isWithLogicDelete方法是获取TableInfo类中的bool类型属性isWithLogicDelete; 那么,isWithLogicDelete又是怎么赋值的呢? TableInfo的withLogicDelete...
func func 方法(主要方便在出现 if...else 下调用不同方法能不断链) 例:func(i -> if(true) {i.eq("id", 1)} else {i.ne("id", 2)}) or 或者 注意:主动调用or表示紧接着下一个方嘎不是用and连接!(不调用or则默认为使用and连接)例:eq("id", 1).or.eq("name", "张三") ---> id ...
@Test public void testAutoFill() { User user = new User(); user.setName("tom").setAge(20).setEmail("tom@163.com"); if (userService.save(user)) { userService.list().forEach(System.out::println); } else { System.out.println("添加数据失败"); } } 5、逻辑删除 (1)简介 删除数据...
(@PathVariable Integer page,@PathVariable Integer size){Map<String,Object>map=newHashMap<>();Page<QuestionStudentVO>questionStudent=questionService.getQuestionStudent(newPage<>(page,size));if(questionStudent.getRecords().size()==0){map.put("code",400);}else{map.put("code",200);map.put("...
} else { String resource = child.getStringAttribute("resource"); String url = child.getStringAttribute("url"); String mapperClass = child.getStringAttribute("class"); if (resource != null && url == null && mapperClass == null) { ...
} else { // INFO: DCTANT: 2021/12/27 去执行update的代码 return false; } }, (sqlSession, entity) -> { // INFO: DCTANT: 2021/12/27 判断为update,然后执行必要操作 if (entity == null) { return; } // INFO: DCTANT: 2021/12/27 update前加一些自己的业务逻辑,如setUpdateTime等等 ...