Mybatis resultMap Assign customized value to nullvalue I want to assign my customized value for nullValue returning column from my query. Below is my code snippet Advanced thanks for your help
<resultMap id="abcd" class="abcdVO">
<result property="ABC" column="Col1" nullValue="No"/>
<result property="XYZ" column="Col2" nullValue=" "/>
</resultMap>
<select id="abcd" parameterType ="String" resultMap="abcdMap">
Select Col1, Col2 from xyz
</select>
Use COALESCE
:
<select id="abcd" parameterType ="String" resultMap="abcdMap">
Select COALESCE(Col1, 'No') as Col1, COALESCE(Col2, ' ') as Col2 from xyz
</select>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.