Browse Source

热点分布

jun.zhou 9 years ago
parent
commit
2e276d93e3

+ 6 - 6
src/main/java/com/cloudcross/ssp/model/WifiSum.java

@@ -15,7 +15,7 @@ public class WifiSum {
 	
 	
 	private Long placeId;
 	private Long placeId;
 	
 	
-	private Long sum;
+	private Long num;
 	
 	
 	private String cn;
 	private String cn;
 	
 	
@@ -72,12 +72,12 @@ public class WifiSum {
 		this.placeId = placeId;
 		this.placeId = placeId;
 	}
 	}
 
 
-	public Long getSum() {
-		return sum;
+	public Long getNum() {
+		return num;
 	}
 	}
 
 
-	public void setSum(Long sum) {
-		this.sum = sum;
+	public void setNum(Long num) {
+		this.num = num;
 	}
 	}
 
 
 	
 	
@@ -93,7 +93,7 @@ public class WifiSum {
 	public String toString() {
 	public String toString() {
 		return "WifiSum [id=" + id + ", operatorId=" + operatorId
 		return "WifiSum [id=" + id + ", operatorId=" + operatorId
 				+ ", location=" + location + ", placeId=" + placeId + ", sum="
 				+ ", location=" + location + ", placeId=" + placeId + ", sum="
-				+ sum + ", cn=" + cn + ", cnCity=" + cnCity + ", placeName="
+				+ num + ", cn=" + cn + ", cnCity=" + cnCity + ", placeName="
 				+ placeName + "]";
 				+ placeName + "]";
 	}
 	}
 
 

+ 46 - 32
src/main/java/com/cloudcross/ssp/model/mapper/wifi-sum.sql.xml

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

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

@@ -818,16 +818,31 @@ public class ApmacController extends SimpleController {
 	}
 	}
 	
 	
 	@RequestMapping("/wifisum")
 	@RequestMapping("/wifisum")
-	public String queryWifiSumList(Model model,String cn,String cnCity,Integer place,@RequestParam(defaultValue = "1") int page){
+	public String queryWifiSumList(Model model,String cn,String cnCity,Integer placeId,
+			String placeName,@RequestParam(defaultValue = "1") int page,String searchValue){
 		Map<String,Object>condition = new HashMap<String,Object>();
 		Map<String,Object>condition = new HashMap<String,Object>();
 		if(cn != null && !"".equals(cn)){
 		if(cn != null && !"".equals(cn)){
 			condition.put("cn", cn);
 			condition.put("cn", cn);
+			model.addAttribute("cn", cn);
+		}else{
+			model.addAttribute("cn", "省");
 		}
 		}
 		if(cnCity != null && !"".equals(cnCity)){
 		if(cnCity != null && !"".equals(cnCity)){
 			condition.put("cnCity", cnCity);
 			condition.put("cnCity", cnCity);
+			model.addAttribute("cnCity", cnCity);
+		}else{
+			model.addAttribute("cnCity", "市");
 		}
 		}
-		if(place != null && !"".equals(place) && place>0){
-			condition.put("place", place);
+		if(placeId != null && !"".equals(placeId)){
+			condition.put("place", placeId);
+			model.addAttribute("placeId", placeId);
+			model.addAttribute("placeName", placeName);
+		}else{
+			model.addAttribute("placeName", "数据场景");
+		}
+		if(searchValue != null && !"".equals(searchValue)){
+			searchValue = "%"+searchValue+"%";
+			condition.put("searchValue", searchValue);
 		}
 		}
 		Integer count = this.wifiSumService.queryWifiSumCountByCondition(condition);
 		Integer count = this.wifiSumService.queryWifiSumCountByCondition(condition);
 		Pager pager = new Pager();
 		Pager pager = new Pager();

+ 2 - 2
src/main/resources/application.properties

@@ -5,8 +5,8 @@ global.encoding=UTF-8
 #database setting
 #database setting
 jdbc.driver=com.mysql.jdbc.Driver
 jdbc.driver=com.mysql.jdbc.Driver
 jdbc.username=ssp_test
 jdbc.username=ssp_test
-jdbc.password=1q2w3e4r
-jdbc.url=jdbc:mysql://test.dc.loc:3306/ssp?useUnicode=true&amp;characterEncoding=UTF-8
+jdbc.password=1234qwer
+jdbc.url=jdbc:mysql://122.144.134.135:3306/ssp?useUnicode=true&amp;characterEncoding=UTF-8
 
 
 #mail server setting
 #mail server setting
 mail.server=smtp.163.com
 mail.server=smtp.163.com

+ 1 - 1
src/main/webapp/WEB-INF/pages/back/main/ap/apmac/wifiSum.ftl

@@ -66,7 +66,7 @@
 							<td class="tbodyTd">${wifiSum.cn!}</td>
 							<td class="tbodyTd">${wifiSum.cn!}</td>
 							<td class="tbodyTd">${wifiSum.cnCity!}</td>
 							<td class="tbodyTd">${wifiSum.cnCity!}</td>
 							<td class="tbodyTd">${wifiSum.placeName!}</td>
 							<td class="tbodyTd">${wifiSum.placeName!}</td>
-							<td class="tbodyTd">${wifiSum.sum!}</td>
+							<td class="tbodyTd">${wifiSum.num!}</td>
 						</tr>
 						</tr>
 						</#list>
 						</#list>
 						</#if>
 						</#if>