Bootstrap

Java中int转Double再转换成百分数并应用在求同比昨日增长率

场景

求数据库中某记录的同比昨日增长率。

使用MyBatisPlus的selectCount方法返回的是int类型。

最后需要再转换成百分数表示。

实现

//查询昨日物流数
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date createTimeDate = simpleDateFormat.parse(createTime);
        createTimeDate = yesterday(createTimeDate);
        String formateDate = simpleDateFormat.format(createTimeDate);
        QueryWrapper<BusLogisticsOrder> BusLogisticsOrderQueryWrapper1 =new QueryWrapper<BusLogisticsOrder>();
        BusLogisticsOrderQueryWrapper1.eq("deleted_flag","0");
        BusLogisticsOrderQueryWrapper1.apply("CONVERT(varchar(100), gmt_creat, 23)= '"+formateDate+"'");
       
;