在Mybatis中使用注解@多个参数查询
来源:互联网 发布:linux 查看目录大小 编辑:程序博客网 时间:2024/05/22 02:04
@Results({
@Result(column = "course_id", property = "course_id"),
@Result(column = "homework_id", property = "homework_id"),
@Result(column = "organization_id", property = "organization_id"),
@Result(property = "course", column = "course_id", one = @One(select = "selectCourse")),
@Result(property = "viewTotalNum", column = "organization_id", one = @One(select = "SelectStudentCount")),
@Result(property = "attachments", javaType = List.class, column = "homework_id", many = @Many(select = "selectAttachments")),
@Result(property = "viewNum",column = "{homework_id = homework_id,organization_id = organization_id}",one = @One(select = "selectViewCounts")),
@Result(property = "feedbackNum",column = "{homework_id = homework_id,organization_id = organization_id}",one = @One(select = "selectFeedbackCounts"))
})
List<HomeworkExt> selectByClassId(@Param("classId") Long classId, @Param("start") int start, @Param("count") int count);
上面的 @Result(property = "feedbackNum",column = "{homework_id = homework_id,organization_id = organization_id}",one = @One(select = "selectFeedbackCounts"))
最后一行,通过传入两个参数查询:对应下面的Map键值对。
@Select("SELECT COUNT(DISTINCT f.user_id) FROM wc_homework_log_see ws INNER JOIN \n" +
"(SELECT wu.user_id, wf.`family_user_id` FROM wc_organization_user wu INNER JOIN wc_family wf ON wu.`user_id` = wf.`student_id` \n" +
"WHERE wu.`organization_id` = #{organization_id} AND wu.`role_id` = 4) f ON f.family_user_id = ws.`user_id` \n" +
"WHERE ws.`homework_id` = #{homework_id}")
int selectViewCounts(Map<String,Object> map);
- 在Mybatis中使用注解@多个参数查询
- Mybatis使用多个参数查询
- Mybatis中关于如何使用多个参数(类型不同)查询的问题
- mybatis--使用in的多个参数查询。
- MyBatis学习笔记-注解SQL多个参数查询异常处理
- myBatis在java中使用注解实现
- 在 Spring Boot @Configuration 注解类中使用 Mybatis 查询数据库启动报错
- mybatis 传递多个参数 --解决mybatis查询使用多个参数方法--javabean传统方法和map方法
- mybatis注解一对多如何传递多个参数
- MyBatis使用@MapKey注解接收多个查询记录到Map中,以便方便地用get()方法获取字段的值
- Mybatis多参数查询方法,多个参数类型相同
- Mybatis SQL映射语句中参数注解使用规则
- 在mybatis查询时使用map以及list参数
- mybatis使用map传入多个参数
- mybatis批量操作之传入类型为数组及多个参数,使用@Parm注解完美解决
- Mybatis 传入多个参数查询数据 (3种方法)
- MyBatis查询多个参数传入的问题
- mybatis笔记-多个参数查询报BindingException异常
- hdu4966 hdu4009 (最小树形图)
- An Easy Problem!
- java数据结构学习感悟之java中指针的使用
- English---There is / There are
- 图 - 最短路径
- 在Mybatis中使用注解@多个参数查询
- 安装hadoop之前的准备(配置linux)
- PHP缓存之模块缓存(APC)
- 图 - 拓扑排序
- Android Service绑定、生命周期、传递对象数据
- HBase Shell常用命令
- 快速排序
- Java中的throw和throws的区别
- CF 366E - Dima and Magic Guitar 最远曼哈顿距离