首页 > 编程语言 > 详细

JAVA 深拷贝 oralce in 1000处理

时间:2020-07-02 11:01:55      阅读:56      评论:0      收藏:0      [点我收藏+]
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());
        }
    }

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

JAVA 深拷贝 oralce in 1000处理

原文:https://www.cnblogs.com/wolbo/p/13223496.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!