注解开发中的@Results注解使用

限于喜欢 提交于 2019-12-04 18:20:13
package com.hope.dao;import com.hope.domain.User;import com.sun.xml.internal.bind.v2.model.core.ID;import org.apache.ibatis.annotations.*;import java.util.List;/** * @author newcityman * @date 2019/11/15 - 22:59 */public interface IUserDao {    /**     * 查询所有用户的信息     * @return     */    @Select(value = "select * from user")    @Results(id = "userMap",value = {            @Result(id = true,column ="id" ,property ="userId" ),            @Result(column = "username" ,property = "userName"),            @Result(column = "sex",property = "userSex"),            @Result(column = "address",property = "userAddress"),            @Result(column = "birthday",property = "userBirthday")    })    public List<User> findAll();    /**     * 根据用户的id,查询用户     * @param id     * @return     */    @Select("select * from user where id=#{id}")    @ResultMap(value ={"userMap"} )    User findOne(Integer id);    /**     * 根据用户名模糊查询     * @param username     * @return     */    @Select("select * from user where username like #{username}")    @ResultMap("userMap")    List<User> findByName(String username);}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!