boolean自然排序顺序
发表于|更新于
|浏览量:
聪明人警告我说,生命只是荷叶上的一颗露珠。——泰戈尔
代码如下:
1 | import java.util.ArrayList; |
输出如下:
1 | [false, true] |
因此java中自然排序,false是小于true的
这里可以用一般orm的boolean转换为int来方便记忆
false为0
true为1
因此false小于true
相关推荐
2021-07-05
在js中获取thymeleaf变量(二)
所谓天才,只不过是把别人喝咖啡的功夫都用在工作上了。——鲁迅 上回写过在js中获取thymeleaf变量 但比较繁琐 这次用简单的写法 1234<script> var id = [[${id}]] console.log(id)</script> 非常简单~ 不过要注意一点,如果是对象格式的数据,需要在script标签上加th:inline="javascript" 1234<script th:inline="javascript"> var id = [[${id}]] console.log(id)</script> 在页面中也可以直接使用,可以代替th:text 123<div> [[${id}]]</div> 效果如下 如果是字符串也支持的 1234<div> [[${id}]] [['id']...
2022-02-13
新增SqlHelper.execute
茅草屋顶下住着自由人,大理石和黄金下栖息着奴隶。——塞涅卡 昨晚提交了个PR到Mybatis-Plus,目前还没有处理 不过这个函数确实让开发便利了不少 链接:https://gitee.com/baomidou/mybatis-plus/pulls/215/files 使用方式很简单: 例如查询Entity表内所有数据: 1List<Entity> entityList = SqlHelper.execute(Entity.class, m -> m.selectList(Wrappers.lambdaQuery())); 在第二个参数中你可以传入lambda,直接用Entity的BaseMapper进行CRUD操作 这个方法自动对SqlSession进行了回收,还是蛮好用的 我顺便把原来的SimpleQuery.selectList也进行了调整 改为了 1234567891011/** * 通过entityClass查询列表,并关闭sqlSession * * @param entityClass 表对应实体 * @param wrapper ...
2021-01-04
html转word或pdf
差以毫厘,谬以千里。——班固《汉书》 使用的组件还是Spire.Doc,可以看我这篇博客 如果我们遇到html,需要直接渲染到word或者pdf上,可以使用官方文档给的例子 123456789101112131415161718192021222324252627282930import com.spire.doc.*;import java.io.*;public class htmlStringToWord { public static void main(String[] args) throws Exception { String inputHtml = "InputHtml.txt"; //新建Document对象 Document document = new Document(); //添加section Section sec = document.addSection(); String htmlText = readText...
2024-06-02
Spring的LambdaSafe
对未来来说孩子的教育比成人更为重要。——贝多芬 今天看了下Spring的LambdaSafe类,它提供了一种安全的方式调用Lambda,例如不使用LambdaSafe时的问题 12345678910111213141516171819202122232425262728293031323334353637383940package org.dromara.streamquery.stream.plugin.mybatisplus;import org.junit.jupiter.api.Test;import java.util.ArrayList;import java.util.List;import java.util.function.Consumer;import static org.junit.jupiter.api.Assertions.assertEquals;/** * Tests * <p> * author achao@apache.org */class TestsWithoutLambdaSafe { @Test ...
2024-10-11
Apache-ShenYu让h2数据库持久化到文件中
你要记住,在敢于担当培养一个人的任务之前,自己就必须要造成一个人,自己就必须是一个值得推崇的模范。——卢俊 今天发现使用 调试h2数据库 中的方式连接h2数据库却不行,由于目录里没有创建,所以我们得先创建: 123456spring: datasource: url: jdbc:h2:file:~/Downloads/shenyu-study/shenyu;DB_CLOSE_DELAY=-1;MODE=MySQL;SCHEMA=PUBLIC; username: sa password: sa driver-class-name: org.h2.Driver 然后再启动后 123456789101112131415161718192021222324252627282930313233343536373839404142434445/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See...
2022-10-22
maven腾讯云镜像
人们在年轻的时候,谁也不知道自己年轻——切斯特顿 因为阿里云镜像维护,导致暂停同步镜像了 所以更换为腾讯云镜像: https://mirrors.cloud.tencent.com/help/maven.html 设置方法打开maven的设置文件settings.xml,配置如下repository mirror: 123456<mirror> <id>nexus-tencentyun</id> <mirrorOf>*</mirrorOf> <name>Nexus tencentyun</name> <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url></mirror>
