Browse Source

back 热点管理bug修改

jun.zhou 9 years ago
parent
commit
c02417af66

+ 1 - 1
src/main/java/com/cloudcross/ssp/model/mapper/placeclass-information.sql.xml

@@ -8,7 +8,7 @@
 	</select>
 	</select>
 	
 	
 	<select id="findPlaceClassByOperatorId" parameterType="long" resultType="PlaceClassInformation">
 	<select id="findPlaceClassByOperatorId" parameterType="long" resultType="PlaceClassInformation">
-		select i.id as id, i.name as name from t_place_operator o, t_place_class c, t_place_class_info i
+		select DISTINCT(i.id) as id, i.name as name from t_place_operator o, t_place_class c, t_place_class_info i
 		where o.place_id = c.place_id and c.class_id = i.id
 		where o.place_id = c.place_id and c.class_id = i.id
 		<if test="_parameter!=null">
 		<if test="_parameter!=null">
 			and o.operator_id = #{_parameter}
 			and o.operator_id = #{_parameter}

+ 65 - 54
src/main/java/com/cloudcross/ssp/model/mapper/wifi.sql.xml

@@ -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">

+ 1 - 1
src/main/java/com/cloudcross/ssp/web/back/main/ap/ApmacController.java

@@ -137,7 +137,7 @@ public class ApmacController extends SimpleController {
 		List<Wifi> wifiList = wifiService.findByParamsBack(paramMap, pager);
 		List<Wifi> wifiList = wifiService.findByParamsBack(paramMap, pager);
 		
 		
 		//如果下拉框传的是默认值,则回传一个对应的值给前端
 		//如果下拉框传的是默认值,则回传一个对应的值给前端
-		if(null == operatorId ||-1 == placeClassId) {
+		if(null == operatorId ||-1 == operatorId) {
 			operatorName = "全部媒体";
 			operatorName = "全部媒体";
 		} else {
 		} else {
 			operatorName = operatorService.findById(operatorId).getCompanyName();
 			operatorName = operatorService.findById(operatorId).getCompanyName();

+ 2 - 2
src/main/webapp/WEB-INF/pages/back/main/ap/apmac/list.ftl

@@ -183,8 +183,8 @@
 								<ul class="son_ul" id="placeIdul_son_ul"></ul>
 								<ul class="son_ul" id="placeIdul_son_ul"></ul>
 							</li>
 							</li>
 						</ul>
 						</ul>
-						<input type="hidden" name="placeId" id="placeId" value="${placeId!}">
-						<input type="hidden" name="placeName" id="placeName" value="${placeName!}">
+						<input type="hidden" name="placeClassId" id="placeId" value="${placeClassId!}">
+						<input type="hidden" name="placeClassName" id="placeName" value="${placeClassName!}">
 				  		<input id="sign" type="submit" value="查询">
 				  		<input id="sign" type="submit" value="查询">
 				  	</div>
 				  	</div>
 					<div id="account-table">
 					<div id="account-table">

+ 1 - 1
src/main/webapp/assets/js/ap-apmac-back.js

@@ -173,7 +173,7 @@ $(document).ready(function() {
 		 		$.getJSON( url, function(data){
 		 		$.getJSON( url, function(data){
 					var data_1 = data;
 					var data_1 = data;
 					$.each( data_1, function( key, val ) {
 					$.each( data_1, function( key, val ) {
-						$("#placeIdul_son_ul").append('<li value='+ val.place_id +'>' + val.name + '</li>');
+						$("#placeIdul_son_ul").append('<li value='+ val.id +'>' + val.name + '</li>');
 					});
 					});
 					$('#placeIdul_son_ul').show(); //ul显示
 					$('#placeIdul_son_ul').show(); //ul显示
 					if($('#placeIdul_son_ul').height()>210){
 					if($('#placeIdul_son_ul').height()>210){