提交 4996ec51 编写于 作者: sq3536's avatar sq3536

mapper类

上级 28baf0dd
......@@ -192,8 +192,8 @@ public class BaseFilter<T> extends BaseData implements ISearchContextDTO {
SearchFieldCond searchFieldCond = new SearchFieldCond();
searchFieldCond.setFieldName(strFieldName);
searchFieldCond.setCondOp(strCondOp);
if(!Conditions.ISNULL.equals(strCondOp)
&& !Conditions.ISNOTNULL.equals(strCondOp)) {
if(Conditions.ISNULL.equals(strCondOp)
|| Conditions.ISNOTNULL.equals(strCondOp)) {
objValue="1";
}
searchFieldCond.setParamMode(true);
......
......@@ -22,6 +22,8 @@ public interface IMPService<T extends BaseData, F extends BaseFilter, M extends
return null;
}
Class<M> getMClass();
default List<T> list(QueryWrapper<T> queryWrapper) {
return this.getBaseMapper().selectList(queryWrapper);
}
......
......@@ -29,7 +29,7 @@ public abstract class BaseServiceImpl<T extends BaseData, F extends BaseFilter>
}
@PostConstruct
private void postConstruct() throws Exception {
protected void postConstruct() throws Exception {
Class serviceClass=this.getClass();
while (serviceClass!=null) {
if(!ObjectUtils.isEmpty(serviceClass.getInterfaces())) {
......
......@@ -3,9 +3,16 @@ package net.ibizsys.central.plugin.boot.core.service.impl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.ibizsys.central.plugin.boot.core.domain.BaseData;
import net.ibizsys.central.plugin.boot.core.filter.BaseFilter;
import net.ibizsys.central.plugin.boot.core.runtime.BootServiceImpl;
import net.ibizsys.central.plugin.boot.core.service.IBaseService;
import net.ibizsys.central.plugin.boot.core.service.IMPService;
import net.ibizsys.central.plugin.boot.core.service.IServiceApiService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
import java.lang.reflect.ParameterizedType;
public abstract class MPServiceImpl<T extends BaseData, F extends BaseFilter, M extends BaseMapper<T>> extends BaseServiceImpl<T,F> implements IMPService<T, F, M> {
......@@ -15,5 +22,32 @@ public abstract class MPServiceImpl<T extends BaseData, F extends BaseFilter, M
return this.baseMapper;
}
private Class<M> mClass;
public Class<M> getMClass() {
return mClass;
}
@PostConstruct
protected void postConstruct() throws Exception {
Class serviceClass=this.getClass();
while (serviceClass!=null) {
if(!ObjectUtils.isEmpty(serviceClass.getInterfaces())) {
Class interfaceClass=serviceClass.getInterfaces()[0];
if(!ObjectUtils.isEmpty(interfaceClass.getInterfaces())) {
if(interfaceClass.getInterfaces()[0].isAssignableFrom(IMPService.class)) {
serviceClass=interfaceClass;
break;
}
}
}
serviceClass = serviceClass.getSuperclass();
}
if(!ObjectUtils.isEmpty(serviceClass.getGenericInterfaces())) {
ParameterizedType ptype = (ParameterizedType) serviceClass.getGenericInterfaces()[0];
mClass = (Class) ptype.getActualTypeArguments()[2];
}
super.postConstruct();
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册