mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-14 06:03:52 +08:00
Springboot 整合 Mybatis 的完整 Web 案例
This commit is contained in:
24
springboot-mybatis/src/main/resources/mapper/CityMapper.xml
Normal file
24
springboot-mybatis/src/main/resources/mapper/CityMapper.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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="org.spring.springboot.dao.CityDao">
|
||||
<resultMap id="BaseResultMap" type="org.spring.springboot.domain.City">
|
||||
<result column="id" property="id" />
|
||||
<result column="province_id" property="provinceId" />
|
||||
<result column="city_name" property="cityName" />
|
||||
<result column="description" property="description" />
|
||||
</resultMap>
|
||||
|
||||
<parameterMap id="City" type="org.spring.springboot.domain.City"/>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, province_id, city_name, description
|
||||
</sql>
|
||||
|
||||
<select id="findByName" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from city
|
||||
where city_name = #{cityName}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user