Browse Source

热点管理的用户场景对应关系的更新

you.chen 9 years ago
parent
commit
9430789f8f

+ 10 - 2
src/main/java/com/cloudcross/ssp/model/PlaceOperator.java

@@ -11,6 +11,8 @@ public class PlaceOperator {
 	private Long id;
 	//数据场景id
 	private Long operatorId;
+	//运营商名称
+	private String operatorName;
 	//运营商自定义场景名称
 	private String name;
 	//标准场景id
@@ -18,6 +20,12 @@ public class PlaceOperator {
 	//标准场景名称
 	private String placeName;
 	
+	public String getOperatorName() {
+		return operatorName;
+	}
+	public void setOperatorName(String operatorName) {
+		this.operatorName = operatorName;
+	}
 	public String getPlaceName() {
 		return placeName;
 	}
@@ -52,8 +60,8 @@ public class PlaceOperator {
 	@Override
 	public String toString() {
 		return "PlaceOperator [id=" + id + ", operatorId=" + operatorId
-				+ ", name=" + name + ", placeId=" + placeId + ", placeName="
-				+ placeName + "]";
+				+ ", operatorName=" + operatorName + ", name=" + name
+				+ ", placeId=" + placeId + ", placeName=" + placeName + "]";
 	}
 	
 	

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

@@ -20,29 +20,29 @@
 	
 	<select id="countByParams" parameterType="map" resultType="int">
 		select count(o.id)
-		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})
+		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="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
-		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})
+		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}
 		</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
-		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})
+		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}
 		</if>
 	</select>
 	

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

@@ -176,8 +176,7 @@ public class ApmacController extends SimpleController {
 	}
 	
 	/**
-	 * 前端传递一个媒体的id(变量名为selectedOperatorId),默认为全部
-	 * 需要传递一个搜索的参数,可以按场景(name)搜索和数据场景(placeName)搜索
+	 * 前端传递一个媒体的名称(变量名称为operatorName),默认为空值
 	 * @param model
 	 * @param page
 	 * @return
@@ -185,30 +184,24 @@ public class ApmacController extends SimpleController {
 	@RequestMapping("/relationship")
 	public String relationship(Model model, @RequestParam HashMap<String, Object> paramMap,
 			@RequestParam(defaultValue = "1") int page) {
-		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);
+			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("operatorId", operatorId);
-		paramMap.put("operatorName", operatorName);
+		paramMap.put("operatorName", SqlHelper.doLike(operatorName));
 		int totalRow = 0;
 		Pager pager = null;
 		pager = new Pager();