mirror of https://gitee.com/stylefeng/roses
整理wrapper查询逻辑
parent
16b4e825fb
commit
576fa5aeb7
|
@ -134,28 +134,29 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
|||
private LambdaQueryWrapper<SysConfig> createWrapper(SysConfigParam sysConfigParam) {
|
||||
LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (ObjectUtil.isNotNull(sysConfigParam)) {
|
||||
|
||||
String configName = sysConfigParam.getConfigName();
|
||||
String configCode = sysConfigParam.getConfigCode();
|
||||
String groupCode = sysConfigParam.getGroupCode();
|
||||
|
||||
// 如果名称不为空,则带上名称搜素搜条件
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(configName), SysConfig::getConfigName, configName);
|
||||
|
||||
// 如果常量编码不为空,则带上常量编码搜素搜条件
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(configCode), SysConfig::getConfigCode, configCode);
|
||||
|
||||
// 如果分类编码不为空,则带上分类编码
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(groupCode), SysConfig::getGroupCode, groupCode);
|
||||
}
|
||||
|
||||
// 查询未删除的
|
||||
queryWrapper.ne(SysConfig::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||
|
||||
// 按类型升序排列,同类型的排在一起
|
||||
queryWrapper.orderByDesc(SysConfig::getGroupCode);
|
||||
|
||||
if (ObjectUtil.isEmpty(sysConfigParam)) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
String configName = sysConfigParam.getConfigName();
|
||||
String configCode = sysConfigParam.getConfigCode();
|
||||
String groupCode = sysConfigParam.getGroupCode();
|
||||
|
||||
// 如果名称不为空,则带上名称搜素搜条件
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(configName), SysConfig::getConfigName, configName);
|
||||
|
||||
// 如果常量编码不为空,则带上常量编码搜素搜条件
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(configCode), SysConfig::getConfigCode, configCode);
|
||||
|
||||
// 如果分类编码不为空,则带上分类编码
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(groupCode), SysConfig::getGroupCode, groupCode);
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
|
|
@ -222,15 +222,19 @@ public class DatabaseInfoServiceImpl extends ServiceImpl<DatabaseInfoMapper, Dat
|
|||
private LambdaQueryWrapper<DatabaseInfo> createWrapper(DatabaseInfoRequest databaseInfoRequest) {
|
||||
LambdaQueryWrapper<DatabaseInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 查询没被删除的
|
||||
queryWrapper.eq(DatabaseInfo::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
|
||||
if (ObjectUtil.isEmpty(databaseInfoRequest)) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
// 根据名称模糊查询
|
||||
String dbName = databaseInfoRequest.getDbName();
|
||||
|
||||
// 拼接sql 条件
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(dbName), DatabaseInfo::getDbName, dbName);
|
||||
|
||||
// 查询没被删除的
|
||||
queryWrapper.eq(DatabaseInfo::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,13 @@ public class TranslationServiceImpl extends ServiceImpl<TranslationMapper, Trans
|
|||
private LambdaQueryWrapper<Translation> createWrapper(TranslationRequest translationRequest) {
|
||||
LambdaQueryWrapper<Translation> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 按翻译编码倒序排列
|
||||
queryWrapper.orderByDesc(Translation::getTranCode);
|
||||
|
||||
if (ObjectUtil.isEmpty(translationRequest)) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
Long tranId = translationRequest.getTranId();
|
||||
String tranCode = translationRequest.getTranCode();
|
||||
String tranName = translationRequest.getTranName();
|
||||
|
@ -142,9 +149,6 @@ public class TranslationServiceImpl extends ServiceImpl<TranslationMapper, Trans
|
|||
queryWrapper.like(ObjectUtil.isNotEmpty(tranName), Translation::getTranName, tranName);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(tranLanguageCode), Translation::getTranLanguageCode, tranLanguageCode);
|
||||
|
||||
// 按翻译编码倒序排列
|
||||
queryWrapper.orderByDesc(Translation::getTranCode);
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,13 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
|||
private LambdaQueryWrapper<SysLog> createWrapper(LogManagerRequest logManagerRequest) {
|
||||
LambdaQueryWrapper<SysLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 根据时间倒序排序
|
||||
queryWrapper.orderByDesc(SysLog::getCreateTime);
|
||||
|
||||
if (ObjectUtil.isEmpty(logManagerRequest)) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
String beginDateTime = logManagerRequest.getBeginDateTime();
|
||||
String endDateTime = logManagerRequest.getEndDateTime();
|
||||
|
||||
|
@ -109,9 +116,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
|||
queryWrapper.eq(StrUtil.isNotEmpty(clientIp), SysLog::getClientIp, clientIp);
|
||||
queryWrapper.eq(StrUtil.isNotEmpty(url), SysLog::getRequestUrl, url);
|
||||
|
||||
// 根据时间倒序排序
|
||||
queryWrapper.orderByDesc(SysLog::getCreateTime);
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue