请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

Closing non transactional SqlSession

[17:25:31.185][DEBUG][org.mybatis.spring.SqlSessionUtils][http-nio-8088-exec-8] Creating a new SqlSession
[17:25:31.185][DEBUG][org.mybatis.spring.SqlSessionUtils][http-nio-8088-exec-8] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3fa855e0] was not registered for synchronization because synchronization is not active
[17:25:31.186][DEBUG][o.m.s.t.SpringManagedTransaction][http-nio-8088-exec-8] JDBC Connection [jdbc:mysql://localhost:3306/mmall?characterEncoding=utf-8, UserName=root@localhost, MySQL-AB JDBC Driver] will not be managed by Spring
[17:25:31.187][DEBUG][com.mmall.dao.CategoryMapper.insert][http-nio-8088-exec-8] ==>  Preparing: insert into mmall_category (id, parent_id, name, status, sort_order, create_time, update_time) values (?, ?, ?, ?, ?, now(), now()}) 
[17:25:31.187][DEBUG][com.mmall.dao.CategoryMapper.insert][http-nio-8088-exec-8] ==> Parameters: null, 0(Integer), 新产品2(String), true(Boolean), null
[17:25:31.188][DEBUG][org.mybatis.spring.SqlSessionUtils][http-nio-8088-exec-8] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3fa855e0]

一直500报错

 public ServerResponse addCategory(String categoryName,Integer parentId){
        if(parentId == null || StringUtils.isBlank(categoryName)){
            return ServerResponse.createByErrorMessage("添加品类参数错误");
        }

        Category category = new Category();
        category.setName(categoryName);
        category.setParentId(parentId);
        category.setStatus(true);//这个分类是可用的

        int rowCount = categoryMapper.insert(category);
        if(rowCount > 0){
            return ServerResponse.createBySuccess("添加品类成功");
        }
        return ServerResponse.createByErrorMessage("添加品类失败");
    }

但我把这里面的

正在回答 回答被采纳积分+3

插入代码

1回答

提问者 weixin_慕仰4417517 2019-07-15 17:44:43

解决了,mapper 多了个括号。。。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信