springmvc-mybatis-learning
springmvc-mybatis-learning copied to clipboard
可以写个注解方式的mybatis学习笔记
:)
注解方式?能具体点吗?
这个列子展示了多参数使用@SqlProvider:
@SelectProvider(type = UserSqlBuilder.class, method = "buildGetUsersByName") List<User> getUsersByName( @Param("name") String name, @Param("orderByColumn") String orderByColumn);
class UserSqlBuilder {
// If not use @Param, you should be define same arguments with mapper method public String buildGetUsersByName( final String name, final String orderByColumn) { return new SQL(){{ SELECT("*"); FROM("users"); WHERE("name like #{name} || '%'"); ORDER_BY(orderByColumn); }}.toString(); }
// If use @Param, you can define only arguments to be used public String buildGetUsersByName(@Param("orderByColumn") final String orderByColumn) { return new SQL(){{ SELECT("*"); FROM("users"); WHERE("name like #{name} || '%'"); ORDER_BY(orderByColumn); }}.toString(); } }
http://www.mybatis.org/mybatis-3/zh/java-api.html 官方说明算是一笔带过,比较粗糙
懂了,我也不知道企业现在主要是用 xml 还是注解,如果注解是趋势的话,我有空写一写。如果 xml 是趋势,那就不写了。我暑假看看
老哥,你这不是原创啊
是啊,我点赞的
学习笔记性质的文章,大家看的都是一个教程,写不出花来啊,大兄弟。
学习笔记性质的文章,大家看的都是一个教程,写不出花来啊,大兄弟。
相较之下,小白两者都喜欢。教程式的用来敲借鉴。笔记式的用来理思绪。
您好!我已经收到您的邮件喽,我会尽快查看的~
已经没做开发了!开发的知识都不会了~
------------------ 原始邮件 ------------------ 发件人: "brianway/springmvc-mybatis-learning" @.>; 发送时间: 2022年3月16日(星期三) 凌晨1:29 @.>; @.***>; 主题: Re: [brianway/springmvc-mybatis-learning] 可以写个注解方式的mybatis学习笔记 (#3)
学习笔记性质的文章,大家看的都是一个教程,写不出花来啊,大兄弟。
相较之下,小白两者都喜欢。教程式的用来敲借鉴。笔记式的用来理思绪。
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.***>