创建mapper.xml
示例IndicatorMapper.xml:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="tk.mybatis.simple.mapper.IndicatorMapper"> <select id="indicatorName" resultType="tk.mybatis.simple.mapper.Indicator"> select indicator_name as indicatorName from config.indicator where indicator_code = #{indicatorCode} </select> </mapper>
分析:
namespace为mapper.xml文件的路径
resultType为返回类型,当前示例中返回的类型为JavaBean
文件结构:
标签:xml,mapper,indicator,示例,05,mybatis From: https://www.cnblogs.com/woniu123/p/16589188.html