我不是忘尘 2020-02-25 20:13 采纳率: 0%
浏览 278

有没有大佬能帮我把注解形式的Mybatis代码换成XML形式的?

public interface PostMapper {
    @Select("select * from tb_posts where board_id = #{bid} order by pid desc limit #{startPos},#{pageSize}")
    /* post和user的组合查询 */
    @Results({ @Result(column = "user_id", property = "user", one = @One(select = "com.ve.mapper.AccountMapper.selectbyuid")) })
    public List<PostModel> postlist(@Param("bid") int bid,
            @Param("startPos") int startPos, @Param("pageSize") int pageSize);

    @Insert("insert into tb_posts (user_id,board_id,posttitle,posttype) values(#{user_id},#{board_id},#{posttitle},#{posttype})")
    public int newpost(PostModel pmodel);

    @Select("select @@identity")
    // 查询最新生成记录的id
    public int returnid();

    @Select("SELECT COUNT(*) FROM tb_posts where board_id = #{bid}")
    public int getpostCount(int bid);/* 某板块帖子总数 */

    @Select("select * from tb_posts where posttitle like #{search}")
    @Results({ @Result(column = "user_id", property = "user", one = @One(select = "com.ve.mapper.AccountMapper.selectbyuid")) })
    public List<PostModel> searchpost(String search);/* 帖子标题的模糊查询 */
}

  • 写回答

1条回答 默认 最新

  • 笑看烟雨红尘 2020-02-25 22:28
    关注

    把注解里的SQL语句写到XML中就可以了吧

    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效