Browse Source

居民排行sql语句修改

dev
yujintao 6 years ago
parent
commit
471ea1718c
  1. 34
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml

34
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml

@ -9,8 +9,8 @@
t1.userCount - t1.partyMemberCount AS residentCount,
t1.oldCount / t1.userCount oldPercent,
t1.youngCount / t1.userCount youngPercent
FROM
( SELECT
FROM (
SELECT
t.streetName, t.streetId,
COUNT( t.userId ) userCount,
count( t.SEX = '1' OR NULL ) maleCount,
@ -42,45 +42,29 @@
</if>
</otherwise>
</choose>
/*待补充按时间筛选*/
<if test="startTime != null and endTime != null and endTime != ''">
AND uu.CREATED_TIME BETWEEN #{startTime}
AND #{endTime}
AND uu.CREATED_TIME BETWEEN #{startTime} AND #{endTime}
</if>
AND ad.id IS NOT NULL
) t
) t1
<choose>
<when test='category != null and category == "0"'>
where
t.age>=50
GROUP BY t.streetId
order by COUNT( t.age > 50 OR NULL ) desc
order by t1.oldCount desc
</when>
<when test='category != null and category == "1"'>
where
t.age &lt; 50
GROUP BY t.streetId
order by COUNT( ( t.age &lt;= 50 AND t.age > 0 ) OR NULL ) desc
order by t1.youngCount desc
</when>
<when test='category != null and category == "2"'>
where
t.age>=50
GROUP BY t.streetId
order by COUNT( t.age > 50 OR NULL ) asc
order by t1.oldCount asc
</when>
<when test='category != null and category == "3"'>
where
t.age &lt; 50
GROUP BY t.streetId
order by COUNT( t.age > 50 OR NULL ) asc
order by t1.youngCount asc
</when>
<otherwise>
GROUP BY t.streetId
GROUP BY t1.streetId
</otherwise>
</choose>
) t1
/*待补充排序功能 order by t1.oldCount asc */
</select>
<select id="selectListPartyAuthFailureCountByStreetId"

Loading…
Cancel
Save