使用Mybatis注解查询时,映射数据库字段

使用Results注解

@Select(value = "SELECT * FROM category WHERE cat_id = #{catId}")
    @Results({
            @Result(id=true, column = "cat_id", property = "catId"),
            @Result(column = "cat_name", property = "catName"),
            @Result(column = "cat_sort", property = "catSort"),
            @Result(column = "is_enable", property = "isEnable")
    })
    Category selectById(Integer catId);
发布了33 篇原创文章 · 获赞 0 · 访问量 367

猜你喜欢

转载自blog.csdn.net/weixin_43596905/article/details/104868207