综合查询工具类
java
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.R;
import org.springframework.data.redis.core.convert.RedisData;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
public class CommonQuery {
/**
* 通过参数对象查询列表
*
* @param id
* @param type
* @param dbFallback
* @param <R> 返回结果范型
* @param <ID> 查询参数范型
* @return
*/
public static <R, ID> List<R> queryWithPassThroughList(ID id, Class<R> type, Function<ID, List<R>> dbFallback) {
List<R> r = dbFallback.apply(id);
return r;
}
}
具体用法
java
//切换具体的实体对象
ArcContractView query = new ArcContractView();
query.setBillId(billId);
query.setDeptId(deptId);
List<ArcContractView> contractViewList = CommonQuery.queryWithPassThroughList(query, ArcContractView.class, arcContractViewMapper::selectArcContractViewList);