牛刀小试.开胃菜·代码思路·9-2
大约 1 分钟
牛刀小试.开胃菜·代码思路·9-2
9-2-公海池-创建时间搜索 -没有效果
思路:
- 确定前端页面位置
- F12查看对应的后端接口位置,定位对应的异常信息打印的原因
- 解决BUG
1.1. 现象

1.2 解决思路
提示
- 定位接口
- 查看接口代码
- 确定bug所在位置
- 修改bug
1.2.1 定位接口

接口名是:/business/pool
请求方式是:GET
1.2.2 查看接口代码

1.2.3 确定bug所在位置
bug定位:
1)没有将开始时间结束时间传递到业务层

2)在执行查询的sql处,没有根据创建时间进行搜索

1.2.4 修改bug
提示:可以看看其他模块有没有类似的功能
1)接收前端请求的开始时间结束时间

@PreAuthorize("@ss.hasPermi('business:business:pool')")
@GetMapping("/pool")
public TableDataInfo pool(TbBusiness tbBusiness,HttpServletRequest req){
startPage();
if((!StringUtils.isEmpty(req.getParameter("params[beginCreateTime]")))&&
(!StringUtils.isEmpty(req.getParameter("params[endCreateTime]")))) {
tbBusiness.setBeginCreateTime(req.getParameter("params[beginCreateTime]"));
tbBusiness.setEndCreateTime(req.getParameter("params[endCreateTime]"));
}
List<TbBusiness> list = tbBusinessService.selectTbBusinessPool(tbBusiness);
return getDataTable(list);
}
2)查询时添加查询条件

<if test="beginCreateTime != null"> and create_time BETWEEN #{beginCreateTime} AND #{endCreateTime}</if>
修改完成以后执行
