123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <?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="wifiSqlMapper">
- <sql id="base_column">
- t_wifi.id as id,
- t_wifi.name as name,
- t_wifi.SSID as SSID,
- t_wifi.location as location,
- t_wifi.apmac as apmac,
- t_wifi.address as address,
- t_wifi.longitude as longitude,
- t_wifi.latitude as latitude,
- t_wifi.place as place,
- t_wifi.place_id as placeId,
- t_wifi.operator_id as operatorId,
- t_wifi.status as status,
- t_wifi.updated as updated
- </sql>
-
- <sql id="base_column2">
- id,
- location,
- address,
- longitude,
- latitude
- </sql>
-
- <select id="countByParamsBack" parameterType="map" resultType="int">
- SELECT
- count(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">
- and tw.operator_id = #{operatorId}
- </if>
- <if test="placeClassId != null">
- and tpci.id = #{placeClassId}
- </if>
- <if test="mac != null">
- and tw.apmac like #{mac}
- </if>
- </select>
-
- <select id="findByParamsBack" parameterType="map" resultType="Wifi">
- SELECT
- 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 place,
- tp.name placeName,
- tpci.name as 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.id = #{placeClassId}
- </if>
- <if test="mac != null">
- and tw.apmac like #{mac}
- </if>
- order by tw.id asc
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <select id="findByParams1Back" parameterType="map" resultType="Wifi">
- SELECT
- 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 place,
- tp.name placeName,
- tpci.name as 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.id = #{placeClassId}
- </if>
- <if test="mac != null">
- and tw.apmac like #{mac}
- </if>
- order by tw.id asc
- </select>
-
- <select id="countByParamsOperator" parameterType="map" resultType="int">
- select count(w.id) from t_wifi w, t_location l
- <where>
- w.location = l.location and w.status != -1 and w.operator_id = #{operatorId}
- <if test="cn != null">
- and l.cn = #{cn}
- </if>
- <if test="cnCity != null">
- and l.cn_city = #{cnCity}
- </if>
- <if test="placeId != null">
- and w.place_id = #{placeId}
- </if>
- <if test="place != null">
- and w.place = #{place}
- </if>
- <if test="searchValue != null">
- and (w.address like #{searchValue} or w.name like #{searchValue})
- </if>
- </where>
- </select>
-
- <select id="findByParams" parameterType="map" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName
- from t_wifi, t_location, t_place
- <where>
- t_wifi.location = t_location.location and t_wifi.place_id = t_place.id
- and t_wifi.status != -1 and t_wifi.operator_id = #{operatorId}
- <if test="cn != null">
- and t_location.cn = #{cn}
- </if>
- <if test="cnCity != null">
- and t_location.cn_city = #{cnCity}
- </if>
- <if test="placeId != null">
- and t_wifi.place_id = #{placeId}
- </if>
- <if test="place != null">
- and t_wifi.place = #{place}
- </if>
- <if test="searchValue != null">
- and (t_wifi.address like #{searchValue} or t_wifi.name like #{searchValue})
- </if>
- </where>
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <select id="findByParams1" parameterType="map" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName
- from t_wifi, t_location, t_place
- <where>
- t_wifi.location = t_location.location and t_wifi.place_id = t_place.id
- and t_wifi.status != -1 and t_wifi.operator_id = #{operatorId}
- <if test="cn != null">
- and t_location.cn = #{cn}
- </if>
- <if test="cnCity != null">
- and t_location.cn_city = #{cnCity}
- </if>
- <if test="placeId != null">
- and t_wifi.place_id = #{placeId}
- </if>
- <if test="place != null">
- and t_wifi.place = #{place}
- </if>
- <if test="searchValue != null">
- and (t_wifi.address like #{searchValue} or t_wifi.name like #{searchValue})
- </if>
- </where>
- </select>
-
-
- <select id="findById" parameterType="long" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName
- from t_wifi, t_location, t_place
- <where>
- t_wifi.location = t_location.location and t_wifi.place_id = t_place.id
- and t_wifi.status != -1 and t_wifi.id = #{id}
- </where>
- </select>
-
- <update id="updateWifiStatus" parameterType="HashMap">
- update t_wifi
- set status=#{status},updated = #{updated}
- where id in
- <foreach item="id" collection="idList" open="(" separator=","
- close=")">
- #{id}
- </foreach>
- </update>
-
- <update id="editWifi" parameterType="com.cloudcross.ssp.model.Wifi">
- update t_wifi set name = #{name},
- location = #{location},
- address = #{address},
- longitude = #{longitude},
- latitude = #{latitude},
- apmac = #{apmac},
- place = #{place},
- place_id = #{placeId}
- where id = #{id}
- </update>
-
- <insert id="add" parameterType="com.cloudcross.ssp.model.Wifi" useGeneratedKeys="true" keyProperty="id">
- insert into t_wifi(name, SSID, location, apmac, address, longitude, latitude, place, place_id, operator_id, updated)
- values(#{name}, #{SSID}, #{location}, #{apmac}, #{address}, #{longitude}, #{latitude}, #{place}, #{placeId}, #{operatorId}, #{updated})
- </insert>
-
- <select id="findAddress" parameterType="map" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column2" />
- from t_wifi where 1 = 1
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='address'">
- and address like #{value}
- </when>
- </choose>
- </if>
- order by id
- </select>
-
- <select id="findWifi" parameterType="map" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column2" />
- from t_wifi where location in (select location from t_wifi where location = #{location})
- and latitude <= #{maxlat} and latitude >= #{minlat}
- and longitude <= #{maxlng} and longitude >= #{minlng}
- </select>
-
- <select id="findLocation" parameterType="String" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column2" />
- from t_wifi where location = #{location}
- </select>
-
- <select id="findAllAdgroupWifi" parameterType="Long" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column2" />
- from t_wifi where id in (select wifi_id from t_adgroup_wifi where adgroup_id = #{adGroupId})
- order by id
- </select>
-
-
- <insert id="addAdgroupWifi" parameterType="map">
- insert into
- t_adgroup_wifi (adgroup_id,wifi_id)
- values (#{adGroupId},#{wifiId})
- </insert>
-
- <delete id="deleteAdgroupWifi" parameterType="long">
- delete from t_adgroup_wifi where adgroup_id = #{adGroupId}
- </delete>
-
- <select id="selectByParams" parameterType="map" resultType="com.cloudcross.ssp.model.Wifi">
- select
- <include refid="base_column2" />
- from t_wifi where 1 = 1
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='address'">
- and address like #{value}
- </when>
- </choose>
- </if>
- order by id
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <select id="countByParamsAdvertiser" parameterType="map" resultType="int">
- select count(id)
- from t_wifi where 1 = 1
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='address'">
- and address like #{value}
- </when>
- </choose>
- </if>
- </select>
-
- <select id="queryWifiGroupCount" parameterType="java.util.Map" resultType="java.lang.Integer">
- SELECT count(wifi.id) FROM t_wifi wifi,t_wifi_group wg,t_wifi_group_info wgi
- WHERE wg.wifi_id = wifi.id AND wg.group_id = wgi.id
- and wifi.operator_id = #{operatorId} and wgi.name = #{name}
- <if test="apmac != null">
- and wifi.apmac = #{apmac}
- </if>
-
- </select>
-
- <select id="queryWifiGroup" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.Wifi">
- SELECT
- wifi.id id,
- wifi.operator_id operatorId,
- wifi.name name,
- wifi.SSID SSID,
- wifi.location location,
- wifi.apmac apmac,
- wifi.address adderss,
- wifi.longitude longitude,
- wifi.latitude latitude,
- wgi.name groupName,
- wg.supdated supdated,
- wg.status status
- FROM
- t_wifi wifi,
- t_wifi_group wg,
- t_wifi_group_info wgi
- WHERE
- wg.wifi_id = wifi.id
- AND wg.group_id = wgi.id
- and wifi.operator_id = #{operatorId}
- and wgi.name = #{name}
- <if test="apmac != null">
- and wifi.apmac = #{apmac}
- </if>
- </select>
-
- <select id="queryWifiByCondition" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.Wifi">
- SELECT
- wifi.id id,
- wifi.NAME name,
- wifi.SSID SSID,
- wifi.location location,
- wifi.apmac apmac,
- wifi.address address,
- wifi.longitude longitude,
- wifi.latitude latitude,
- loc.cn cn,
- loc.cn_city cnCity
- FROM
- t_wifi wifi,
- t_location loc
- WHERE
- wifi.place_id = loc.id
- <if test="operatorId != null">
- and wifi.operator_id = #{operatorId}
- </if>
- <if test="apmac != null">
- and wifi.apmac = #{apmac}
- </if>
- <if test="cn != null">
- and loc.cn = #{cn}
- </if>
- <if test="cnCity != null">
- and loc.cn_city = #{cnCity}
- </if>
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <select id="queryWifiCountByCondition" parameterType="java.util.Map" resultType="java.lang.Integer">
- SELECT count(wifi.id) FROM t_wifi wifi,t_location loc WHERE
- wifi.place_id = loc.id
- <if test="operatorId != null">
- and wifi.operator_id = #{operatorId}
- </if>
- <if test="apmac != null">
- and wifi.apmac = #{apmac}
- </if>
- <if test="cn != null">
- and loc.cn = #{cn}
- </if>
- <if test="cnCity != null">
- and loc.cn_city = #{cnCity}
- </if>
- </select>
- </mapper>
|