Burny.tech
首页
碎片笔记
系统笔记
首页
碎片笔记
系统笔记
  • Git

    • Git
  • sh

    • Docker安装MySQL
    • Harbor
    • Gogs迁移仓库至Gitlab
    • freeSSL 配置
    • yum源更改
    • 数据库监控
    • 定时任务-crontabs
    • httpd-tools
    • jps
    • 自启动 以及挂载磁盘
    • 限制某个用户使用命令
    • 初始化Unbuntu
    • Linux命令相关
  • Java

    • Java
  • SpringBoot

    • SpringBoot
  • SpringJPA

    • JPA
  • MongoDB

    • MongoDB
  • MySQL

    • MySQL
  • Oracle

    • Oracle
  • 软考

    • 软考
  • Node

    • Node

JDK8特性

Optional
 public void checkOutId(StockCus stockCus) {
        Optional.ofNullable(stockCus.getCusId()).ifPresent((b) -> {
            Optional<StockCus> byId = stockCusRepository.findById(b);
            Optional.ofNullable(byId).orElseThrow(() -> new BaseException("记录不存在"));
        });
        Optional.ofNullable(stockCus.getCusId()).ifPresent((b)->{
            Customer customer = customerService.get(b);
            Optional.ofNullable(customer).orElseThrow(()->new BaseException("记录不存在"));
        });

    }
List &lt; List &lt; Object&gt;&gt; 转List &lt; Object &gt;
            List<List<StockCus>> collect2 = stocks.stream().map(b -> b.getStockCusList()).collect(Collectors.toList());
            List<StockCus> collect3 = collect2.stream().flatMap(Collection::stream).collect(Collectors.toList());
归类
        Map<Long, List<Stock>> collect1 = all1.stream().collect(Collectors.groupingBy(b -> b.getBrandId()));
//相同报错
Map<Long, User> maps = userList.stream().collect(Collectors.toMap(User::getId,Function.identity()));
//相同不报错
        Map<Long, User> maps = userList.stream().collect(Collectors.toMap(User::getId, Function.identity(), (key1, key2) -> key2));

   
Map<Long, String> maps = userList.stream().collect(Collectors.toMap(User::getId, User::getAge, (key1, key2) -> key2));


统计
            Integer down = collect3.stream().filter(b -> b.getDownNum() != null).map(StockCus::getDownNum).reduce(Integer::sum).orElse(null);

Linux环境变量

 fdsafdsa 

The last packet sent successfully to the server was 0 milliseconds ago. The

     更改如下:
     url: jdbc:mysql://192.168.1.62/data_standard?useSSL=false&autoReconnect=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&autoReconnect=true&failOverReadOnly=false&maxReconnects=100