在Mybatis多条件查询中: 1.参数如果是多条件,则需要将将添加到Map集合中进行传入. 2.就是将其参数用有序数字进行代替. Mybatis单个String类型参数传递 mysql文如下,传入参数为‘parentCategoryId’,运行报错为:There is no getter for property named 'parentCategoryId' in 'class java.lang.String <select id="selectCategoryList"
今天在调试的过程中发现一个bug,把传入的参数写到查询分析器中执行没有问题,但是在程序中执行就报错:org.springframework.jdbc.UncategorizedSQLException : Error setting null parameter. Most JDBC drivers require that the JdbcType must be specified for all nullable parameters. Cause: Java.sql.SQLExcepti
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'source' in 'class java.lang.String' at org.mybatis.spring.MyBatisExceptionTranslator.translateExce
mysql并没有提供直接的方法来实现批量更新,但是可以用点小技巧来实现. 这里使用了case when 这个小技巧来实现批量更新. 举个例子: UPDATE 表名 SET display_order = CASE id WHEN 1 THEN 3 WHEN 2 THEN 4 WHEN 3 THEN 5 ENDWHERE id IN (1,2,3) 这句sql的意思是,更新display_order 字段: 如果id=1 则display