接口类UserInfoMapper中方法传对象/参数

@Mapper
public interface UserInfoMapper {
    @Insert("INSERT INTO APP_USER (USER_ID,USER_NAME,PASSWORD) values(#{userId},#{userName},#{password})")
    int insertUserInfo(UserInfo userInfo);

    @Insert("INSERT INTO APP_USER (USER_ID,USER_NAME,PASSWORD) values(#{userId},#{userName},#{password})")
    int insertUserInfo(@Param("userId") String userId, @Param("userName") String userName, @Param("password") String password);

}

在java类中使用

    ........
    //方法一:
    UserInfo info = new UserInfo();
    info.setUserName(userId);
    info.setUserId(Integer.toString(nmUser.getZdStaffId()));
    info.setPassword(encoder.encode("567890"));
    userInfoMapper.insertUserInfo(info);

    //方法二:
    userInfoMapper.insertUserInfo(userId, userName, password);

你可能感兴趣的:(接口类UserInfoMapper中方法传对象/参数)