public boolean checkExist(String tableName) { Wrapper<DagConfDO> queryWrapper = Wrappers.<DagConfDO>query().lambda() .likeLeft(DagConfDO::getConf, tableName) .likeRight(DagConfDO::getConf, tableName) .orderByDes
@SpringBootTest@RunWith(SpringRunner.class)publicclassUserServiceTest{@ResourceprivateUserService userService;@ResourceprivateUserDAO userDAO;/** * 添加一条记录 */@TestpublicvoidtestAdd(){Useruser=User.builder() .id(1L) .userNo("001") .nickname("大哥") .email("shepherd@qq.com") .phone("1...
*/@TableField(fill=FieldFill.INSERT_UPDATE, jdbcType=JdbcType.VARCHAR)privateStringupdater;/*** 是否删除*/@TableLogicprivateBooleandeleted;} 3.3.2 自定义实现类 MyMetaObjectHandler publicclassDefaultDbFieldHandlerimplementsMetaObjectHandler {@OverridepublicvoidinsertFill(MetaObjectmetaObject) {if (Objects.non...
AI代码解释 @ComponentpublicclassMysqlDdlimplementsIDdl{@Overridepublicvoidsharding(Consumer<IDdl>consumer){// 多数据源指定,主库初始化从库自动同步String group="mysql";ShardingGroupProperty sgp=ShardingKey.getDbGroupProperty(group);if(null!=sgp){// 主库sgp.getMasterKeys().forEach(key->{ShardingKey....
if (StringUtils.hasText(this.properties.getConfigLocation())) { factory.setConfigLocation(this.resourceLoader.getResource(this.properties.getConfigLocation())); } applyConfiguration(factory); if (this.properties.getConfigurationProperties() != null) { ...
{String sqlStatement=sqlStatement(SqlMethod.INSERT_ONE);int size=entityList.size();executeBatch(sqlSession->{int i=1;//遍历需要插入的数据列表,也即将数据想打包,然后执行批量操作for(Tentity:entityList){sqlSession.insert(sqlStatement,entity);if((i%batchSize==0)||i==size){sqlSession.flushStatements...
public interface Compare<This, R> extends Serializable { default This eq(R column, Object val) { return this.eq(true, column, val); } This eq(boolean condition, R column, Object val);}这里面的This就是代表就是返回自身(这里字面是这个意思,实际也是这样弄的),在3.3.2版本里面...
/** * 白名单配置 */ @Data @Configuration @ConfigurationProperties(prefix = "tenant") public class TenantProperties { /** * 是否开启租户模式 */ private Boolean enable; /** * 多租户字段名称 */ private String column; /** * 多租户字段名称 */ private String header; /** * 需要排除的多租...
protected Children doIt(boolean condition, ISqlSegment... sqlSegments) { if (condition) { expression.add(sqlSegments); } return typedThis; } @FunctionalInterface public interface ISqlSegment extends Serializable { /** * SQL 片段 */ String getSqlSegment(); ...
@SpringBootTest class Mybatisplus02DqlApplicationTests { @Autowired private UserDao userDao; @Test void testGetAll(){ //模拟页面传递过来的查询数据 UserQuery uq = new UserQuery(); uq.setAge(10); uq.setAge2(30); LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<User>(); if(null...