Просмотр исходного кода

部门客户资料列表查询

anderx лет назад: 7
Родитель
Сommit
71bcaea386
1 измененных файлов с 45 добавлено и 17 удалено
  1. 45 17
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

+ 45 - 17
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -1685,7 +1685,8 @@
 			on b.location_province=c.id left join district_glossory c1 
 			on b.location_city=c1.id left join district_glossory c2 
 			on b.location_area=c2.id left join industry_category d on b.industry = d.id
-			where a.information_maintainer = #{aid,jdbcType=VARCHAR}
+			where  a.status=0
+			a.information_maintainer = #{aid,jdbcType=VARCHAR}
 			<if test="type !=null and type!=''">
 			and a.`type`=#{type,jdbcType=VARCHAR}
 			</if>
@@ -1774,21 +1775,37 @@
 	
 	
 		<select id="selectDepCustomerInformationList" resultType="com.goafanti.customer.bo.CustomerListIn">
-		select a.id,a.nickname as name,c.name as province,c1.name as city,c2.name as area,b.contacts,b.contact_mobile as contactMobile,
-			date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,d.name as industry,a.credit_rating as creditRating
-			from user a left join organization_identity b 
-			on a.id=b.uid left join district_glossory c 
-			on b.location_province=c.id left join district_glossory c1 
-			on b.location_city=c1.id left join district_glossory c2 
-			on b.location_area=c2.id left join industry_category d 
-			on b.industry = d.id inner join (select id
-			from admin
-			where id=   #{aid,jdbcType=VARCHAR}
-			or superior_id=  #{aid,jdbcType=VARCHAR}
-			) y
-			on y.id=a.information_maintainer
-			where 1=1
-			<if test="type !=null and type!=''">
+		select x.id,
+x.name,
+x.province,
+x.city,
+x.area ,
+x.contacts,
+x.contact_mobile as contactMobile,
+date_format( x.create_time, '%Y-%m-%d %H:%i:%S' ) as createTime,
+x.industry as industry,
+x.credit_rating as creditRating
+from(
+select
+	a.id,
+	a.nickname as name,
+	c.name as province,
+	c1.name as city,
+	c2.name as area,
+	b.contacts,
+	b.contact_mobile,
+	a.create_time,
+	d.name as industry,
+	a.credit_rating ,
+	a.information_maintainer
+from
+	user a left join organization_identity b on
+	a.id = b.uid left join district_glossory c 
+	on b.location_province=c.id left join district_glossory c1 
+	on b.location_city=c1.id left join district_glossory c2 
+	on b.location_area=c2.id left join industry_category d 
+	on b.industry = d.id 
+		<if test="type !=null and type!=''">
 			and a.`type`=#{type,jdbcType=VARCHAR}
 			</if>
 			<if test="name!=null and name!=''">
@@ -1825,7 +1842,18 @@
 			and a.accomplish_situation is not null
 			and a.credit_rating is not null
 			</if>
-		 order by a.create_time desc
+		 order by a.create_time,a.nickname desc
+)x
+inner join(
+		select
+			id
+		from
+			admin
+		where
+			id = #{aid,jdbcType=VARCHAR}
+			or superior_id = #{aid,jdbcType=VARCHAR}
+	) y on
+	y.id = x.information_maintainer
 		 <if test="page_sql != null">
     		${page_sql}
    		 </if>