提交 59cbb66b 编写于 作者: sq3536's avatar sq3536

提交

上级 4be78d7f
package cn.ibizlab;
import cn.ibizlab.core.util.config.FilterDataResolver;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
......@@ -36,8 +37,9 @@ import org.springframework.beans.factory.annotation.Autowired;
@EnableScheduling
public class DevBootApplication extends WebMvcConfigurerAdapter {
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
FilterDataResolver filterDataResolver;
public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class, args);
......@@ -46,6 +48,6 @@ public class DevBootApplication extends WebMvcConfigurerAdapter {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(resolver);
argumentResolvers.add(filterDataResolver);
}
}
......@@ -2,7 +2,7 @@ spring:
datasource:
username: root
password: root
url: jdbc:mysql://172.16.100.77:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true&useTimezone=true&serverTimezone=GMT%2B8
url: jdbc:mysql://127.0.0.1:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true&useTimezone=true&serverTimezone=GMT%2B8
isSyncDBSchema: false
dynamic:
druid: #以下是全局默认值,可以全局更改
......
......@@ -292,18 +292,21 @@ public class DOModel extends EntityBase implements Serializable {
}
public POSchema getPOSchema(String name)
{
if(StringUtils.isEmpty(name)&&this.getSchema()!=null)
name=this.getSchema().getDefaultDataSoruce();
if(poSchemas==null)
poSchemas=new LinkedHashMap<>();
if(poSchemas.containsKey(name))
{
return poSchemas.get(name);
}
else if(this.getSchema()!=null&&("default".equals(name)||this.getSchema().getDefaultTableName().equals(name)))
else if(this.getSchema()!=null&&("default".equals(name)||this.getSchema().getDefaultDataSoruce().equals(name)))
{
POSchema defaultPOSchema= TransUtils.PojoSchema2PO(this.getSchema());
if(defaultPOSchema!=null) {
poSchemas.put("default", defaultPOSchema);
poSchemas.put(this.getSchema().getDefaultTableName(),defaultPOSchema);
poSchemas.put(this.getSchema().getDefaultDataSoruce(),defaultPOSchema);
return defaultPOSchema;
}
}
......
package cn.ibizlab.core.data.dto;
import cn.ibizlab.core.data.model.POSchema;
import cn.ibizlab.util.filter.QueryFilter;
import cn.ibizlab.util.filter.QueryWrapperContext;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import cn.ibizlab.util.security.AuthenticationUser;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.lang.reflect.ParameterizedType;
import java.util.*;
public class FilterData<T> extends BaseData
{
public FilterData set(String key, Object value)
{
this.put(key,value);
return this;
}
public String getDataSource()
{
return this.getStringValue("datasource");
}
public String getQuery()
{
return this.getStringValue("query");
}
public FilterData setQuery(String query)
{
return this.set("query",query);
}
public int getPage()
{
return this.getIntegerValue("page",0);
}
public FilterData setPage(int page)
{
return this.set("page",page);
}
public int getSize()
{
return getIntegerValue("size",20);
}
public FilterData setSize(int size)
{
return this.set("size",size);
}
public String getSort()
{
return this.getStringValue("sort");
}
public FilterData setSort(String sort) {
pageable=PageRequest.of(getPage(),getSize(),getPageSort());
return this.set("sort",sort);
}
@JsonIgnore
@JSONField(serialize = false)
public Sort pageSort;
@JsonIgnore
@JSONField(serialize = false)
public Sort getPageSort()
{
if(pageSort==null)
{
if(!StringUtils.isEmpty(getSort())){
String sortArr[]=getSort().split(",");
String sortField=sortArr[0];
String sortDirection=sortArr.length>1?sortArr[1]:"asc";
if(sortDirection.equalsIgnoreCase("desc"))
this.pageSort=Sort.by(Sort.Direction.DESC,sortField);
else
this.pageSort=Sort.by(Sort.Direction.ASC,sortField);
}
else
this.pageSort=Sort.unsorted();
}
return pageSort;
}
@JsonIgnore
@JSONField(serialize = false)
public Pageable pageable;
@JsonIgnore
@JSONField(serialize = false)
public Pageable getPageable() {
if(pageable==null)
pageable=PageRequest.of(getPage(),getSize(),getPageSort());
return pageable;
}
public FilterData setPageable(Pageable pageable)
{
this.pageable=pageable;
return this;
}
public BaseData getParams()
{
BaseData param=null;
Object obj=this.get("params");
if(obj!=null)
{
if(obj instanceof BaseData)
param=(BaseData)obj;
else if(obj instanceof Map)
{
param=new BaseData().setAll((Map)obj);
this.set("params",param);
}
}
else
{
return this;
}
return param;
}
public FilterData setParams(BaseData params)
{
return this.set("params",params);
}
@JsonIgnore
@JSONField(serialize = false)
public Map<String,Object> getDatacontext() {
return getParams();
}
@JsonIgnore
@JSONField(serialize = false)
public Map<String,Object> getWebcontext() {
return getParams();
}
@JsonIgnore
@JSONField(serialize = false)
public Map<String,Object> getSessioncontext() {
return AuthenticationUser.getAuthenticationUser().getSessionParams();
}
public String getUserTaskId() {
return this.getStringValue("userTaskId",this.getParams().getStringValue("userTaskId"));
}
public FilterData setUserTaskId(String userTaskId)
{
return this.set("userTaskId",userTaskId);
}
public String getProcessDefinitionKey() {
return this.getStringValue("processDefinitionKey",this.getParams().getStringValue("processDefinitionKey"));
}
public FilterData setProcessDefinitionKey(String processDefinitionKey)
{
return this.set("processDefinitionKey",processDefinitionKey);
}
private QueryFilter filter;
public QueryFilter getFilter()
{
return filter;
}
public FilterData setFilter(QueryFilter filter)
{
this.filter=filter;
return this;
}
public Page getPages(POSchema poSchema)
{
return getPages(poSchema,this.getPageable());
}
public static Page getPages(POSchema poSchema,Pageable pageable){
Page page;
int currentPage=pageable.getPageNumber();
int pageSize=pageable.getPageSize();
//构造mybatis-plus分页
if(StringUtils.isEmpty(currentPage) || StringUtils.isEmpty(pageSize)) {
page=new Page(1,Short.MAX_VALUE);
}
else {
page=new Page(currentPage+1,pageSize);
}
//构造mybatis-plus排序
Sort sort = pageable.getSort();
Iterator<Sort.Order> it_sort = sort.iterator();
if(ObjectUtils.isEmpty(it_sort)) {
return page;
}
while (it_sort.hasNext()) {
Sort.Order sort_order = it_sort.next();
String colName=sort_order.getProperty();
if(poSchema!=null&&poSchema.getColumn(colName)!=null)
colName=poSchema.getColumn(colName).getName();
page.addOrder(new OrderItem().setColumn(colName).setAsc(sort_order.getDirection()!= Sort.Direction.DESC));
}
return page;
}
@JsonIgnore
@JSONField(serialize = false)
private QueryWrapper searchCond=null;
public QueryWrapper getSearchCond()
{
if(searchCond==null)
{
if(this.getFilter()!=null)
{
QueryWrapperContext context=new QueryWrapperContext();
context.setFilter(this.getFilter());
searchCond = context.getSelectCond();
}
else
{
searchCond=new QueryWrapper();
}
for(Object obj:this.keySet())
{
String key=obj.toString().toLowerCase();
if(key.startsWith("n_")&&key.endsWith("_like"))
{
searchCond.like(key.substring(2).replace("_like",""),this.get(obj));
}
}
}
return searchCond;
}
public String getSql(POSchema.Segment segment)
{
String sql=segment.getBody();
QueryWrapper qw=this.getSearchCond();
if(qw!=null&&qw.getSqlSegment()!=null)
{
if(!qw.isEmptyOfWhere())
sql=sql.concat(" where ");
sql = sql.concat(qw.getSqlSegment());
}
return sql;
}
}
......@@ -11,6 +11,8 @@ import net.ibizsys.model.dataentity.defield.IPSDEField;
import net.ibizsys.model.dataentity.defield.IPSLinkDEField;
import net.ibizsys.model.dataentity.der.IPSDER1N;
import net.ibizsys.model.dataentity.der.IPSDERBase;
import net.ibizsys.model.dataentity.ds.IPSDEDataQueryCode;
import net.ibizsys.model.dataentity.ds.IPSDEDataQueryCodeCond;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
......@@ -302,9 +304,12 @@ public class DynamicModelService {
if(dataQuery.getAllPSDEDataQueryCodes()!=null)
{
dataQuery.getAllPSDEDataQueryCodes().forEach(dq->{
String code=getQueryCode(dq);
MetaDataSetModel dsModel=new MetaDataSetModel().setDatasetId(entityModel.getEntityName().toLowerCase()+"-dq-"+dataQuery.getCodeName()+"-"+dq.getDBType().toLowerCase())
.setDatasetName(dataQuery.getLogicName()).setCodeName(dataQuery.getCodeName())
.setEntityId(entityModel.getEntityId()).setEntityName(entityModel.getEntityName()).setDsCode(dq.getQueryCode());
.setEntityId(entityModel.getEntityId()).setEntityName(entityModel.getEntityName()).setDsCode(code);
entityModel.addDataSet(dsModel);
});
}
......@@ -343,7 +348,8 @@ public class DynamicModelService {
code = map.get(dq.getDBType());
code = code+"\r\n union all \r\n";
}
code = code+"<include refid=\""+entityModel.getEntityName().toLowerCase()+"_dq_"+dataQuery.getCodeName()+"_"+dq.getDBType().toLowerCase()+"\"/>";
code = code+ getQueryCode(dq);
;//"<include refid=\""+entityModel.getEntityName().toLowerCase()+"_dq_"+dataQuery.getCodeName()+"_"+dq.getDBType().toLowerCase()+"\"/>";
map.put(dq.getDBType(),code);
});
}
......@@ -461,4 +467,51 @@ public class DynamicModelService {
}
}
/*
<#function contextParamConvert contextParam>
<#comment>补充上下文的IN查询(in通过$获取参数,其余为#): IN (${srfdatacontext('cityid','{"defname":"CITYID","dename":"CITY"}')}) -->IN ( ${srf.srfdatacontext.cityid} ) </#comment>
<#assign resultParam=contextParam?replace("(IN|in) \\(\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}\\)","$1 (\\$\{srf.$2.$3})","r")>
<#comment>平台配置格式替换${srfdatacontext('cityid','{"defname":"CITYID","dename":"CITY"}')} --> #{srf.srfdatacontext.cityid} </#comment>
<#assign resultParam=resultParam?replace("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}","#\{srf.$1.$2}","r")>
<#comment>用户配置格式替换${srfdatacontext('cityid')} --> #{srf.srfdatacontext.cityid} </#comment>
<#assign resultParam=resultParam?replace("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)'\\)}","#\{srf.$1.$2}","r")>
<#comment>将上下文参数转小写 #{srf.srfdatacontext.SRFORGID} --> #{srf.srfdatacontext.srforgid}</#comment>
<#assign params=resultParam?matches('srf.(datacontext|sessioncontext|webcontext).(\\w+)')>
<#list params as param>
<#assign resultParam=resultParam?replace(param,param?lower_case,'i')>
</#list>
<#if sys.getSaaSMode()==1 && item.getSaaSMode()==1>
<#assign resultParam=resultParam?replace("AND t11.SRFDCID = '__SRFSAASDCID__'","")>
</#if>
<#return resultParam>
</#function>
*/
private String contextParamConvert(String contextParam)
{
String resultParam=contextParam.replaceAll("(IN|in) \\(\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}\\)","$1 (\\${srf.$2.$3})");
resultParam=resultParam.replaceAll("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)','(.*?)'\\)}","#{srf.$1.$2}");
resultParam=resultParam.replaceAll("\\$\\{srf(datacontext|sessioncontext|webcontext)\\('(\\w+)'\\)}","#{srf.$1.$2}");
resultParam=resultParam.replace("AND t11.SRFDCID = '__SRFSAASDCID__'","");
return resultParam;
}
private String getQueryCode(IPSDEDataQueryCode dq)
{
String code=contextParamConvert(dq.getQueryCode());
if(dq.getPSDEDataQueryCodeConds()!=null)
{
int i=0;
for(IPSDEDataQueryCodeCond cond:dq.getPSDEDataQueryCodeConds())
{
if(i==0)
code=code.concat(" where ");
else if(i>0)
code=code.concat(" and ");
code=code.concat(contextParamConvert(cond.getCustomCond()));
i++;
}
}
return code;
}
}
package cn.ibizlab.core.data.mapper;
import cn.ibizlab.core.data.dto.BaseData;
import cn.ibizlab.core.data.dto.FilterData;
import cn.ibizlab.core.data.model.POSchema;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface DbDataMapper {
List<BaseData> search(@Param("sql") String sql, @Param("ew") Wrapper<BaseData> wrapper);
int searchCount(@Param("sql") String sql, @Param("ew") Wrapper<BaseData> wrapper);
int insertData(@Param("schema") POSchema schema, @Param("data") BaseData data);
int saveBatch(@Param("schema") POSchema schema, @Param("list") List<BaseData> list);
int updateData(@Param("schema") POSchema schema, @Param("data") BaseData data);
int removeData(@Param("schema") POSchema schema, @Param("data") BaseData data);
int save(@Param("schema") POSchema schema, @Param("data") BaseData data);
int saveBatch(@Param("schema") POSchema schema, @Param("list") List<BaseData> list);
List<BaseData> checkData(@Param("schema") POSchema schema, @Param("data") BaseData data);
int countData(@Param("schema") POSchema schema, @Param("data") BaseData data);
List<BaseData> getData(@Param("schema") POSchema schema, @Param("data") BaseData data);
int insertData(@Param("schema") POSchema schema, @Param("data") BaseData data);
List<BaseData> selectData(@Param("schema") POSchema schema, @Param("data") BaseData data);
Page<BaseData> selectData(@Param("schema") POSchema schema, @Param("data") BaseData data, IPage page);
int updateData(@Param("schema") POSchema schema, @Param("data") BaseData data);
@Update("${sql}")
boolean executeRaw(@Param("schema") POSchema schema, @Param("sql") String sql, @Param("param") BaseData param);
@Select("${sql}")
List<BaseData> queryData(@Param("schema") POSchema schema, @Param("sql") String sql, @Param("srf") FilterData context, @Param("ew") QueryWrapper wrapper);
@Select("${sql}")
Page<BaseData> queryData(@Param("schema") POSchema schema, @Param("sql") String sql, @Param("srf") FilterData context, @Param("ew") QueryWrapper wrapper, IPage page);
int removeData(@Param("schema") POSchema schema, @Param("data") BaseData data);
}
\ No newline at end of file
......@@ -571,12 +571,7 @@ public class POSchema {
String cols="";
if(getBaseColumnMap()!=null)
{
for(String key:baseColumnMap.keySet())
{
if(!StringUtils.isEmpty(cols))
cols+=",";
cols+=("t1."+key+" as "+baseColumnMap.get(key));
}
cols=String.join(",",baseColumnMap.keySet());
}
else
cols="t1.*";
......
......@@ -2,9 +2,14 @@ package cn.ibizlab.core.data.service.impl;
import cn.ibizlab.core.data.domain.DOModel;
import cn.ibizlab.core.data.dto.BaseData;
import cn.ibizlab.core.data.dto.FilterData;
import cn.ibizlab.core.data.dto.RequestData;
import cn.ibizlab.core.data.dto.ResponseData;
import cn.ibizlab.core.data.service.IDataService;
import cn.ibizlab.util.filter.SearchContextBase;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.io.Serializable;
......@@ -15,89 +20,152 @@ import java.util.List;
*/
@Slf4j
@Service
public class MongoDataServiceImpl extends BaseDataService {
public class MongoDataServiceImpl implements IDataService
{
@Override
public ResponseData call(DOModel model, String scope, String datasource, String method, RequestData requestData)
{
return null;
}
@Override
public boolean create(DOModel model, String scope, String datasource, BaseData et)
{
return false;
}
@Override
public void createBatch(DOModel model, String scope, String datasource, List<BaseData> list)
{
}
@Override
public boolean create(DOModel model, String datasource, BaseData et)
public boolean update(DOModel model, String scope, String datasource, BaseData et)
{
return false;
}
@Override
public void createBatch(DOModel model, String datasource, List<BaseData> list)
public void updateBatch(DOModel model, String scope, String datasource, List<BaseData> list)
{
}
@Override
public boolean update(DOModel model, String datasource, BaseData et)
public boolean remove(DOModel model, String scope, String datasource, Serializable key)
{
return false;
}
@Override
public void updateBatch(DOModel model, String datasource, List<BaseData> list)
public void removeBatch(DOModel model, String scope, String datasource, List<Serializable> idList)
{
}
@Override
public boolean remove(DOModel model, String datasource, Serializable key)
public boolean removeByMap(DOModel model, String scope, String datasource, BaseData et)
{
return false;
}
@Override
public void removeBatch(DOModel model, String datasource, List<Serializable> idList)
public BaseData get(DOModel model, String scope, String datasource, Serializable key)
{
return null;
}
@Override
public List<BaseData> getBatch(DOModel model, String scope, String datasource, List<Serializable> idList)
{
return null;
}
@Override
public BaseData get(DOModel model, String datasource, Serializable key)
public BaseData getByMap(DOModel model, String scope, String datasource, BaseData et)
{
return null;
}
@Override
public BaseData getDraft(DOModel model, String datasource, BaseData et)
public BaseData getDraft(DOModel model, String scope, String datasource, BaseData et)
{
return null;
}
@Override
public boolean checkKey(DOModel model, String datasource, BaseData et)
public boolean checkKey(DOModel model, String scope, String datasource, BaseData et)
{
return false;
}
@Override
public boolean save(DOModel model, String datasource, BaseData et)
public boolean save(DOModel model, String scope, String datasource, BaseData et)
{
return false;
}
@Override
public void saveBatch(DOModel model, String datasource, List<BaseData> list)
public void saveBatch(DOModel model, String scope, String datasource, List<BaseData> list)
{
}
@Override
public Page<BaseData> fetch(DOModel model, String dataSet, String datasource, SearchContextBase context)
public List<BaseData> select(DOModel model, String scope, String datasource, BaseData et)
{
return null;
}
@Override
public List<BaseData> list(DOModel model, String dataSet, String datasource, SearchContextBase context)
public Page<BaseData> select(DOModel model, String scope, String datasource, BaseData et, Pageable pageable)
{
return null;
}
@Override
public List<BaseData> query(DOModel model, String scope, String datasource, String dataQuery, FilterData context)
{
return null;
}
@Override
public Page<BaseData> query(DOModel model, String scope, String datasource, String dataQuery, FilterData context, Pageable pageable)
{
return null;
}
@Override
public List<BaseData> selectRaw(DOModel model, String scope, String datasource, String sql, FilterData context)
{
return null;
}
@Override
public boolean execRaw(DOModel model, String scope, String datasource, String sql, BaseData param)
{
return false;
}
@Override
public List<BaseData> fetch(DOModel model, String scope, String datasource, String dataSet, FilterData context)
{
return null;
}
@Override
public Page<BaseData> fetch(DOModel model, String scope, String datasource, String dataSet, FilterData context, Pageable pageable)
{
return null;
}
@Override
public DOModel getDOModel(String system, String entity)
{
return null;
}
}
package cn.ibizlab.core.util.config;
import cn.ibizlab.core.data.dto.FilterData;
import cn.ibizlab.util.filter.SearchContextBase;
import cn.ibizlab.util.domain.DTOBase;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class FilterDataResolver implements HandlerMethodArgumentResolver {
@Value("${ibiz.pageLimit:1000}")
private int pageLimit=1000;
private static ObjectMapper objectMapper=new ObjectMapper();
@Override
public boolean supportsParameter(MethodParameter parameter) {
return SearchContextBase.class.isAssignableFrom(parameter.getParameterType()) || DTOBase.class.isAssignableFrom(parameter.getParameterType())
|| FilterData.class.isAssignableFrom(parameter.getParameterType());
}
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
Map<String, String[]> params = webRequest.getParameterMap();
LinkedHashMap<String,Object> set = new LinkedHashMap<>();
for (String key : params.keySet()) {
set.put(key,params.get(key)[0]);
}
if(SearchContextBase.class.isAssignableFrom(parameter.getParameterType()) && (!set.containsKey("size"))){
set.put("size", pageLimit);
}
if(FilterData.class.isAssignableFrom(parameter.getParameterType()) && (!set.containsKey("size"))){
set.put("size", pageLimit);
}
String json = objectMapper.writeValueAsString(set);
return objectMapper.readValue(json, parameter.getParameterType());
}
}
\ No newline at end of file
......@@ -43,21 +43,42 @@
</update>
<select id="getData" parameterType="cn.ibizlab.core.data.dto.BaseData" resultType="cn.ibizlab.core.data.dto.BaseData">
select
<foreach collection="schema.baseColumnMap" item="value" index="key" separator=",">
${key}
</foreach>
from ${schema.name}
where
select t1.* from
<choose>
<when test="schema.defaultQueryScript!=null">
( ${schema.defaultQueryScript.body} ) t1 where
</when>
<otherwise>
${schema.name} t1 where
<if test="schema.logicValidColumn!=null">
${schema.logicValidCond} and
</if>
</otherwise>
</choose>
<foreach collection="schema.keyMap" item="value" index="key" separator="and">
${key}= #{data[${value}]}
</foreach>
</select>
<select id="checkData" parameterType="cn.ibizlab.core.data.dto.BaseData" resultType="cn.ibizlab.core.data.dto.BaseData">
<select id="selectData" parameterType="cn.ibizlab.core.data.dto.BaseData" resultType="cn.ibizlab.core.data.dto.BaseData">
select t1.* from
<choose>
<when test="schema.defaultQueryScript!=null">
( ${schema.defaultQueryScript.body} ) t1 where
</when>
<otherwise>
${schema.name} t1 where
<if test="schema.logicValidColumn!=null">
${schema.logicValidCond} and
</if>
</otherwise>
</choose>
<foreach collection="schema.resultMap" item="value" index="key" separator=",">
<if test="data.keys.contains(value)">${key}= #{data[${value}]}</if>
</foreach>
</select>
<select id="countData" parameterType="cn.ibizlab.core.data.dto.BaseData" resultType="java.lang.Integer">
select count(1) as cnt from ${schema.name}
where
<if test="schema.logicValidColumn!=null">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册