日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Mapped Statements collection does not contain value for xxx问题解决方法

發布時間:2024/1/18 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mapped Statements collection does not contain value for xxx问题解决方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

今天在一次查詢中,發生了一個非法參數異常,提示

Mapped Statements collection does not contain value for cn.edu.sgu.www.mapper.CommentImageMapper.selectByCommentId

一般看到Mapped Statements collection does not contain value for xxx類似的提示就是找不到xxx對應的方法,檢查方法是否存在、包名是否正確,這里的問題就是包名不正確導致的。

package cn.edu.sgu.www.fresheveryday.mapper;import cn.edu.sgu.www.fresheveryday.pojo.entity.Comment; import cn.edu.sgu.www.fresheveryday.pojo.vo.CommentVO; import cn.edu.sgu.www.fresheveryday.pojo.vo.UserSimpleVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Many; import org.apache.ibatis.annotations.One; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository;import java.util.List;@Repository public interface CommentMapper extends BaseMapper<Comment> {/*** 通過商品id查詢評論* @param productId 商品id* @return List<CommentVO>*/@Select("select id, content, type, user_id, comment_id, created from comment where product_id = #{productId}")@Result(column = "id", property = "id")@Result(column = "comment_id", property = "commentId")@Result(column = "id", property = "images",many = @Many(select = "cn.edu.sgu.www.mapper.CommentImageMapper.selectByCommentId"))@Result(column = "user_id", property = "user", javaType = UserSimpleVO.class,one = @One(select = "cn.edu.sgu.www.fresheveryday.mapper.UserMapper.selectSimpleUserById"))List<CommentVO> selectByProductId(int productId); }

這里是因為少了一層fresheveryday包,修改之后的代碼能正常運行

package cn.edu.sgu.www.fresheveryday.mapper;import cn.edu.sgu.www.fresheveryday.pojo.entity.Comment; import cn.edu.sgu.www.fresheveryday.pojo.vo.CommentVO; import cn.edu.sgu.www.fresheveryday.pojo.vo.UserSimpleVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Many; import org.apache.ibatis.annotations.One; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository;import java.util.List;@Repository public interface CommentMapper extends BaseMapper<Comment> {/*** 通過商品id查詢評論* @param productId 商品id* @return List<CommentVO>*/@Select("select id, content, type, user_id, comment_id, created from comment where product_id = #{productId}")@Result(column = "id", property = "id")@Result(column = "comment_id", property = "commentId")@Result(column = "id", property = "images",many = @Many(select = "cn.edu.sgu.www.fresheveryday.mapper.CommentImageMapper.selectByCommentId"))@Result(column = "user_id", property = "user", javaType = UserSimpleVO.class,one = @One(select = "cn.edu.sgu.www.fresheveryday.mapper.UserMapper.selectSimpleUserById"))List<CommentVO> selectByProductId(int productId); }

好了,文章就分享到這里了,感謝閱讀~

總結

以上是生活随笔為你收集整理的Mapped Statements collection does not contain value for xxx问题解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。