代码如下
//查询 @ApiOperation(value="船东发布展示信息列表", notes="船东发布展示信息列表的接口") @RequestMapping(value = "/findContent" , method = RequestMethod.POST) @ApiImplicitParams({ @ApiImplicitParam(name="startDate", value="开始时间", required=false), @ApiImplicitParam(name="endDate", value="结束时间", required=false), @ApiImplicitParam(name="startLoading", value="最小吨数", required=false), @ApiImplicitParam(name="endLoading", value="最大吨数", required=false), @ApiImplicitParam(name="typeShip", value="船舶类型", required=false), @ApiImplicitParam(name="emptyPort", value="港口", required=false) }) public SysResult find(Date startDate,Date endDate , String startLoading , String endLoading, Long typeShip , Long emptyPort){ try{ EntityWrapper<ShipRelease> wrapper = new EntityWrapper<>(); //只能状态为发布中的数据展示出来 wrapper.where( "state = {0} ", 4 ); //筛选时间日期 if(startDate != null && endDate != null) { wrapper.where( "empty_date >= {0} ", startDate ); wrapper.and( " empty_date <= {0}", endDate ); } //筛选两数值之剑 if(startLoading != null && endLoading != null) { wrapper.where( "tonnage_loading >= {0} ", startLoading ); wrapper.and( " tonnage_loading <= {0}", endLoading ); }
这段代码我写在Controller上是可以运行的,但是我想写到Service上,现在问题是我写到Service上的话会报空指针异常,请问要如何解决这个问题呢
使用框架是spring-boot+mybatisPlus
沧海一幻觉
拉丁的传说
冉冉说
互换的青春
相关分类