Browse Source

热点管理全部功能已实现,待测试(back)

bao.zhang 9 years ago
parent
commit
dc751d3512

+ 27 - 36
src/main/java/com/cloudcross/ssp/model/mapper/place-operator.sql.xml

@@ -20,67 +20,58 @@
 	
 	<select id="countByParams" parameterType="map" resultType="int">
 		select count(o.id)
-		from t_place_operator o , t_operator p
-		where o.operator_id = p.id
-		<if test="operatorName != null">
-		and p.company_name like #{operatorName}
+		from t_place_operator o, t_place p
+		where o.place_id = p.id and o.operator_id = #{operatorId}
+		<if test="searchValue != null">
+		and (o.name like #{searchValue} or p.name like #{searchValue})
 		</if>
 	</select>
 	
 	<select id="findByParams" parameterType="map" resultType="com.cloudcross.ssp.model.PlaceOperator">
 		select o.id as id, o.operator_id as operatorId, o.name as name, p.name as placeName, p.id as placeId
-		from t_place_operator o, t_place p, t_operator
-		where o.place_id = p.id and o.operator_id = t_operator.id
-		<if test="operatorName != null">
-		and p.company_name like #{operatorName}
+		from t_place_operator o, t_place p
+		where o.place_id = p.id and o.operator_id = #{operatorId}
+		<if test="searchValue != null">
+		and (o.name like #{searchValue} or p.name like #{searchValue})
 		</if>
 		limit #{pager.offset}, #{pager.limit}
 	</select>
 	
 	<select id="findByParams1" parameterType="map" resultType="com.cloudcross.ssp.model.PlaceOperator">
-		select o.id as id, o.operator_id as operatorId, o.name as name, p.name as placeName, p.id as placeId
-		from t_place_operator o, t_place p, t_operator
-		where o.place_id = p.id and o.operator_id = t_operator.id
-		<if test="operatorName != null">
-		and p.company_name like #{operatorName}
+			select o.id as id, o.operator_id as operatorId, o.name as name, p.name as placeName, p.id as placeId
+		from t_place_operator o, t_place p
+		where o.place_id = p.id and o.operator_id = #{operatorId}
+		<if test="searchValue != null">
+		and (o.name like #{searchValue} or p.name like #{searchValue})
 		</if>
 	</select>
 	
 	
 	<select id="countByParamsBack" parameterType="map" resultType="int">
 		select count(o.id)
-		from t_place_operator o, t_place p
-		where o.place_id = p.id
-		<if test="operatorId != null">
-			and o.operator_id = #{operatorId}
-		</if>
-		<if test="searchValue != null">
-		and o.name like #{searchValue} or p.name like #{searchValue}
+		from t_place_operator o , t_operator p
+		where o.operator_id = p.id
+		<if test="operatorName != null">
+		and p.company_name like #{operatorName}
 		</if>
 	</select>
 	
 	<select id="findByParamsBack" parameterType="map" resultType="PlaceOperator">
-		select o.id as id, o.operator_id as operatorId, o.name as name, p.name as placeName, p.id as placeId
-		from t_place_operator o, t_place p
-		where o.place_id = p.id
-		<if test="operatorId != null">
-			and o.operator_id = #{operatorId}
-		</if>
-		<if test="searchValue != null">
-		and o.name like #{searchValue} or p.name like #{searchValue}
+		select t_operator.company_name as operatorName,o.id as id, o.operator_id as operatorId, o.name as name, p.name as placeName, p.id as placeId
+		from t_place_operator o, t_place p, t_operator
+		where o.place_id = p.id and o.operator_id = t_operator.id
+		<if test="operatorName != null">
+		and t_operator.company_name like #{operatorName}
 		</if>
 		limit #{pager.offset}, #{pager.limit}
 	</select>
 	
 	<select id="findByParams1Back" parameterType="map" resultType="PlaceOperator">
-		select o.id as id, o.operator_id as operatorId, o.name as name, p.name as placeName, p.id as placeId
-		from t_place_operator o, t_place p
-		where o.place_id = p.id
-		<if test="operatorId != null">
-			and o.operator_id = #{operatorId}
-		</if>
-		<if test="searchValue != null">
-		and o.name like #{searchValue} or p.name like #{searchValue}
+		select t_operator.company_name as operatorName,o.id as id, o.operator_id as operatorId, o.name as name, p.name as placeName, p.id as placeId
+		from t_place_operator o, t_place p, t_operator
+		where o.place_id = p.id and o.operator_id = t_operator.id
+		<if test="operatorName != null">
+		and t_operator.company_name like #{operatorName}
 		</if>
 	</select>
 	

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

@@ -44,8 +44,8 @@
 			<if test="place != null">
 				and w.place = #{place}
 			</if>
-			<if test="searchValue != null">
-				and (w.apmac like #{searchValue})
+			<if test="mac != null">
+				and (w.apmac like #{mac})
 			</if>
 		</where> 
 	</select>
@@ -72,8 +72,8 @@
 			<if test="place != null">
 				and t_wifi.place = #{place}
 			</if>
-			<if test="searchValue != null">
-				and (w.apmac like #{searchValue})
+			<if test="mac != null">
+				and (t_wifi.apmac like #{mac})
 			</if>
 		</where> 
 		limit #{pager.offset}, #{pager.limit}
@@ -102,7 +102,7 @@
 				and t_wifi.place = #{place}
 			</if>
 			<if test="searchValue != null">
-				and (w.apmac like #{searchValue})
+				and (t_wifi.apmac like #{searchValue})
 			</if>
 		</where> 
 		limit #{pager.offset}, #{pager.limit}

+ 1 - 1
src/main/java/com/cloudcross/ssp/service/impl/PlaceOperatorService.java

@@ -76,7 +76,7 @@ public class PlaceOperatorService implements IPlaceOperatorService{
 
 	@Override
 	public int countByParamsBack(Map<String, Object> paramMap) {
-		return myBatisDao.get("placeOperatorSqlMapper,countByParamsBack", paramMap);
+		return myBatisDao.get("placeOperatorSqlMapper.countByParamsBack", paramMap);
 	}
 
 	@Override

+ 16 - 0
src/main/java/com/cloudcross/ssp/service/impl/WifiService.java

@@ -210,10 +210,26 @@ public class WifiService implements IWifiService{
 	}
 	@Override
 	public int countByParamsBack(Map<String, Object> paramMap) {
+		// 按mac地址搜索
+		if (null != paramMap.get("searchValue")
+				&& !"".equals(paramMap.get("searchValue"))) {
+			String name = (String) paramMap.get("searchValue");
+			paramMap.put("mac", SqlHelper.doLike(name.trim()));
+		} else {
+			paramMap.put("mac", null);
+		}
 		return myBatisDao.get("wifiSqlMapper.countByParamsBack", paramMap);
 	}
 	@Override
 	public List<Wifi> findByParamsBack(Map<String, Object> paramMap, Pager pager) {
+		// 按mac地址搜索
+		if (null != paramMap.get("searchValue")
+				&& !"".equals(paramMap.get("searchValue"))) {
+			String name = (String) paramMap.get("searchValue");
+			paramMap.put("mac", SqlHelper.doLike(name.trim()));
+		} else {
+			paramMap.put("mac", null);
+		}
 		paramMap.put("pager", pager);
 		return myBatisDao.getList("wifiSqlMapper.findByParamsBack", paramMap);
 	}

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

@@ -120,14 +120,6 @@ public class ApmacController extends SimpleController {
 		paramMap.put("placeId", placeId);
 		paramMap.put("place", place);
 		
-		//按热点名称和详细地址搜索
-		if(null != paramMap.get("searchValue") && !"".equals(paramMap.get("searchValue"))) {
-				String name = (String) paramMap.get("searchValue");
-				paramMap.put("searchValue", SqlHelper.doLike(name.trim()));
-		} else {
-			paramMap.put("searchValue", null);
-		}
-		
 		int totalRow = 0;
 		Pager pager = null;
 		pager = new Pager();
@@ -192,13 +184,7 @@ public class ApmacController extends SimpleController {
 		if(null == paramMap.get("operatorName") || "".equals(paramMap.get("operatorName"))) {
 			operatorName = null;
 		} else {
-			try {
 				operatorName = String.valueOf(paramMap.get("operatorName"));
-				operatorName = new String(operatorName.getBytes("ISO-8859-1"),"UTF-8");
-			} catch (UnsupportedEncodingException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
 		}
 		
 		paramMap.put("operatorName", SqlHelper.doLike(operatorName));
@@ -206,12 +192,13 @@ public class ApmacController extends SimpleController {
 		Pager pager = null;
 		pager = new Pager();
 		//查询符合条件的总的条数
-		totalRow = placeOperatorService.countByParams(paramMap);
+		totalRow = placeOperatorService.countByParamsBack(paramMap);
 		pager.setPage(page);
 		pager.setTotalRow(totalRow);
-		List<PlaceOperator> placeOperatorList = placeOperatorService.findByParams(paramMap, pager);
+		List<PlaceOperator> placeOperatorList = placeOperatorService.findByParamsBack(paramMap, pager);
 		model.addAttribute("placeOperatorList", placeOperatorList);
 		model.addAttribute("pager",pager);
+		model.addAttribute("operatorName", operatorName);
 		return page("relationship");
 	}
 	
@@ -662,7 +649,6 @@ public class ApmacController extends SimpleController {
 	
 	/**
 	 * 导出场景对应关系excel
-	 * 需要传递一个搜索的参数,可以按场景(name)搜索和数据场景(placeName)搜索
 	 * @param request
 	 * @param response
 	 * @param id
@@ -671,31 +657,17 @@ public class ApmacController extends SimpleController {
 	public void exportRelationShipExcel(HttpServletRequest request,
 			HttpServletResponse response,
 			@RequestParam HashMap<String, Object> paramMap) {
-		
-		Long operatorId = null;
 		String operatorName = null;
 		/**
 		 * 对传入的搜索参数做处理,如果传递的是空值或者空字符串的话就设为空
 		 */
-		if(null == paramMap.get("selectedOperatorId") || "".equals(paramMap.get("selectedOperatorId"))) {
-			operatorName = "全部";
-		} else {
-			operatorId = Long.parseLong(String.valueOf(paramMap.get("selectedOperatorId")));
-			operatorName = operatorService.findById(operatorId).getCompanyName();
-		}
-		
-		
-		// 按热点场景和数聚场景搜索
-		if (null != paramMap.get("searchValue")
-				&& !"".equals(paramMap.get("searchValue"))) {
-			String searchValue = (String) paramMap.get("searchValue");
-			paramMap.put("searchValue", SqlHelper.doLike(searchValue.trim()));
+		if(null == paramMap.get("operatorName") || "".equals(paramMap.get("operatorName"))) {
+			operatorName = null;
 		} else {
-			paramMap.put("searchValue", null);
+				operatorName = String.valueOf(paramMap.get("operatorName"));
 		}
 		
-		paramMap.put("operatorId", operatorId);
-		paramMap.put("operatorName", operatorName);
+		paramMap.put("operatorName", SqlHelper.doLike(operatorName));
 		
 		List<PlaceOperator> placeOperatorList = placeOperatorService.findByParamsBack(paramMap);
 		paramMap.put("dataList", placeOperatorList);

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

@@ -23,7 +23,7 @@
 			$("#wifiForm").autovalidate();
 			//保存按钮
 			$("#create-btn-save").unbind('click').click(function(){
-				alert($("#wifiForm").validate());
+				//alert($("#wifiForm").validate());
 				//if (!$("#wifiForm").validate()) {
 				//	return false;
 				//}

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

@@ -89,12 +89,21 @@
 			// 分页中超链接跳转
 			$('#pagecontent .pagination ul li a[href]').live('click' ,function(){
 				var _page = $(this).attr('href').substr(1);
-				alert(_page);
+				//alert(_page);
 				var _form = $('#wifiForm');
 				_form.find('input:hidden[name="page"]').val(_page);
 				_form.submit();
 				return false;
 			});
+		//搜索输入框的样式改变
+		$("#searchValue").focus(function(){
+			$(this).val("");
+		});
+		$("#searchValue").blur(function(){
+			if($(this).val()== ""){
+				$(this).val("请输入mac地址进行搜索");
+			}
+		});
 		});
 		
 		//导出execl
@@ -103,6 +112,8 @@
 			$("#exportExcel").attr("href","${ctx}/back/main/ap/apmac/exportApListExcel"+param);
 		};
 		
+		
+		
 	</script>
 	
 </@override>
@@ -156,6 +167,7 @@
 							<ul class="son_ul" id="son_operatorListUl"></ul>
 						</li>
 						</ul>
+						
 						<input type="hidden" name="selectedOperatorId" id="selectedOperatorId" value="${selectedOperatorId!}">
 						<ul id="main_placeul">
 							<li class="select_box" id="placeul_box">

+ 17 - 8
src/main/webapp/WEB-INF/pages/back/main/ap/apmac/relationship.ftl

@@ -36,6 +36,15 @@
 				_form.submit();
 				return false;
 			});
+			//搜索输入框的样式改变
+		$("#operatorName").focus(function(){
+			$(this).val("");
+		});
+		$("#operatorName").blur(function(){
+			if($(this).val()== ""){
+				$(this).val("请输入媒体名进行搜索");
+			}
+		});
 		});
 		
 		//导出execl
@@ -68,15 +77,15 @@
 				  	<div id="buttons">
 				        <div id="serachData">
 				        	<input type="hidden" id="page" name="page" value="${pager.page}">
-							<input id="searchValue" type="text" name="searchValue" value="${searchValue!}"/>
-							<input id="serachData_img" type="submit" value="" />
+							<input id="operatorName" type="text" style="margin: -48px 20px 0 -619px;" name="operatorName" value="${operatorName!}"/>
+							<input id="serachData_img" style=" margin: -53px 20px -99px -320px;" type="submit" value="" />
 						</div>
 				    </div>
 					<div id="account-table" style="margin-top:0px;">
-						<table border="1" id="tablefig" style="width:30%;margin-left:1px;">
+						<table border="1" id="tablefig" style="width:50%;margin-left:1px;">
 							<thead>
 								<tr>
-									<th class="td1" style="width:5%">媒体</th>
+									<th class="td1" style="width:5% ; height:40px;">媒体</th>
 									<th class="td1" style="width:5%">场景</th>
 				                    <th class="td1" style="width:5%">数聚场景</th>
 								</tr>
@@ -85,9 +94,9 @@
 							<#if placeOperatorList ??>
 				            <#list placeOperatorList as placeOperator>
 				            	<tr id="tr22">
-				            		<td class="td2">${operatorName!}</td> 
-					                <td class="td2">${placeOperator.name!}</td> 
-					                <td class="td2">${placeOperator.placeName!}</td> 
+				            		<td class="td2" style="height:35px;" >${placeOperator.operatorName!}</td> 
+					                <td class="td2" style="height:35px;">${placeOperator.name!}</td> 
+					                <td class="td2" style="height:35px;">${placeOperator.placeName!}</td> 
 					            </tr>
 					        </#list>  
 				            </#if>
@@ -95,7 +104,7 @@
 						</table>
 						
 						<div id="daochu" >
-							<a class="ljbtn2" id="exportExcel" href="javascript:void(0);" onClick="exportExcel()">导出Excel</a>
+							<a class="ljbtn2" style=" margin-top: 10px;" id="exportExcel" href="javascript:void(0);" onClick="exportExcel()">导出Excel</a>
 						</div>
 									
 						<div id="pageDiv">

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

@@ -6,7 +6,26 @@ $(document).ready(function() {
  		}
  		$("#son_operatorListUl").hide();
  		var url = "/ssp_web/widget/selector/provide/operator?parentId=1";
- 		getSelectData1("operatorListUl_span","son_operatorListUl","operatorListUl_box","全部媒体",url,"operatorList","operator");
+ 		
+ 		$("#operatorListUl_span").on("click",function(){
+	 		$("#son_operatorListUl").empty();
+	 		$('#son_operatorListUl').css({height:"auto",overflow:"hidden"});
+	 		$("#son_operatorListUl").append("<li value='-1'>全部媒体</li>");
+	 	
+		 		$.getJSON( url, function(data){
+					var data_1 = data.operatorList;
+					//alert(data_1);
+					$.each( data_1, function( key, val ) {
+						$("#son_operatorListUl").append('<li value='+ val.id +'>' + val.companyName + '</li>');
+					});
+					$('#son_operatorListUl').show(); //ul显示
+					if($('#son_operatorListUl').height()>210){
+						$('#son_operatorListUl').css({"height":"210"+"px","overflow-y":"scroll","overflow-x":"hidden","z-index":"9999" });
+					};
+				});	
+	 		
+	 	});		
+ 		
  		$('ul#son_operatorListUl li').live("click",function(){
  	 		$(this).parents('li').find('span').html($(this).html());
  			$("#selectedOperatorId").val($(this).attr("value"));
@@ -17,42 +36,30 @@ $(document).ready(function() {
  		});
  	}
  	
- 	function getSelectData1(target_spanId,target_sonulId,target_boxId,defaultName,url,paramValue,tabId){
- 		$("#"+target_sonulId).append("<li value='-1'>"+defaultName+"</li>");
- 		$.getJSON( url, function(data) {
- 			if(tabId != null && tabId == "dimension"){
- 				$.each( data, function( key, val ) {
- 	 				$("#dimension_son_ul").append('<li value='+ val.id +'>' + val.name + '</li>');
- 	 			});
-	 		}else if(tabId != null && tabId == "operator"){
-	 			var data_1 = data[paramValue];
-	 			$.each( data_1, function( key, val ) {
-	 				$("#"+target_sonulId).append('<li value='+ val.id +'>' + val.companyName + '</li>');
-	 			});
-	 		}else{
-	 			var data_1 = data[paramValue];
-	 			$.each( data_1, function( key, val ) {
-	 				$("#"+target_sonulId).append('<li value='+ val.value +'>' + val.label + '</li>');
-	 			});
-	 		}
- 		});
- 		$("#"+target_spanId).on("click",function(){
- 			if($("#"+target_sonulId).height()>210){
-				$("#"+target_sonulId).css({"height":"210px","overflow-y":"scroll","overflow-x":"hidden","z-index":"9999" });
- 			};
- 			$("#"+target_sonulId).show(); //ul显示
- 	 	});
- 		$("#"+target_boxId).mouseleave(function(){
-			$("#"+target_sonulId).hide(); //ul隐藏
-	 	});
- 	}
-
 	//获取省份信息
 	if($("#cn").val() != undefined){
 		if($("#cn").val() == "省"){
 			$("#cn").val("");
 		}
-		initSelectUlData("cn_son_ul","省","/ssp_web/back/main/ap/apmac/cn","province","cnul_span","cnul_box","cn",null);
+		$("#cnul_span").on("click",function(){
+	 		$("#cn_son_ul").empty();
+	 		$('#cn_son_ul').css({height:"auto",overflow:"hidden"});
+	 		$("#cn_son_ul").append("<li value='-1'>省</li>");
+	 		
+		 		var url = "/ssp_web/back/main/ap/apmac/cn";
+		 		$.getJSON( url, function(data){
+					var data_1 = data.province;
+					//alert(data_1);
+					$.each( data_1, function( key, val ) {
+						$("#cn_son_ul").append('<li>' + val + '</li>');
+					});
+					$('#cn_son_ul').show(); //ul显示
+					if($('#cn_son_ul').height()>210){
+						$('#cn_son_ul').css({"height":"210"+"px","overflow-y":"scroll","overflow-x":"hidden","z-index":"9999" });
+					};
+				});	
+	 		
+	 	});		
 		$("ul#cn_son_ul li").live("click",function(){
 	 		$("#cnul_span").html($(this).html());
 	 		if($(this).html() == "省"){