public interface BaseService「T,ID extends Serializable」{}参数是什么意思

public interface BaseService<T,ID extends Serializable>{

//ID是泛型的参数,这个ID一定要是一个实现了Serializable的类型,所谓的Serializable,就是java提供的通用数据保存和读取的接口。至于从什么地方读出来和保存到哪里去都被隐藏在函数参数的背后了。这样,任何类型只要实现了Serializable接口,就可以被保存到文件中,或者作为数据流通过网络发送到别的地方。也可以用管道来传输到系统的其他程序中。这样子极大的简化了类的设计。只要设计一个保存一个读取功能就能解决上面说得所有问题。

java的包装类型 (Integer,Long,String,Double…)几乎都实现了这个接口。

}

转载:https://www.jianshu.com/p/b3eed73dfef4

vo类 public class ArealRainfallVo implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "区域编码") private String code; @ApiModelProperty(value = "雨量总和") private BigDecimal value; } Mapper类 public interface WeightBetweenObjectAndRainfallStationMapper extends BaseMapper<WeightBetweenObjectAndRainfallStation> { List<ArealRainfallVo> ListbySumList (List<PointRainfallSumVO> list); } mapper配置类 <mapper namespace="com.ndwp.jboot.bootstrap.mapper.WeightBetweenObjectAndRainfallStationMapper"> <select id="ListbySumList" resultType="com.ndwp.jboot.bootstrap.entity.vo.ArealRainfallVo"> SELECT code, SUM(CASE <foreach collection="list" item = "item"> WHEN rainfall_station_code = '${item.getCode()}' THEN weight * ${item.getValue()} </foreach> END ) AS value FROM bootstrap.weight_between_object_and_rainfall_station GROUP BY code; </select> </mapper> 服务类 public interface IWeightBetweenObjectAndRainfallStationService extends BaseService<WeightBetweenObjectAndRainfallStation> { List<ArealRainfallVo> listAreaRainfall(Date start, Date end); } 服务实现类 @Service public class WeightBetweenObjectAndRainfallStationServiceImpl extends BaseServiceImpl<WeightBetweenObjectAndRainfallStationMapper, WeightBetweenObjectAndRainfallStation> implements IWeightBetweenObjectAndRainfallStationService { @Autowired IDataHistoricRainfallService dataHistoricRainfallService; @Override public List<ArealRainfallVo> listAreaRainfall(Date start, Date end) { List<PointRainfallSumVO> pointRainfallSumVOS = dataHistoricRainfallService.listAllPointRainfallByTime(start, end); return baseMapper.ListbySumList(pointRainfallSumVOS); } } 控制台打印的sql语句能够正常运行,结合代码分析一下为何会返回四个空对象?
最新发布
07-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值