求助
来源:4-11 店铺类别区域信息的获取

小豪同学
2019-08-28
老师,我做4-11的时候,提示我mapper未找到,可是我明明绑定了namespace了啊,还有Id.
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.imooc.o2o.dao.ShopCategoryDao.queryShopCategoryById
写回答
1回答
-
翔仔
2019-08-28
同学好,可以按照这个链接排查下
https://blog.csdn.net/sundacheng1989/article/details/81630370
主要就是这些原因。
如果还解决不了,也可以直接复制粘贴我的mapper,看看差别在哪里
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.imooc.o2o.dao.ShopCategoryDao"> <select id="queryShopCategory" resultType="com.imooc.o2o.entity.ShopCategory"> SELECT shop_category_id, shop_category_name, shop_category_desc, shop_category_img, priority, create_time, last_edit_time, parent_id FROM tb_shop_category <where> <if test="shopCategoryCondition == null"> and parent_id is null </if> <if test="shopCategoryCondition != null"> and parent_id is not null </if> <if test="shopCategoryCondition != null and shopCategoryCondition.parent != null and shopCategoryCondition.parent.shopCategoryId != null"> and parent_id = #{shopCategoryCondition.parent.shopCategoryId} </if> </where> ORDER BY priority DESC </select> <select id="queryShopCategoryById" resultType="com.imooc.o2o.entity.ShopCategory"> SELECT shop_category_id, shop_category_name, shop_category_desc, shop_category_img, priority, create_time, last_edit_time, parent_id FROM tb_shop_category WHERE shop_category_id=#{shopCategoryId} </select> <select id="queryShopCategoryByIds" resultType="com.imooc.o2o.entity.ShopCategory"> SELECT shop_category_id, shop_category_name, shop_category_desc, shop_category_img, priority, create_time, last_edit_time, parent_id FROM tb_shop_category WHERE shop_category_id IN <foreach collection="list" item="shopCategoryId" open="(" separator="," close=")"> #{shopCategoryId} </foreach> </select> <insert id="insertShopCategory" useGeneratedKeys="true" keyProperty="shopCategoryId" keyColumn="shop_category_id"> INSERT INTO tb_shop_category(shop_category_name,shop_category_desc,shop_category_img, priority,create_time,last_edit_time,parent_id) VALUES (#{shopCategoryName},#{shopCategoryDesc},#{shopCategoryImg}, #{priority},#{createTime},#{lastEditTime},#{parentId}) </insert> <update id="updateShopCategory" parameterType="com.imooc.o2o.entity.ShopCategory"> update tb_shop_category <set> <if test="shopCategoryName != null">shop_category_name=#{shopCategoryName},</if> <if test="shopCategoryDesc != null">shop_category_desc=#{shopCategoryDesc},</if> <if test="shopCategoryImg != null">shop_category_img=#{shopCategoryImg},</if> <if test="priority != null">priority=#{priority},</if> <if test="lastEditTime != null">last_edit_time=#{lastEditTime},</if> <if test="parentId != null">parent_id=#{parentId}</if> </set> where shop_category_id=#{shopCategoryId} </update> <delete id="deleteShopCategory"> DELETE FROM tb_shop_category WHERE shop_category_id = #{shopCategoryId} </delete> <delete id="batchDeleteShopCategory" parameterType="long"> DELETE FROM tb_shop_category WHERE shop_category_id IN <foreach collection="list" item="shopCategoryId" open="(" separator="," close=")"> #{shopCategoryId} </foreach> </delete> </mapper>
00
相似问题