liujie
2025-06-09 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb
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
64
65
66
67
68
69
70
<?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.panzhihua.service_community.dao.BcRegionDao">
 
    <resultMap type="com.panzhihua.service_community.entity.BcRegion" id="BcRegionBaseResultMap">
        <result property="regionId" column="region_id"/>
        <result property="regionCode" column="region_code"/>
        <result property="regionName" column="region_name"/>
        <result property="parentId" column="parent_id"/>
        <result property="hierarchyOrder" column="hierarchy_order"/>
        <result property="levelOrder" column="level_order"/>
        <result property="formatCode" column="format_code"/>
        <result property="createUserId" column="create_user_id"/>
        <result property="createDatetime" column="create_datetime"/>
        <result property="modifyUserId" column="modify_user_id"/>
        <result property="modifyDatetime" column="modify_datetime"/>
        <result property="deleteFlag" column="delete_flag"/>
        <result property="childrenNum" column="children_num"/>
    </resultMap>
 
    <select id="selectByName" resultType="string">
        SELECT distinct left(code,6) FROM area_index_2022 where 1=1
        <if test="province !=null and province!=''">
            and province = #{province}
        </if>
        <if test="city !=null and city!=''">
            and city =#{city}
        </if>
        <if test="county !=null and county!=''">
            and county like concat(#{county},'%')
        </if>
        <if test="town !=null and town!=''">
            and town = #{town}
        </if>
        limit 1
    </select>
 
    <select id="selectCommunityCodeByName" resultType="string">
        SELECT distinct code FROM area_index_2022 where 1=1
        <if test="city !=null and city!=''">
            and city =#{city}
        </if>
        <if test="county !=null and county!=''">
            and county like concat(#{county},'%')
        </if>
        <if test="town !=null and town!=''">
            and town = #{town}
        </if>
        <if test="villagetr !=null and villagetr!=''">
            and villagetr like concat(#{villagetr},'%')
        </if>
        limit 1
    </select>
 
    <select id="selectFirst" resultType="com.panzhihua.common.model.vos.community.ProvinceCityReturnVO">
        select distinct  name,code from area_code_2022 where level=1
    </select>
 
    <select id="selectSecond" resultType="com.panzhihua.common.model.vos.community.ProvinceCityReturnVO">
        select distinct  name,code from area_code_2022 where level=2 and pcode=#{name}
    </select>
 
    <select id="selectThird" resultType="com.panzhihua.common.model.vos.community.ProvinceCityReturnVO">
        select distinct  name,code from area_code_2022 where level=3 and pcode=#{name}
    </select>
 
    <select id="selectFourth" resultType="com.panzhihua.common.model.vos.community.ProvinceCityReturnVO">
        select distinct  name,code from area_code_2022 where level=4 and pcode=#{name}
    </select>
</mapper>