|
@@ -26,65 +26,76 @@
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<select id="countByParamsBack" parameterType="map" resultType="int">
|
|
<select id="countByParamsBack" parameterType="map" resultType="int">
|
|
- select count(c.wifiId) from
|
|
|
|
- (
|
|
|
|
- select w.id as wifiId, w.place_id as placeId from t_wifi w, t_location l
|
|
|
|
- where
|
|
|
|
- w.location = l.location and w.status != -1
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ count(DISTINCT(tw.id))
|
|
|
|
+ FROM
|
|
|
|
+ t_wifi tw LEFT JOIN t_location tl on tl.location = tw.location
|
|
|
|
+ LEFT JOIN t_place tp on tp.id = tw.place_id
|
|
|
|
+ LEFT JOIN t_place_class tpc on tp.id = tpc.place_id
|
|
|
|
+ LEFT JOIN t_place_class_info tpci on tpci.id = tpc.class_id
|
|
|
|
+ where tw.status != -1
|
|
|
|
+ <if test="cn != null">
|
|
|
|
+ and tl.cn = #{cn}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cnCity != null">
|
|
|
|
+ and tl.cn_city = #{cnCity}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="place != null">
|
|
|
|
+ and tw.place = #{place}
|
|
|
|
+ </if>
|
|
<if test="operatorId != null">
|
|
<if test="operatorId != null">
|
|
- and w.operator_id = #{operatorId}
|
|
|
|
- </if>
|
|
|
|
- <if test="cn != null">
|
|
|
|
- and l.cn = #{cn}
|
|
|
|
- </if>
|
|
|
|
- <if test="cnCity != null">
|
|
|
|
- and l.cn_city = #{cnCity}
|
|
|
|
- </if>
|
|
|
|
- <if test="place != null">
|
|
|
|
- and w.place = #{place}
|
|
|
|
- </if>
|
|
|
|
- <if test="mac != null">
|
|
|
|
- and (w.apmac like #{mac})
|
|
|
|
- </if>
|
|
|
|
- ) as c left join t_place_class pc on c.placeId = pc.place_id
|
|
|
|
- <where>
|
|
|
|
- <if test="placeClassId != null">
|
|
|
|
- and pc.class_id = #{placeClassId}
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
|
|
+ and tw.operator_id = #{operatorId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="placeClassId != null">
|
|
|
|
+ and tpci.name = #{placeClassId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="mac != null">
|
|
|
|
+ and tw.apmac like #{mac}
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findByParamsBack" parameterType="map" resultType="Wifi">
|
|
<select id="findByParamsBack" parameterType="map" resultType="Wifi">
|
|
- select c.*, t_place_class_info.name as placeClassName from
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- <include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName, t_operator.company_name as operatorName
|
|
|
|
- from t_wifi, t_location, t_place, t_operator
|
|
|
|
- <where>
|
|
|
|
- t_wifi.location = t_location.location and t_wifi.place_id = t_place.id and t_wifi.operator_id = t_operator.id
|
|
|
|
- and t_wifi.status != -1
|
|
|
|
- <if test="operatorId != null">
|
|
|
|
- and t_wifi.operator_id = #{operatorId}
|
|
|
|
- </if>
|
|
|
|
- <if test="cn != null">
|
|
|
|
- and t_location.cn = #{cn}
|
|
|
|
- </if>
|
|
|
|
- <if test="cnCity != null">
|
|
|
|
- and t_location.cn_city = #{cnCity}
|
|
|
|
- </if>
|
|
|
|
- <if test="place != null">
|
|
|
|
- and t_wifi.place = #{place}
|
|
|
|
- </if>
|
|
|
|
- <if test="mac != null">
|
|
|
|
- and (t_wifi.apmac like #{mac})
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
- ) as c left join t_place_class pc on c.placeId = pc.place_id
|
|
|
|
- left join t_place_class_info on pc.class_id = t_place_class_info.id
|
|
|
|
- <if test="placeClassId != null">
|
|
|
|
- and pc.class_id = #{placeClassId}
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ DISTINCT(tw.id) id,
|
|
|
|
+ tw. NAME NAME,
|
|
|
|
+ tw.SSID SSID,
|
|
|
|
+ tl.cn cn,
|
|
|
|
+ tl.cn_city cnCity,
|
|
|
|
+ tw.address address,
|
|
|
|
+ tw.longitude longitude,
|
|
|
|
+ tw.latitude latitude,
|
|
|
|
+ tw.apmac apmac,
|
|
|
|
+ tw.place placeName,
|
|
|
|
+ tp.name placeClassName,
|
|
|
|
+ tw.updated updated,
|
|
|
|
+ tw.status status,
|
|
|
|
+ tw.operator_id operatorId
|
|
|
|
+ FROM
|
|
|
|
+ t_wifi tw LEFT JOIN t_location tl on tl.location = tw.location
|
|
|
|
+ LEFT JOIN t_place tp on tp.id = tw.place_id
|
|
|
|
+ LEFT JOIN t_place_class tpc on tp.id = tpc.place_id
|
|
|
|
+ LEFT JOIN t_place_class_info tpci on tpci.id = tpc.class_id
|
|
|
|
+ where tw.status != -1
|
|
|
|
+ <if test="cn != null">
|
|
|
|
+ and tl.cn = #{cn}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cnCity != null">
|
|
|
|
+ and tl.cn_city = #{cnCity}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="place != null">
|
|
|
|
+ and tw.place = #{place}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="operatorId != null">
|
|
|
|
+ and tw.operator_id = #{operatorId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="placeClassId != null">
|
|
|
|
+ and tpci.name = #{placeClassId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="mac != null">
|
|
|
|
+ and tw.apmac like #{mac}
|
|
</if>
|
|
</if>
|
|
- limit #{pager.offset}, #{pager.limit}
|
|
|
|
|
|
+ order by tw.id asc
|
|
|
|
+ limit #{pager.offset}, #{pager.limit}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findByParams1Back" parameterType="map" resultType="Wifi">
|
|
<select id="findByParams1Back" parameterType="map" resultType="Wifi">
|