Some problems encountered in the development of mybatis

1. When a field of tinyint type is encountered, it will automatically change to Boolean type when the query returns. The best way is to change the type, such as smallint.

 

2. The return value of sum() is returned as BigDecimal in mybatis. Processing:
(1) Return the Object value, and obtain the int value through Integer.parseInt(object.toString());
(2) Return the BigDecimal value, Get the value via BigDecimal.intValue().

3. Mybatis recognizes the integer 0 (class field attribute definition) as null. We can add it to the judgment in the if condition:

<if test="status != null and status != ''  or status == 0" >
		and mea.status = #{status}
</if>

 Another way is to define the field type as String.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326360067&siteId=291194637