liujie
2023-08-31 a0afbd1e36f74cb521c4d51b08a54f6a1fe538f2
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
<?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.stylefeng.guns.modular.system.dao.TCountryMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCountry">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="type" property="type" />
        <result column="parent_id" property="parentId" />
        <result column="zip_code" property="zipCode" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="remove" property="remove" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, type, parent_id, zip_code, create_time, update_time, remove
    </sql>
    <select id="getStateList" resultType="com.stylefeng.guns.modular.system.model.TCountryVo">
        select t1.id,t1.name stateName,t1.type,t2.name countryName,t1.zip_code zipCode,t2.id parentId from t_country t1 left join t_country t2 on t1.parent_id = t2.id
        where t1.remove =0 and t1.type =2
    <if test="name !=null and name!=''">
        and t1.name like concat("%",#{name},"%")
    </if>
    <if test="countryName !=null and countryName!=''">
        and t2.name like concat("%",#{countryName},"%")
    </if>
    order by t1.create_time
    </select>
    <select id="getcityList" resultType="com.stylefeng.guns.modular.system.model.TCountryVo">
        select t1.id,t1.name cityName,t1.type,t2.name stateName,t1.zip_code zipCode,t3.name countryName,t2.id parentId,t3.id countryId from t_country t1 left join t_country t2 on t1.parent_id = t2.id
        left join t_country t3 on t2.parent_id = t3.id
        where t1.remove =0 and t1.type =3
        <if test="name !=null and name!=''">
            and t1.name like concat("%",#{name},"%")
        </if>
        <if test="countryName !=null and countryName!=''">
            and t2.name like concat("%",#{countryName},"%")
        </if>
        order by t1.create_time
    </select>
 
</mapper>