提交 594230ba 编写于 作者: sq3536's avatar sq3536

查询模型兼容 ctx

上级 0e58d318
...@@ -28,11 +28,11 @@ public class TransUtils { ...@@ -28,11 +28,11 @@ public class TransUtils {
public static String contextParamConvert(String contextParam) public static String contextParamConvert(String contextParam)
{ {
String resultParam=getJavaSqlCode(contextParam).replaceAll("(IN|in) \\(\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}\\)","$1 (\\${srf.$2.$3})"); String resultParam=getJavaSqlCode(contextParam).replaceAll("(IN|in) \\(\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}\\)","$1 (\\${ctx.$2.$3})");
resultParam=resultParam.replaceAll("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}","#{srf.$1.$2}"); resultParam=resultParam.replaceAll("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}","#{ctx.$1.$2}");
resultParam=resultParam.replaceAll("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)'\\)}","#{srf.$1.$2}"); resultParam=resultParam.replaceAll("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)'\\)}","#{ctx.$1.$2}");
Pattern p = Pattern.compile("srf.(datacontext|sessioncontext|webcontext).(\\w+)"); Pattern p = Pattern.compile("ctx.(datacontext|sessioncontext|webcontext).(\\w+)");
Matcher m = p.matcher(resultParam); Matcher m = p.matcher(resultParam);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
...@@ -82,8 +82,8 @@ public class TransUtils { ...@@ -82,8 +82,8 @@ public class TransUtils {
public static String checkNullContextParamConvert(String contextParam) { public static String checkNullContextParamConvert(String contextParam) {
String resultParam = getJavaSqlCode(contextParam).replaceAll("<#assign _value=srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)><#if _value\\?length gt 0>(.*?)\\(\\$\\{_value}\\)<#else>1=1</#if>"," ('${srf.$1.$2}'=null or '${srf.$1.$2}'='' or $4 \\${srf.$1.$2} "); String resultParam = getJavaSqlCode(contextParam).replaceAll("<#assign _value=srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)><#if _value\\?length gt 0>(.*?)\\(\\$\\{_value}\\)<#else>1=1</#if>"," ('${ctx.$1.$2}'=null or '${ctx.$1.$2}'='' or $4 \\${ctx.$1.$2} ");
resultParam = resultParam.replaceAll("<#assign _value=srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)><#if _value\\?length gt 0>(.*?)\\$\\{_value}(.*?)?<#else>1=1</#if>", " (#{srf.$1.$2}=null or #{srf.$1.$2}='' or $4#{srf.$1.$2}$5)"); resultParam = resultParam.replaceAll("<#assign _value=srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)><#if _value\\?length gt 0>(.*?)\\$\\{_value}(.*?)?<#else>1=1</#if>", " (#{ctx.$1.$2}=null or #{ctx.$1.$2}='' or $4#{ctx.$1.$2}$5)");
resultParam=contextParamConvert(resultParam); resultParam=contextParamConvert(resultParam);
return resultParam; return resultParam;
} }
......
...@@ -25,8 +25,8 @@ public interface {{entity.codeName}}Mapper extends BaseMapper<{{entity.codeName} ...@@ -25,8 +25,8 @@ public interface {{entity.codeName}}Mapper extends BaseMapper<{{entity.codeName}
{{#entity.dataSets}} {{#entity.dataSets}}
Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}(IPage page, @Param("srf") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper); Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}(IPage page, @Param("ctx") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}(@Param("srf") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper); List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}(@Param("ctx") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
{{/entity.dataSets}} {{/entity.dataSets}}
@Override @Override
......
...@@ -3,4 +3,4 @@ server: ...@@ -3,4 +3,4 @@ server:
#Log配置 #Log配置
logging: logging:
level: level:
{{packageName}}: info {{packageName}}: debug
\ No newline at end of file \ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册