这个问题我大概花了2个小时才找到结果 总共需要2个设置 这里是对应springboot中的配置写法 @select("select sum(a) a,sum(b) b from XXX where XXX; ") Map<String, Object> sumXXX(XXX); Map map = sumXXX(args); a b NULL NULL 期望结果 map : {a:null,b:null} 实际结果 map : null mybatis.configurat…
多字段值根据连接符拼接 concat_ws(':',aaa,bbb) 单字段值根据连接符拼接 string_agg(ccc,' \r\n ') 如果要将多个字段的值拼接成一个: string_agg(concat_ws(':',aaa,bbb),' \r\n ') as xxx 结果:…
Ethernet II即DIX 2.0:Xerox与DEC.Intel在1982年制定的以太网标准帧格式.Cisco名称为:ARPA Ethernet II类型以太网帧的最小长度为64字节(6+6+2+46+4),最大长度为1518字节(6+6+2+1500+4).其中前12字节分别标识出发送数据帧的源节点MAC地址和接收数据帧的目标节点MAC地址.(注:ISL封装后可达1548字节,802.1Q封装后可达1522字节) 接下来的2个字节标识出以太网帧所携带的上层数据类型,如下: IPv4: 0…
创建mybatis-config.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <s…
对于mybatis里查询结果为null的列不返回的问题解决方案 在配置文件application.properties里增加 Mybatis.configuration.call-setters-on-nulls: true…
此文章有问题,待修改! 使用Mybatis时,有时需要批量增删改查,这时就要向mapper方法中传入集合类型(List或Set)参数,下面是一个示例. // 该文件不完整,只展现关键部分 @Mapper public class UserMapper { List<User> selectByBatchIds(List<Long> ids); } <!-- 省略不重要代码,只保留与selectByBatchIds()方法对应的部分 --> <select id=&…
Tips 书中的源代码地址:https://github.com/jbloch/effective-java-3e-source-code 注意,书中的有些代码里方法是基于Java 9 API中的,所以JDK 最好下载 JDK 9以上的版本. 54. 返回空的数组或集合不要返回null 看到类似这样的方法并不罕见: // Returns null to indicate an empty collection. Don't do this! private final List<Cheese>…
需求:需要将枚举类型的字段例如enable(是否启用)转化为enable:1,enableName:是.这种形式返回给前台. 思路:在bean字段上加上枚举类型的注解,通过字段的值和枚举类反射获取枚举的key和value. 枚举注解: import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.…
话题一:undefined,null,"",0这四个值转换为逻辑值时就是false 也就是在if判断时会把上面的五个作为false来判断.但是它们的类型确是不尽相同的,如下所示. typeof(undefined) == 'undefined' typeof(null) == 'object' typeof("") == 'string' typeof(0) == 'number' typeof(false) == 'boolean' 下面是案例来说明,逻辑值为fa…
题目描述 输入一个链表,按链表值从尾到头的顺序返回一个ArrayList. 思路: 利用栈“先进后出”的性质,将链表的值存入到栈里,然后将栈里的值存入到构建好的容器里,最后打印容器. class Solution { public: vector<int> printListFromTailToHead(ListNode* head) { vector<int> result; stack<int> arr; ListNode* p = head; while(p!=N…