程序员社区

【校园商铺SSM-28】解除商品与某商品类别的关联

1. ProductDao接口

 /**
     * 删除商品类别之前,将商品类别id置为空
     * @param productCategoryId
     * @return
     */
    int updateProductCategotyToNull(long productCategoryId);

2. ProductDao.xml实现类

 <update id="updateProductCategoryToNull" parameterType="Long">
     update tb_product 
     set product_category_id=null 
     where product_category_id=#{productCategoryId}
 </update>

3. ProductDaoTest测试类

    @Test
    public void testEUpdateProductCategoryToNull(){
        int effectedNum = productDao.updateProductCategoryToNull(9L);
        assertEquals(3,effectedNum);
    }

4

赞(0) 打赏
未经允许不得转载:IDEA激活码 » 【校园商铺SSM-28】解除商品与某商品类别的关联

相关推荐

  • 暂无文章

一个分享Java & Python知识的社区