Want to automatically generate mybatis basic additions, deletions, changes and queries and handwritten sql into two xml files, what is the solution?

title may not be very clear, I want to achieve the effect is:
in the operation of the same table, the basic addition, deletion and query using mybatis-generator automatically generated xml file, and then write a xml file to put their own handwritten sql.
in this way, if new fields are added to the database, generating a new xml, using mybatis-generator will not overwrite the custom sql file, and your own handwritten sql may return a BaseResultMap type. How can this function be realized?

Mar.22,2021

in addition, your handwritten < resultMap > can inherit the automatically generated xml < BaseResultMap >,
so that even if you overwrite the automatically generated mapper.xml, your manually written < resultMap > does not have to be changed.

<resultMap id="BaseResultMap" type="com.mshu.vip.entity.SysUser"
           extends="com.mshu.vip.mapper.original.SysUserMapper.BaseResultMap">
</resultMap>

Note that the path to extends is "the path to the interface. BaseResultMap" is abstract.


clipboard.png
sql file is placed in 2 directories, and then @ MapperScan (basePackages = {"cn.com.XX.mapper", "cn.com.XX.dao"} scan the interfaces in these two directories

then configure these
< mapper resource= "mysql/cn/com/XXX/Mapper.xml" / > on the configuration file

    <mapper resource="mysql/cn/com/XXX/Dao.xml"/>

refer to resultmap sql fragments and the like directly in your own files

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b372e5-34422.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b372e5-34422.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?