From c9c6dd5c1dd096434f7eb79ba54b050c352aac88 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Thu, 28 Mar 2024 14:44:24 +0800 Subject: [PATCH] =?UTF-8?q?Online=E8=A1=A8=E5=8D=95=E4=B8=AD=20=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=90=9C=E7=B4=A2=E6=A1=86=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=97=B6=E6=8A=A5sql=E9=94=99=E8=AF=AF=EF=BC=8C=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84SQL=E5=A4=9A=E4=BA=86=E4=B8=80=E4=B8=AA=20?= =?UTF-8?q?=E2=80=9Cand"=20#5978=20=E5=AD=97=E5=85=B8=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=87=BA=E9=94=99=20#1108?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SysDictServiceImpl.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java index efa3f5bd88..db94bd7fa9 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java @@ -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; @@ -67,6 +68,9 @@ public class SysDictServiceImpl extends ServiceImpl impl @Lazy @Autowired private ISysBaseAPI sysBaseAPI; + @Lazy + @Autowired + private RedisUtil redisUtil; @Override public boolean duplicateCheckData(DuplicateCheckVo duplicateCheckVo) { @@ -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; @@ -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()); } /**