【六袆-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);

 

 

posted @ 2022-04-26 00:54  你好,Alf  阅读(366)  评论(0编辑  收藏  举报