【六袆-Java】Mybatis根据字段批量查询;Mybatis根据List批量查询
原创
©著作权归作者所有:来自51CTO博客作者wx5cd3964945843的原创作品,请联系作者获取转载授权,否则将追究法律责任

敲代码不疲劳~
1.Controller层
@ApiOperation("查询品种")
@GetMapping("/findCropById")
public ResponseResult findCropById(Integer cropId){
List<Map<String,Object>> list = taskService.findByCropId(cropId);
return new ResponseResult(list);
}
2.Service层
public List<Map<String, Object>> findByCropId(Integer cropId) {
return taskMapper.findByCropId(cropId);
}
3.XML映射
@Select("select * from crop_varieties where crop_id=#{cropId}")
List<Map<String, Object>> findByCropId(@Param("cropId")Integer cropId);