Browse Source

单位客户查询性能优化

anderx 7 years ago
parent
commit
be588022a9

+ 3 - 5
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -330,16 +330,14 @@
 			dg1.name as province,
 			dg2.name as city, 
 			dg3.name as area,
-			d.name as adminName,
-			a.share_type as shareType,
-			e.name as informationMaintainer		
+			a.aid,
+			a.share_type,
+			a.information_maintainer as mid 		
 		from user a 
 		left join organization_identity b on a.id = b.uid
 		left join district_glossory dg1 on b.location_province = dg1.id
 		left join district_glossory dg2 on b.location_city = dg2.id
 		left join district_glossory dg3 on b.location_area = dg3.id
-		left join admin d on a.aid = d.id 
-		left join admin e on a.information_maintainer=e.id
 		where a.type = 1 and a.status != 1
 		<if test="aid != null and aid !=''">
 			and a.aid = #{aid,jdbcType=VARCHAR}

+ 10 - 0
src/main/java/com/goafanti/customer/bo/CustomerListOut.java

@@ -48,6 +48,8 @@ public class CustomerListOut extends CustomerListIn{
 	
 	private String shareType;
 	
+	private String mid;
+	
 	public String getAuditOpinion() {
 		return auditOpinion;
 	}
@@ -174,4 +176,12 @@ public class CustomerListOut extends CustomerListIn{
 	public void setShareType(String shareType) {
 		this.shareType = shareType;
 	}
+
+	public String getMid() {
+		return mid;
+	}
+
+	public void setMid(String mid) {
+		this.mid = mid;
+	}
 }

+ 6 - 3
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.BusinessGlossoryMapper;
 import com.goafanti.common.dao.BusinessProjectMapper;
 import com.goafanti.common.dao.OrganizationContactBookMapper;
@@ -93,6 +94,8 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	private BusinessProjectMapper businessProjectMapper;
 	@Resource
 	private UserLockReleaseMapper userLockReleaseMapper;
+	@Resource
+	private AdminMapper	adminMapper;
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listPrivatePersonalCustomer(CustomerListIn cli, Integer pageNo,Integer pageSize) {
@@ -166,9 +169,9 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		Pagination<CustomerListOut> p=(Pagination<CustomerListOut>) findPage("selectOrganizationCustomerList","selectOrganizationCustomerCount",params,pageNo,pageSize);
 		List<CustomerListOut> l=(List<CustomerListOut>) p.getList();
 		for (CustomerListOut c : l) {
-			if (c.getShareType().equals("1")) {
-				c.setAdminName("暂无");
-			}
+			if (c.getShareType().equals("1"))c.setAdminName("暂无");
+			if(null!=c.getAid())c.setAdminName(adminMapper.selectNameByid(c.getAid()));
+			if(null!=c.getMid())c.setInformationMaintainer(adminMapper.selectNameByid(c.getMid()));
 		}
 		return p; 
 	}