HotswapProjects/HotswapAgent

MyBatis Plus Dynamic Sql Hotswap do not work

jokerzzccc opened this issue · 1 comments

base version:

  • mybatis-plus-boot-starter:3.4.4
  • spring-boot-web:2.5.5
  • HotswapAgent:1.4.2-SNAPSHOT
  • JDK 1.8

When I Use Mybatis Dynamic Sql. The XML sql statement updates do not work after recompile the xml file.

  • code like below:

  • <select id="ListLine" resultType="cn.com.xxx.model.vo.ReverseLineVO">
        SELECT
            '0'AS hotswap,
            <if test="dto.searchType !null and dto.searchType ==1">
                DATE_FORMAT(wgt_time,'%Y.%m') AS time,
            </if>
            <if test="dto.searchType !null and dto.searchType ==0">
                DATE_FORMAT(wgt_time,'%Y.%m.%d') AS time,
            </if>
    
        FROM
            ...
  • '0'AS hotswap, is the code added when application running.

After Debug, I founds that the DynamicSqlSource#rootSqlNode which is initialized in application starting has no changes. So The PrepareStatement do not change too.

Q: How should I make Mybatis' DynamicSqlSource#rootSqlNode reload and recompile. So that XML hotswap work.

THANKS FOR YOUR ANSWER!