Java小知识

1、biginteger比较大小用 compareTo

2、中断当前循环,循环下个数,continue,跳出循环 break

3、int转biginteger new BigInteger(String.valueOf(5));

4、查数据库,查出多条数据,resultMap="hashmap"的处理

  <select id="groupItemByDay" resultType="hashmap">
select sum(duration),item_id from timemanage where create_time like '${dayTime}%' and user_no='dabai' group by item_id order by item_id;
  </select>

这样接,就可以接到多个hashmap了(报错信息exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne())

List<Map<String, BigInteger>> groupItemByDay(@Param("dayTime") String dayTime);

5、Result Maps collection does not contain value for com.beauty.time.dao.TimeManageMapper.map

报这个错误,不要死盯着你那个mybatis的select语句,可能是他上边的select语句resultMap或者resultType有问题

6、单元测试service为null

测试类加上这个注释

import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
@RunWith(SpringRunner.class)
@SpringBootTest

还有 @test注释要用这个的哦 

import org.junit.Test;

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值