Several ways for Mybatis to parse enumeration types

1. The simplest is to define the parsed enumeration class and the processed enumeration class
in the configuration file. There are two types of enumeration classes that come with them.

<!-- handle enum -->
<typeHandlers>
<typeHandler handler="org.apache.ibatis.type.EnumOrdinalTypeHandler"javaType="com.ryt.manage.entity.OrderType"/>
</typeHandlers>



There is no need to do any processing in Mapper.xml
<result property="orderType" column="order_type"/>


Remember that there is a default construction method in the Entity class. If not, it will result in an error of no construction.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326600946&siteId=291194637