|
@@ -2,20 +2,9 @@
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
<mapper namespace="wifiSumSqlMapper">
|
|
<mapper namespace="wifiSumSqlMapper">
|
|
<select id="queryWifiSum" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.WifiSum">
|
|
<select id="queryWifiSum" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.WifiSum">
|
|
- SELECT
|
|
|
|
- tl.cn cn,
|
|
|
|
- tl.cn_city cnCity,
|
|
|
|
- tpci.NAME placeName,
|
|
|
|
- count(tw.id) sum
|
|
|
|
- FROM
|
|
|
|
- t_place_class_info tpci,
|
|
|
|
- t_place_class tpc,
|
|
|
|
- t_wifi tw,
|
|
|
|
- t_location tl
|
|
|
|
- WHERE
|
|
|
|
- tpci.id = tpc.class_id
|
|
|
|
- and tpc.place_id = tw.place_id
|
|
|
|
- and tw.location = tl.location
|
|
|
|
|
|
+ select t.cn cn,t.cnCity cnCity,t.placeName placeName,t.num num from
|
|
|
|
+ ((SELECT tl.cn cn,tl.cn_city cnCity,tpci. NAME placeName,count(tw.id) num FROM t_place_class_info tpci,t_place_class tpc,t_wifi tw,t_location tl
|
|
|
|
+ WHERE tpci.id = tpc.class_id AND tpc.place_id = tw.place_id AND tw.location = tl.location
|
|
<if test="cn != null">
|
|
<if test="cn != null">
|
|
and tl.cn = #{cn}
|
|
and tl.cn = #{cn}
|
|
</if>
|
|
</if>
|
|
@@ -25,26 +14,33 @@
|
|
<if test="placeId != null">
|
|
<if test="placeId != null">
|
|
and tpci.id = #{placeId}
|
|
and tpci.id = #{placeId}
|
|
</if>
|
|
</if>
|
|
- GROUP BY tl.cn,tl.cn_city,tpci.NAME
|
|
|
|
|
|
+ <if test="searchValue != null">
|
|
|
|
+ and tpci.name like #{searchValue}
|
|
|
|
+ </if>
|
|
|
|
+ group by tl.cn ,tl.cn_city,tpci.NAME)
|
|
|
|
+ union ALL
|
|
|
|
+ (SELECT tl.cn cn,tl.cn_city cnCity,tpci. NAME placeName,tws.num num FROM t_wifi_sum tws,t_location tl,t_place_class_info tpci,t_place_class tpc
|
|
|
|
+ WHERE tws.location = tl.location and tws.place_id = tpc.place_id and tpc.class_id = tpci.id
|
|
|
|
+ <if test="cn != null">
|
|
|
|
+ and tl.cn = #{cn}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cnCity != null">
|
|
|
|
+ and tl.cn_city = #{cnCity}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="placeId != null">
|
|
|
|
+ and tpci.id = #{placeId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="searchValue != null">
|
|
|
|
+ and tpci.name like #{searchValue}
|
|
|
|
+ </if>
|
|
|
|
+ ))t
|
|
limit #{pager.offset}, #{pager.limit}
|
|
limit #{pager.offset}, #{pager.limit}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="queryWifiSumCount" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
<select id="queryWifiSumCount" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
- select count(1) from (
|
|
|
|
- SELECT
|
|
|
|
- tl.cn cn,
|
|
|
|
- tl.cn_city cnCity,
|
|
|
|
- tpci.NAME placeName,
|
|
|
|
- count(tw.id) sum
|
|
|
|
- FROM
|
|
|
|
- t_place_class_info tpci,
|
|
|
|
- t_place_class tpc,
|
|
|
|
- t_wifi tw,
|
|
|
|
- t_location tl
|
|
|
|
- WHERE
|
|
|
|
- tpci.id = tpc.class_id
|
|
|
|
- and tpc.place_id = tw.place_id
|
|
|
|
- and tw.location = tl.location
|
|
|
|
|
|
+ select count(1) from
|
|
|
|
+ ((SELECT tl.cn cn,tl.cn_city cnCity,tpci. NAME placeName,count(tw.id) num FROM t_place_class_info tpci,t_place_class tpc,t_wifi tw,t_location tl
|
|
|
|
+ WHERE tpci.id = tpc.class_id AND tpc.place_id = tw.place_id AND tw.location = tl.location
|
|
<if test="cn != null">
|
|
<if test="cn != null">
|
|
and tl.cn = #{cn}
|
|
and tl.cn = #{cn}
|
|
</if>
|
|
</if>
|
|
@@ -54,7 +50,25 @@
|
|
<if test="placeId != null">
|
|
<if test="placeId != null">
|
|
and tpci.id = #{placeId}
|
|
and tpci.id = #{placeId}
|
|
</if>
|
|
</if>
|
|
- GROUP BY tl.cn,tl.cn_city,tpci.NAME
|
|
|
|
- ) t
|
|
|
|
|
|
+ <if test="searchValue != null">
|
|
|
|
+ and tpci.name like #{searchValue}
|
|
|
|
+ </if>
|
|
|
|
+ group by tl.cn ,tl.cn_city,tpci.NAME)
|
|
|
|
+ union ALL
|
|
|
|
+ (SELECT tl.cn cn,tl.cn_city cnCity,tpci. NAME placeName,tws.num num FROM t_wifi_sum tws,t_location tl,t_place_class_info tpci,t_place_class tpc
|
|
|
|
+ WHERE tws.location = tl.location and tws.place_id = tpc.place_id and tpc.class_id = tpci.id
|
|
|
|
+ <if test="cn != null">
|
|
|
|
+ and tl.cn = #{cn}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cnCity != null">
|
|
|
|
+ and tl.cn_city = #{cnCity}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="placeId != null">
|
|
|
|
+ and tpci.id = #{placeId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="searchValue != null">
|
|
|
|
+ and tpci.name like #{searchValue}
|
|
|
|
+ </if>
|
|
|
|
+ ))t
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|