<?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.ruoyi.base.mapper.BaseCityMapper">
    
    <resultMap type="BaseCity" id="BaseCityResult">
        <result property="id"    column="id"    />
        <result property="cityId"    column="city_id"    />
        <result property="level"    column="level"    />
        <result property="parentId"    column="parent_id"    />
        <result property="areaCode"    column="area_code"    />
        <result property="name"    column="name"    />
        <result property="mergerName"    column="merger_name"    />
        <result property="lng"    column="lng"    />
        <result property="lat"    column="lat"    />
        <result property="isShow"    column="is_show"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectBaseCityVo">
        select id, city_id, level, parent_id, area_code, name, merger_name, lng, lat, is_show, create_time, update_time from dl_base_city
    </sql>

    <select id="queryListPage" parameterType="BaseCity" resultMap="BaseCityResult">
        <include refid="selectBaseCityVo"/>
        <where>
                        <if test="entity.cityId != null "> and city_id = #{entity.cityId}</if>
                        <if test="entity.level != null "> and level = #{entity.level}</if>
                        <if test="entity.parentId != null "> and parent_id = #{entity.parentId}</if>
                        <if test="entity.areaCode != null  and entity.areaCode != ''"> and area_code = #{entity.areaCode}</if>
                        <if test="entity.name != null  and entity.name != ''"> and name like concat('%', #{entity.name}, '%')</if>
                        <if test="entity.mergerName != null  and entity.mergerName != ''"> and merger_name like concat('%', #{entity.mergerName}, '%')</if>
                        <if test="entity.lng != null  and entity.lng != ''"> and lng = #{entity.lng}</if>
                        <if test="entity.lat != null  and entity.lat != ''"> and lat = #{entity.lat}</if>
                        <if test="entity.isShow != null "> and is_show = #{entity.isShow}</if>
        </where>
    </select>
</mapper>