当前位置: 首页 > news >正文

青岛网站建设咨询广东黄页企业名录

青岛网站建设咨询,广东黄页企业名录,海外网app下载,四川石油天然气建设工程有限责任公司网站文章目录 前言一、lambda1. 排序1.1 按照对象属性排序#xff1a;1.2 字符串List排序#xff1a;1.3 数据库排序jpa 2. 聚合2.1 基本聚合#xff08;返回对象list#xff09;2.2 多字段组合聚合#xff08;直接返回对象list数量#xff09; 二、基础语法2.1 List2.1.1 数… 文章目录 前言一、lambda1. 排序1.1 按照对象属性排序1.2 字符串List排序1.3 数据库排序jpa 2. 聚合2.1 基本聚合返回对象list2.2 多字段组合聚合直接返回对象list数量 二、基础语法2.1 List2.1.1 数组初始化赋值2.1.2. 逗号分割字符串、list互转2.1.3 去重 2.2. Json解析2.2.1 Gson2.2.2 Fastjson 2.3. LocalDateTime2.3.1 String-LocalDateTime2.3.2 Date-LocalDateTime 2.4. Optional2.4.1 map/flatMap2.4.2 ifPresent2.4.3 filter 2.5. EsayExcel2.5.1 导出示例2.5.2 相关注解 三、 Linux命令3.1 磁盘爆满占用情况3.2 nacos单机启动命令3.3 防火墙状态查询及操作3.4 清理缓存buff/cache 前言 常用语法汇总 一、lambda 1. 排序 1.1 按照对象属性排序 ListAccidentEduSLResp respList list.stream().sorted(Comparator.comparing(AccidentEduSLResp::getOrgUnit)).collect(Collectors.toList()); district.sort(Comparator.comparing(AccidentEduSLResp::getOrgUnit)); //性能优1.2 字符串List排序 ListString sortedDistrict district.stream().sorted().collect(Collectors.toList());1.3 数据库排序jpa dao.findAll(spec, Sort.by(Sort.Order.desc(ExpertConstants.UPDATE_TIME), Sort.Order.asc(ExpertConstants.EXAMINE_STATUS)));2. 聚合 2.1 基本聚合返回对象list MapString, ListAccidentSupervisePO collect cityList.stream().collect(Collectors.groupingBy(s - s.getDistrictCode()));2.2 多字段组合聚合直接返回对象list数量 MapString, Long collect list.stream().collect(Collectors.groupingBy(o - o.getDistrictCode() _ o.getOrgUnit(), Collectors.counting()));二、基础语法 2.1 List 2.1.1 数组初始化赋值 Arrays.asList 不允许add remove操作 UnsupportedOperationException public static final List CITY_ARR Arrays.asList(230100,230200,230300,230400,230500,230600);需要add等操作需要以下写法支持 ListString list new ArrayList(Arrays.asList(arr));2.1.2. 逗号分割字符串、list互转 List 转字符串 Joiner.on(,).join(list)字符串转List: //- 引入guava-28.2-jre.jar//- CommonConstants常量类定义 public static final Splitter SPLITTER_COMMA Splitter.on(,).omitEmptyStrings().trimResults(); //需要判断字符串是否为空 ListString list CommonConstants.SPLITTER_COMMA.splitToList(a.getDistrictCode());2.1.3 去重 用hashset去重list 性能优 ListString testListDistinctResult new ArrayList(new HashSet(testList));2.2. Json解析 2.2.1 Gson Book b new Book(书名1,简介1); //使用gson将对象转为json字符串 String json new Gson().toJson(b); System.out.println(json);//使用gson将json字符转转为对象(第一个参数为json字符串第二个参数为要转为的类) Book b2 new Gson().fromJson({\\name\\:\\书名1\\,\\info\\:\\简介1\\},Book.class);2.2.2 Fastjson Book b new Book(书名2,简介2); //使用fastjson将对象转为json字符串 String json JSON.toJSONString(b); System.out.println(json);//使用fastjson将json字符转转为对象(第一个参数为json字符串第二个参数为要转为的类) Book b2 JSON.parseObject({\\name\\:\\书名1\\,\\info\\:\\简介1\\}, Book.class);2.3. LocalDateTime 2.3.1 String-LocalDateTime //1.具有转换功能的对象 DateTimeFormatter df DateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss); //2.要转换的对象 LocalDateTime time LocalDateTime.now();//3.发动功能 String localTime df.format(time); System.out.println(LocalDateTime转成String类型的时间localTime);//3.LocalDate发动将字符串转换成 df格式的LocalDateTime对象的功能 LocalDateTime LocalTime LocalDateTime.parse(strLocalTime,df) System.out.println(String类型的时间转成LocalDateTimeLocalTime);2.3.2 Date-LocalDateTime //Date转LocalDateTime Date date new Date(); Instant instant date.toInstant(); ZoneId zoneId ZoneId.systemDefault(); LocalDateTime localDateTime instant.atZone(zoneId).toLocalDateTime(); System.out.println(Date date); System.out.println(LocalDateTime localDateTime);//LocalDateTime转Date ZoneId zoneId ZoneId.systemDefault(); LocalDateTime localDateTime LocalDateTime.now(); ZonedDateTime zdt localDateTime.atZone(zoneId); Date date Date.from(zdt.toInstant()); System.out.println(LocalDateTime localDateTime); System.out.println(Date date);2.4. Optional 2.4.1 map/flatMap ● map适用于基础数据类型 ● flatMap适用于对象类型 user不为空的时候取address address为空取city city为空异常 Optional.ofNullable(user).map(u- u.getAddress()).map(a-a.getCity()).orElseThrow(()-new Exception(错误));2.4.2 ifPresent user不为空时dosomething Optional.ofNullable(user) .ifPresent(u-{dosomething(u); });2.4.3 filter 如果user的name的是zhangsan的则返回当前对象。否则返回构造的user对象。 Optional.ofNullable(user) .filter(u-zhangsan.equals(u.getName())) .orElseGet(()- {User user1 new User();user1.setName(zhangsan);return user1; });2.5. EsayExcel 2.5.1 导出示例 response.setContentType(application/octet-stream); response.setCharacterEncoding(utf-8); // 这里URLEncoder.encode可以防止中文乱码 当然和easyExcel没有关系 String fileName URLEncoder.encode(专家报销汇总 DateUtil.localDateToString(LocalDate.now()), UTF-8); response.setHeader(Content-Disposition, attachment; filename fileName .xlsx); // 前端需要FileName头否则会会有问题 response.setHeader(FileName, fileName .xlsx); response.setHeader(Access-Control-Expose-Headers, FileName); WriteCellStyle contentWriteCellStyle new WriteCellStyle(); contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); WriteCellStyle headWriteCellStyle new WriteCellStyle(); HorizontalCellStyleStrategy horizontalCellStyleStrategy new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); EasyExcel//将数据映射到DownloadDTO实体类并响应到浏览器 .write(response.getOutputStream(), ExpertAndCostInfoOutDTO.class) //07的excel版本,节省内存 .excelType(ExcelTypeEnum.XLSX) //是否自动关闭输入流 .autoCloseStream(Boolean.TRUE) .registerWriteHandler(horizontalCellStyleStrategy) .sheet(专家报销汇总).doWrite(findExpertAndCostGatherList(dto).getExpertList());2.5.2 相关注解 //不映射excel ExcelIgnore //列宽 class上控制全部字段 属性上控制该属性字段 ColumnWidth(40) //2.1.4 表头名称及排序 //ExcelProperty(order 2) 2.2.7 排序写法 index被兼容 ExcelProperty(value 任务内容, index 1)三、 Linux命令 3.1 磁盘爆满占用情况 df -h du -h --max-depth13.2 nacos单机启动命令 sh startup.sh -m standalone3.3 防火墙状态查询及操作 systemctl stop firewalld systemctl status firewalld systemctl disable firewalld3.4 清理缓存buff/cache 清除前后使用 free -h 查看效果 free -h sysctl -w vm.drop_caches3 free -h
http://www.pierceye.com/news/634980/

