mybatis中if-else
发表于|更新于
|浏览量:
mybatis中if-else要用choose-when-otherwise
1 | <choose> |
相关推荐
2023-09-02
TreeMap踩坑
不降志,不屈身,不追赶时髦,也不回避危险。──胡适 今天使用TreeMap踩坑了 代码如下: 12345678 @Testvoid test() { Map<Integer, Object> map = new TreeMap<>(Comparator.comparing(i -> i % 2 == 0)); map.put(2, 0); map.put(1, 0); map.put(3, 0); System.out.println(map);} 输出结果却是 1{1=0, 2=0} 这是因为Comparator里计算结果重复导致的,即便我们的key并不相同,也会被覆盖。。。 于是我们可以指定计算结果相同时策略: 123456789@Testvoid test() { Map<Integer, Object> map = new TreeMap<>(Comparator.<Integer, Boolean>comp...
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...
2021-03-02
引入本地jar包
不管努力的目标是什么,不管他干什么,他单枪匹马总是没有力量的。合群永远是一切善良的人的最高需要。——歌德 对于本地jar包,如何让它加入我们的项目并使用maven的GAV管理起来呢 其实很简单 需要在当前项目根路径(在pom.xml的那层)使用 1mvn install:install-file -Dfile=[本地jar包路径] -DgroupId=[自定义groupId] -DartifactId=[自定义artifactId] -Dversion=[自定义version] -Dpackaging=jar 例如 1mvn install:install-file -Dfile=D:\file\files\Onest-S3-java-SDK.jar -DgroupId=com.move -DartifactId=moveOss -Dversion=1.0 -Dpackaging=jar 再使用我们定义的GAV引入,这样就可以使用我们本地jar了 123456<!-- 移动云对象存储 --><dependency> <gr...
2021-08-10
mybatis-plus随机查询工具类(二)
当真理还正在穿鞋的时候,谎言就能走遍半个世界。——马克吐温 之前写过一个,最近感觉不好用 然后写了一个更优雅的 12345678910111213141516171819/** * 随机查询 * * @param mapper 持久层DAO * @param limit 随机条数 * @return java.util.List<T> * @author <achao1441470436@gmail.com> * @since 2021/8/10 15:30 */public static <T> List<T> getAny(BaseMapper<T> mapper, T condition, Integer limit) { LambdaQueryWrapper<T> wrapper = Wrappers.lambdaQuery(condition); Integer total = mapper.selectCount(wrapper); if (limit == nu...
2022-07-06
eclipse-collections
志向和热爱是伟大行为的双翼。——歌德 之前分享了vavr,今天在分享一个同类框架eclipse-collections 官方文档:http://www.eclipse.org/collections/ 1234567891011<dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections-api</artifactId> <version>11.0.0</version></dependency><dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections</artifactId> <version>11.0.0</version></dependency&...
2021-02-11
重复注解
英雄非无泪,不洒敌人前。男儿七尺躯,愿为祖国捐。——陈辉 在java中如果我们需要一个注解能被重复使用 例如这个 123456789101112131415161718192021222324package com.ruben.annotation;import java.lang.annotation.*;/** * @ClassName: BeanFieldSort * @Description: * @Date: 2020/9/11 22:18 * * * @author: achao<achao1441470436 @ gmail.com> * @version: 1.0 * @since: JDK 1.8 */@Target(ElementType.FIELD)@Retention(RetentionPolicy.RUNTIME)public @interface BeanFieldSort { /** * 序号 * * @return */ int order();} 如果我们直接重复注...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog