Sfoglia il codice sorgente

门户--用户(伙伴)搜索

Antiloveg 8 anni fa
parent
commit
9ed8baf313

+ 1 - 1
src/main/java/com/goafanti/common/mapper/CopyrightInfoMapper.xml

@@ -298,7 +298,7 @@
 	left join admin ad on ci.founder = ad.id
 	left join contract c on c.id = ci.contract_id
 	<if test="principal != null">
-	left join contract_log cl on ci.contract_id=cl.cid
+		left join contract_log cl on ci.contract_id=cl.cid
 	</if>
 	where ci.delete_sign = 0
 	<if test="principal != null">

+ 70 - 31
src/main/java/com/goafanti/common/mapper/OrganizationIdentityMapper.xml

@@ -1152,38 +1152,77 @@
 	
 	
 	<select id="findSearchSubscriberListByPage" parameterType="String" resultType="com.goafanti.portal.bo.OrgSubscriberListBo">
- 	SELECT 
-	 	x.uid, x.unitName, count(a.id) as achievementNum, 
-	 	count(d.id) as demandNum, x.identityId, x.logoUrl
-	FROM
-	(
-		SELECT
-			u.id as uid, oi.unit_name as unitName, u.number
-			oi.id as identityId, info.logo_url as logoUrl,
-			oi.licence_province 
+	 	SELECT 
+		 	x.uid, x.unitName, count(a.id) as achievementNum, 
+		 	count(d.id) as demandNum, x.identityId, x.logoUrl,
+		 	x.province
 		FROM
-			USER u
-		LEFT JOIN organization_identity oi ON oi.uid = u.id
-		LEFT JOIN organization_info info on info.uid = u.id
-		WHERE
-			u.type = 1
-		<if test="null != level and level==1 ">
-			AND u.lvl <![CDATA[ >= ]]> 1 
-		</if>
-		<if test="null !=level and level==0" >
-			AND u.lvl = 0
-		</if>
-		<if test="province != null">
-			AND ui.licence_province = #{province,jdbcType=VARCHAR}
+		(
+			SELECT
+				u.id as uid, oi.unit_name as unitName, u.number,
+				oi.id as identityId, info.logo_url as logoUrl,
+				oi.licence_province as province
+			FROM
+				USER u
+			LEFT JOIN organization_identity oi ON oi.uid = u.id
+			LEFT JOIN organization_info info on info.uid = u.id
+			WHERE
+				u.type = 1
+			<if test="null != level and level==1 ">
+				AND u.lvl <![CDATA[ >= ]]> 1 
+			</if>
+			<if test="null !=level and level==0" >
+				AND u.lvl = 0
+			</if>
+			<if test="province != null">
+				AND ui.licence_province = #{province,jdbcType=INTEGER}
+			</if>
+			<if test="field != null">
+				AND ui.field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
+			</if>
+		) x
+		LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
+		AND a.audit_status = 3 AND a.deleted_sign = 0
+		LEFT JOIN demand d ON d.employer_id = x.uid AND d.audit_status = 3
+		AND d.release_status = 1 AND d.deleted_sign = 0
+		GROUP BY
+			x.uid 
+		ORDER BY x.number 
+		<if test="page_sql!=null">
+			${page_sql}
 		</if>
-	) x
-	LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
-	AND a.audit_status = 3 AND a.deleted_sign = 0
-	LEFT JOIN demand d ON d.employer_id = x.uid AND d.audit_status = 3
-	AND d.release_status = 1 AND d.deleted_sign = 0
-	GROUP BY
-		x.uid 
-	ORDER BY x.number 
- </select>
+  </select>
+  
+  <select id="findSearchSubscriberCount" parameterType="String" resultType="java.lang.Integer">
+	 	SELECT 
+		 	count(DISTINCT(x.uid))
+		FROM
+		(
+			SELECT
+				u.id as uid
+			FROM
+				USER u
+			LEFT JOIN organization_identity oi ON oi.uid = u.id
+			LEFT JOIN organization_info info on info.uid = u.id
+			WHERE
+				u.type = 1
+			<if test="null != level and level==1 ">
+				AND u.lvl <![CDATA[ >= ]]> 1 
+			</if>
+			<if test="null !=level and level==0" >
+				AND u.lvl = 0
+			</if>
+			<if test="province != null">
+				AND ui.licence_province = #{province,jdbcType=INTEGER}
+			</if>
+			<if test="field != null">
+				AND ui.field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
+			</if>
+		) x
+		LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
+		AND a.audit_status = 3 AND a.deleted_sign = 0
+		LEFT JOIN demand d ON d.employer_id = x.uid AND d.audit_status = 3
+		AND d.release_status = 1 AND d.deleted_sign = 0
+  </select>
 
 </mapper>

+ 54 - 8
src/main/java/com/goafanti/common/mapper/UserIdentityMapper.xml

@@ -394,31 +394,77 @@
 	
  <select id="findSearchSubscriberListByPage" parameterType="String" resultType="com.goafanti.portal.bo.UserSubscriberListBo">
  	SELECT 
-	 	x.uid, x.unitName, count(a.id) as achievementNum, 
-	 	count(d.id) as demandNum
+	 	x.uid, x.username, count(a.id) as achievementNum, 
+	 	count(d.id) as demandNum, x.province,
+	 	x.personPortraitUrl, x.identityId
 	FROM
 	(
 		SELECT
-			u.id as uid, oi.unit_name as unitName, u.number
-			oi.id as identityId
+			u.id as uid, ui.username, u.number,
+			ui.id as identityId, ui.province,
+			info.person_portrait_url as personPortraitUrl
 		FROM
-			USER u
-		LEFT JOIN organization_identity oi ON oi.uid = u.id
+			user u
+		LEFT JOIN user_identity ui ON ui.uid = u.id
+		LEFT JOIN user_career uc ON uc.uid = u.id
+		LEFT JOIN user_info info ON info.uid = u.id
 		WHERE
-			u.type = 1
+			u.type = 0
 		<if test="null != level and level==1 ">
 			AND u.lvl <![CDATA[ >= ]]> 1 
 		</if>
 		<if test="null !=level and level==0" >
 			AND u.lvl = 0
 		</if>
+		<if test="province != null">
+			AND ui.province = #{province,jdbcType=INTEGER}
+		</if>
+		<if test="field != null">
+			AND uc.engaged_field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
+		</if>
 	) x
 	LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
 	AND a.audit_status = 3 AND a.deleted_sign = 0
 	LEFT JOIN demand d ON d.employer_id = x.uid AND d.audit_status = 3
 	AND d.release_status = 1 AND d.deleted_sign = 0
 	GROUP BY
-		(x.uid) ORDER BY (x.number) 
+		x.uid 
+	ORDER BY 
+		x.number
+	<if test="page_sql!=null">
+		${page_sql}
+	</if>
  </select>
+ 
+	 <select id="findSearchSubscriberCount" parameterType="String" resultType="java.lang.Integer">
+	 	SELECT 
+		 	count(distinct(x.uid))
+		FROM
+		(
+			SELECT
+				u.id as uid
+			FROM
+				user u
+			LEFT JOIN user_identity ui ON ui.uid = u.id
+			WHERE
+				u.type = 0
+			<if test="null != level and level==1 ">
+				AND u.lvl <![CDATA[ >= ]]> 1 
+			</if>
+			<if test="null !=level and level==0" >
+				AND u.lvl = 0
+			</if>
+			<if test="province != null">
+				AND ui.province = #{province,jdbcType=INTEGER}
+			</if>
+			<if test="field != null">
+				AND uc.engaged_field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
+			</if>
+		) x
+		LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
+		AND a.audit_status = 3 AND a.deleted_sign = 0
+		LEFT JOIN demand d ON d.employer_id = x.uid AND d.audit_status = 3
+		AND d.release_status = 1 AND d.deleted_sign = 0
+	 </select>
   
 </mapper>

+ 12 - 0
src/main/java/com/goafanti/portal/bo/OrgSubscriberListBo.java

@@ -13,6 +13,8 @@ public class OrgSubscriberListBo {
 
 	private String	logoUrl;
 
+	private Integer	province;
+
 	public String getUid() {
 		return uid;
 	}
@@ -61,4 +63,14 @@ public class OrgSubscriberListBo {
 		this.logoUrl = logoUrl;
 	}
 
+	public Integer getProvince() {
+		return province;
+	}
+
+	public void setProvince(Integer province) {
+		this.province = province;
+	}
+	
+	
+
 }

+ 71 - 2
src/main/java/com/goafanti/portal/bo/UserSubscriberListBo.java

@@ -1,7 +1,76 @@
 package com.goafanti.portal.bo;
 
 public class UserSubscriberListBo {
-	private String uid;
-	//private Integer 
+	private String	uid;
+
+	private String	identityId;
+
+	private String	username;
+
+	private String	personPortraitUrl;
+
+	private Integer	achievementNum;
+
+	private Integer	demandNum;
+
+	private String	province;
+
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+
+	public String getIdentityId() {
+		return identityId;
+	}
+
+	public void setIdentityId(String identityId) {
+		this.identityId = identityId;
+	}
+
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getPersonPortraitUrl() {
+		return personPortraitUrl;
+	}
+
+	public void setPersonPortraitUrl(String personPortraitUrl) {
+		this.personPortraitUrl = personPortraitUrl;
+	}
+
+	public Integer getAchievementNum() {
+		return achievementNum;
+	}
+
+	public void setAchievementNum(Integer achievementNum) {
+		this.achievementNum = achievementNum;
+	}
+
+	public Integer getDemandNum() {
+		return demandNum;
+	}
+
+	public void setDemandNum(Integer demandNum) {
+		this.demandNum = demandNum;
+	}
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+	
+	
 
 }

+ 4 - 7
src/main/java/com/goafanti/portal/controller/PortalSearchApiController.java

@@ -15,10 +15,7 @@ import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.enums.UserLevel;
 import com.goafanti.common.enums.UserType;
-import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.demand.service.DemandService;
-import com.goafanti.portal.bo.OrgSubscriberListBo;
-import com.goafanti.portal.bo.UserSubscriberListBo;
 import com.goafanti.user.service.OrganizationIdentityService;
 import com.goafanti.user.service.UserIdentityService;
 
@@ -79,7 +76,7 @@ public class PortalSearchApiController extends BaseApiController {
 	/**
 	 * 用户搜索
 	 */
-	@RequestMapping(value = "subscriberList", method = RequestMethod.GET)
+	@RequestMapping(value = "/subscriberList", method = RequestMethod.GET)
 	public Result subscriberSearchList(Integer level, Integer type, String field, Integer province,String pageNo, String pageSize) {
 		Result res = new Result();
 		if (null == type){
@@ -97,7 +94,7 @@ public class PortalSearchApiController extends BaseApiController {
 			return res;
 		}
 		Integer pNo = 1;
-		Integer pSize = 10;
+		Integer pSize = 2;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
@@ -105,9 +102,9 @@ public class PortalSearchApiController extends BaseApiController {
 			pNo = Integer.parseInt(pageNo);
 		}
 		if (UserType.PERSONAL.getCode().equals(type)){
-			Pagination<UserSubscriberListBo> pp = userIdentityService.listSubscriber(level, field, province, pNo, pSize);
+			res.setData(userIdentityService.listSubscriber(level, field, province, pNo, pSize));
 		} else {
-			Pagination<OrgSubscriberListBo> aa = organizationIdentityService.listSubscriber(level, field, province, pNo, pSize);
+			res.setData(organizationIdentityService.listSubscriber(level, field, province, pNo, pSize));
 		}
 		return res;
 	}