zoukankan      html  css  js  c++  java
  • JAVA 深拷贝 oralce in 1000处理

    public static String GetInClause(String field, List<String> valueList){
            if(valueList.size()==0){
                return " ";
            }
    
            Supplier<Stream<String>> idList = ()->valueList.stream().map((x) ->
            {
    //            if (x.matches("[^a-zA-Z0-9-]")) //sql注入检查
    //            {
    //
    //            }
                return String.format("'%1$s'", x);
            });
            var ret=" ";
            int pageSize = 900;
            int pageNum = 0;
            while (pageNum * pageSize < valueList.size())
            {
                List<String> list = idList.get().skip(pageSize*pageNum).limit(pageSize).collect(Collectors.toList());
                ret+= " or "+field+" in (" + String.join(",", list) + ") ";
                pageNum++;
            }
            return ret;
    
        }
        public static Object DeepCopy(Object src){
            try{
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                ObjectOutputStream out = new ObjectOutputStream(bos);
                out.writeObject(src);
                out.flush();
                out.close();
    
                ByteArrayInputStream bis = new  ByteArrayInputStream(bos.toByteArray());
                ObjectInputStream in = new ObjectInputStream(bis);
                Object toBean = in.readObject();
                in.close();
                return toBean;
    
            }catch (Exception e){
                throw new  FITVException("FI_TV_PUB_9999", e.getMessage());
            }
        }

    除使用字节流外,还可以使用序列化

  • 相关阅读:
    context:component-scan报错
    goland 实用键
    React-Native 指定模拟器RUN-IOS
    mac 卸载编辑器卸不干净
    go 区分指针
    go 学习Printf
    我的命令行
    mysql8的坑
    小三角
    eslint 禁用命令
  • 原文地址:https://www.cnblogs.com/wolbo/p/13223496.html
Copyright © 2011-2022 走看看