【六袆-Java】Mybatis根据字段批量查询;Mybatis根据List批量查询
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);
本文来自博客园,作者:你好,Alf,转载请注明原文链接:https://www.cnblogs.com/Alf-/p/16192852.html