相关文章:

  • 谁可以做网站开发公司空置房拨款合同
  • seo网站管理网站建设信(信科网络)
  • 做网站需要哪些东西网站设计报价单模板
  • 合肥家居网站建设怎么样网站建设与维护中
  • 淘宝app网站建设做网页设计可以参考哪些网站
  • 合作建设网站协议江门seo计费管理
  • 企业管理网站模板保定网站制作设计哪个公司好
  • 物流网站查询优秀设计赏析网站
  • 设计分享网站网站建设资料需要公司提交的吗
  • 广州网站站建设培训html用户登录注册页面代码
  • 网站建设怎么购买域名怎么屏蔽2345网址导航
  • 物流网站建设推广wordpress安全配置文件
  • 做网站用哪个服务器不用备案宣传网站设计
  • 网站建设哪种语言好电子商务型网站建设
  • 广州网站建设平台网站怎么做必须交钱吗
  • 做网站费免图片网站背景图网站
  • 上海电商网站开发公司门户网站建设 总结
  • 网站产品类别顺序如果修改wordpress多城市seo
  • 做网站托管的好处公司erp系统
  • 管局备案网站高端定制网站的特点
  • 成都极客联盟网站建设公司有没有帮别人做网站
  • 宝安专业网站设计公司公众号小程序怎么做
  • 郑州网站优化公司爱范儿 wordpress 主题
  • 电商网站建设书宣传片拍摄技巧
  • 珠海的门户网站有哪些app开发是什么专业
  • 网站建设推广报价简单网页素材
  • 建设企业官方网站的流程37玩手游官网平台
  • 南通网站建设方案开发网站建设运营公众号运营合同
  • 制作网站语言seo推广软件怎样
  • 企业网站建设的三种方式wordpress 导航高亮