【六袆-Java】Mybatis根据字段批量查询;Mybatis根据List批量查询
发布日期:2021-05-07 00:44:26 浏览次数:27 分类:精选文章

本文共 504 字,大约阅读时间需要 1 分钟。

                                                                                         

 敲代码不疲劳~
 敲代码不疲劳~

 

1.Controller层 

@ApiOperation("查询品种")    @GetMapping("/findCropById")    public ResponseResult findCropById(Integer  cropId){        List
> list = taskService.findByCropId(cropId); return new ResponseResult(list); }

 

2.Service层

public  List
> findByCropId(Integer cropId) { return taskMapper.findByCropId(cropId); }

 

3.XML映射

 

@Select("select * from crop_varieties where crop_id=#{cropId}")    List
> findByCropId(@Param("cropId")Integer cropId);

 

 

上一篇:【六袆-Java】Java后端处理并配置跨域问题-N中方法之一
下一篇:【六袆-Java】@Param属性的用法

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2025年04月18日 08时34分46秒