CityMapper.xml
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?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="com.diligrp.website.dao.impl.CityDaoImpl">
<resultMap type="city" id="cityMap">
<id property="regionId" column="region_id" />
<result property="regionName" column="region_name" />
<result property="level" column="level" />
<result property="parentId" column="parent_id" />
<result property="sort" column="sort" />
<result property="countryId" column="country_id" />
</resultMap>
<select id="getCityListByParentId" parameterType="int"
resultMap="cityMap">
<![CDATA[
select region_id,region_name,level,parent_id,sort,country_id from t_city where parent_id=#{pid};
]]>
</select>
<select id="getParentCityListByRegionId" parameterType="int"
resultMap="cityMap">
<![CDATA[
select region_id,region_name,level,parent_id,sort,country_id from t_city where region_id=#{pid};
]]>
</select>
<select id="getCityByText" parameterType="map" resultMap="cityMap">
<![CDATA[
select
region_id
,region_name
,level
,parent_id
,sort
,country_id
from
t_city
where
level=#{cityLevel}
and region_name like '%${cityName}%';
]]>
</select>
<select id="getCityListByCityIds" parameterType="map" resultMap="cityMap">
select region_id,region_name,level,parent_id,sort,country_id from
t_city where
region_id in
<foreach item="item" index="index" collection="cityIds" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<select id="getCityListByCountryId" parameterType="Long"
resultMap="cityMap">
select
region_id,region_name,level,parent_id,sort,country_id
from
t_city where
country_id
= #{countryId}
</select>
</mapper>