fix:bug#I8DLHU

V0.5.x
xiwa 2023-11-03 23:10:03 +08:00
parent 0a90c90498
commit 7217438afb
3 changed files with 31 additions and 20 deletions

View File

@ -7,6 +7,7 @@ import cc.iotkit.data.ICommonData;
import cc.iotkit.data.util.PageBuilder;
import cc.iotkit.model.Id;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
@ -120,8 +121,9 @@ public interface IJPACommData< T extends Id<ID>, ID> extends ICommonData<T , ID
if (Objects.isNull(data)) {
return null;
}
return Example.of(MapstructUtils.convert(data, getJpaRepositoryClass()));
return Example.of(MapstructUtils.convert(data, getJpaRepositoryClass()),
ExampleMatcher.matching().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)
);
}
}

View File

@ -303,9 +303,9 @@ public class SysUserDataImpl implements ISysUserData, IJPACommData<SysUser, Long
}
return PredicateBuilder.instance()
.and(ObjectUtil.isNotNull(user.getId()), () -> tbSysUser.id.eq(user.getId()))
.and(StringUtils.isNotEmpty(user.getUserName()), () -> tbSysUser.userName.like(user.getUserName()))
.and(StringUtils.isNotEmpty(user.getUserName()), () -> tbSysUser.userName.like("%" + user.getUserName() + "%"))
.and(StringUtils.isNotEmpty(user.getStatus()), () -> tbSysUser.status.eq(user.getStatus()))
.and(StringUtils.isNotEmpty(user.getPhonenumber()), () -> tbSysUser.phonenumber.like(user.getPhonenumber()))
.and(StringUtils.isNotEmpty(user.getPhonenumber()), () -> tbSysUser.phonenumber.like("%" + user.getPhonenumber() + "%"))
.and(ObjectUtil.isNotEmpty(ids), () -> tbSysUser.deptId.in(ids)).build();
}
}

View File

@ -9,8 +9,10 @@
*/
package cc.iotkit.config;
import lombok.extern.slf4j.Slf4j;
import redis.embedded.RedisServer;
@Slf4j
public class EmbeddedRedisConfig {
public static boolean embeddedEnable() {
@ -28,7 +30,14 @@ public class EmbeddedRedisConfig {
} else {
redisServer = new RedisServer();
}
try {
redisServer.start();
} catch (Exception e) {
if (e.getMessage().contains("Address already in use")) {
throw new RuntimeException("redis端口被占用请先停止本地的redis服务");
}
log.error("start redis server failed", e);
}
}
}