Skip to content

Commit

Permalink
Online表单中 下拉搜索框 搜索时报sql错误,生成的SQL多了一个 “and" #5978
Browse files Browse the repository at this point in the history
字典下拉异步出错 #1108
  • Loading branch information
zhangdaiscott committed Mar 28, 2024
1 parent f3cf90b commit c9c6dd5
Showing 1 changed file with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jeecg.common.system.vo.DictModelMany;
import org.jeecg.common.system.vo.DictQuery;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.SqlInjectionUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
Expand Down Expand Up @@ -67,6 +68,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
@Lazy
@Autowired
private ISysBaseAPI sysBaseAPI;
@Lazy
@Autowired
private RedisUtil redisUtil;

@Override
public boolean duplicateCheckData(DuplicateCheckVo duplicateCheckVo) {
Expand Down Expand Up @@ -565,16 +569,17 @@ private String getFilterSql(String tableSql, String text, String code, String co
}

//下拉搜索组件 支持传入排序信息 查询排序
if(oConvertUtils.isNotEmpty(condition) && oConvertUtils.isNotEmpty(keywordSql)){
filterSql += sqlWhere + sqlAnd + condition + sqlAnd + keywordSql;
}else if(oConvertUtils.isNotEmpty(condition)){
filterSql += sqlWhere + sqlAnd + condition;
}else if(oConvertUtils.isNotEmpty(keywordSql)){
filterSql += sqlWhere + sqlAnd + keywordSql;
} else if (tableHasWhere){
filterSql += sqlWhere;
}

//update-begin---author:chenrui ---date:20240327 for:[QQYUN-8514]Online表单中 下拉搜索框 搜索时报sql错误,生成的SQL多了一个 “and" ------------
if (oConvertUtils.isNotEmpty(condition) && oConvertUtils.isNotEmpty(keywordSql)) {
filterSql += sqlWhere + (tableHasWhere ? sqlAnd : " ") + condition + sqlAnd + keywordSql;
} else if (oConvertUtils.isNotEmpty(condition)) {
filterSql += sqlWhere + (tableHasWhere ? sqlAnd : " ") + condition;
} else if (oConvertUtils.isNotEmpty(keywordSql)) {
filterSql += sqlWhere + (tableHasWhere ? sqlAnd : " ") + keywordSql;
} else if (tableHasWhere) {
filterSql += sqlWhere;
}
//update-end---author:chenrui ---date:20240327 for:[QQYUN-8514]Online表单中 下拉搜索框 搜索时报sql错误,生成的SQL多了一个 “and" ------------
// 增加排序逻辑
if (oConvertUtils.isNotEmpty(orderField)) {
filterSql += " order by " + orderField + " " + orderType;
Expand Down Expand Up @@ -818,6 +823,8 @@ public void editDictByLowAppId(SysDictVo sysDictVo) {
sysDict.setId(id);
baseMapper.updateById(sysDict);
this.updateDictItem(id,sysDictVo.getDictItemsList());
// 删除字典缓存
redisUtil.removeAll(CacheConstant.SYS_DICT_CACHE + "::" + dict.getDictCode());
}

/**
Expand Down

0 comments on commit c9c6dd5

Please sign in to comment.