Pu Zhibing
2025-05-16 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
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
<?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.TOpenCityMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TOpenCity">
        <id column="id" property="id" />
        <result column="cityId" property="cityId" />
        <result column="lon" property="lon" />
        <result column="lat" property="lat" />
        <result column="isQualifications" property="isQualifications" />
        <result column="areaName" property="areaName" />
        <result column="cityName" property="cityName" />
        <result column="provinceName" property="provinceName" />
        <result column="flag" property="flag" />
        <result column="insertTime" property="insertTime" />
        <result column="insertUser" property="insertUser" />
        <result column="updateTime" property="updateTime" />
        <result column="updateUser" property="updateUser" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, cityId, lon, lat, isQualifications, areaName, cityName, provinceName, flag, insertTime, insertUser, updateTime, updateUser
    </sql>
 
    <!--根据条件查询开通城市列表-->
    <select id="getOpenCityList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT * FROM (
        SELECT
        ocb.str as business,
        oc.*,
        b.chineseName
        FROM t_open_city as oc
        left join t_city b on (oc.cityId = b.id)
        LEFT JOIN (
        SELECT GROUP_CONCAT(
        CONCAT((case when businessType = 1 then '专车'
        when businessType = 4 then '市内小件物流'
        else '' end),' :',sort)) as str,openCityId from t_open_city_business where flag != 3 GROUP BY openCityId
        ) as ocb on ocb.openCityId = oc.id
 
        <where>
            oc.flag != 3
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (oc.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
            <if test="condition != null and condition != ''">
                and (b.chineseName LIKE CONCAT('%',#{condition},'%') or b.englishName LIKE CONCAT('%',#{condition},'%') or b.frenchName LIKE CONCAT('%',#{condition},'%'))
            </if>
        </where>
        ) as o
        order by o.id desc
    </select>
 
    <!--根据城市ID获取经营业务-->
    <select id="getBusinessByCityId" resultType="map">
        SELECT DATE_FORMAT(bb.insertTime,'%Y-%m-%d') as insertTimeStr,
        case when bb.businessType = 1 then '专车'
        when bb.businessType = 4 then '市内小件物流'
        else '' end as businessTypeStr,bb.*
        FROM t_open_city_business as bb where bb.openCityId = #{openCityId} and bb.flag != 3
    </select>
 
</mapper>