SpringBoot Mybatis踩坑日記

2022-06-25 12:12:09 字數 816 閱讀 1339

問題描述:手動寫了一段sql如下,控制台報錯,找不到原因

mybatisquerybrandbypage

" resulttype="

brand

">select id,name,image,letter from tb_brand

key!=null and key!=''

">name like concat("%

",#,"

%") or letter =#

if>

sortby!=null and sortby!=''

">order by $

if>

"desc==true

"> desc

asc where>

select>

問題原因:

key為空時會生成如下sql,select id,name,image,letter from tb_brandwhere oreder by.......

解決方法:

配置yml檔案,開啟mybatis日誌,檢視mybatis生成的sql和執行的細節,找到問題原因,配置如下:

mybatis:

type-aliases-package: com.leyou.*.pojo

configuration:

map-underscore-to-camel-case: truelog-impl: org.apache.ibatis.logging.stdout.stdoutimpl //開啟日誌

systemtap embedded C 踩坑筆記

官方文件 systemtap的embedded c中,不能 include 也不能用printf和print。那怎麼列印呢?用stap printf。用法與printf一樣。還可以訪問cript中的全域性變數。官方文件中的示例 global var global var2 100 function ...

Aggregation MongoDB踩坑記錄

對某些篩選條件進行分頁查詢,開始每一頁的有效data都不足pagesize,最後發現,aggregation 的pipeline是有先後順序的。錯誤 agg aggregation.newaggregation aggregation.skip curpage 1 pagesize aggregat...

feign踩坑 通過Feign上傳檔案(踩坑)

引入依賴 org.springframework.cloud spring cloud starter openfeign 服務提供者 restcontroller public inte ce fileuploadservice commonresultuploadfile requestpart...