Browse Source

添加排序功能

dev
曲树通 6 years ago
parent
commit
a28facd7d6
  1. 64
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml

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

@ -37,7 +37,8 @@
<when test="gridId != null and gridId != ''">AND ad2.ID = #{gridId}</when> <when test="gridId != null and gridId != ''">AND ad2.ID = #{gridId}</when>
<otherwise> <otherwise>
<if test="deptIdList != null and deptIdList.size() > 0"> <if test="deptIdList != null and deptIdList.size() > 0">
AND ad2.ID in <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach> AND ad2.ID in
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach>
</if> </if>
</otherwise> </otherwise>
</choose> </choose>
@ -48,7 +49,36 @@
</if> </if>
AND ad.id IS NOT NULL AND ad.id IS NOT NULL
) t ) t
<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
</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
</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
</when>
<when test='category != null and category == "3"'>
where
t.age &lt; 50
GROUP BY t.streetId GROUP BY t.streetId
order by COUNT( t.age > 50 OR NULL ) asc
</when>
<otherwise>
GROUP BY t.streetId
</otherwise>
</choose>
) t1 ) t1
/*待补充排序功能 order by t1.oldCount asc */ /*待补充排序功能 order by t1.oldCount asc */
</select> </select>
@ -73,10 +103,6 @@
and ad2.ID in and ad2.ID in
<foreach collection="streetIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach> <foreach collection="streetIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach>
</if> </if>
<if test="startTime != null and endTime != null and endTime != ''">
AND uu.CREATED_TIME BETWEEN #{startTime}
AND #{endTime}
</if>
GROUP BY GROUP BY
ad2.ID ad2.ID
</select> </select>
@ -118,7 +144,8 @@
WHERE WHERE
nn.DEL_FLAG = '0' nn.DEL_FLAG = '0'
<if test="gridIdList != null and gridIdList.size() > 0"> <if test="gridIdList != null and gridIdList.size() > 0">
AND nn.DEPT_ID in <foreach item="item" collection="gridIdList" open="(" separator="," close=")"> #{item} </foreach> AND nn.DEPT_ID in
<foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
</if> </if>
<if test="startTime != null and endTime != null and endTime != ''"> <if test="startTime != null and endTime != null and endTime != ''">
AND nn.CREATED_TIME BETWEEN #{startTime} AND nn.CREATED_TIME BETWEEN #{startTime}
@ -137,7 +164,8 @@
WHERE WHERE
nn.DEL_FLAG = '0' nn.DEL_FLAG = '0'
<if test="gridIdList != null and gridIdList.size() > 0"> <if test="gridIdList != null and gridIdList.size() > 0">
AND nn.DEPT_ID in <foreach item="item" collection="gridIdList" open="(" separator="," close=")"> #{item} </foreach> AND nn.DEPT_ID in
<foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
</if> </if>
<if test="startTime != null and endTime != null and endTime != ''"> <if test="startTime != null and endTime != null and endTime != ''">
AND nn.CREATED_TIME BETWEEN #{startTime} AND nn.CREATED_TIME BETWEEN #{startTime}
@ -156,7 +184,8 @@
WHERE WHERE
epen.DEL_FLAG = '0' AND epen.EVENT_STATE = '4' epen.DEL_FLAG = '0' AND epen.EVENT_STATE = '4'
<if test="gridIdList != null and gridIdList.size() > 0"> <if test="gridIdList != null and gridIdList.size() > 0">
AND epen.GRID_ID in <foreach item="item" collection="gridIdList" open="(" separator="," close=")"> #{item} </foreach> AND epen.GRID_ID in
<foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
</if> </if>
<if test="startTime != null and endTime != null and endTime != ''"> <if test="startTime != null and endTime != null and endTime != ''">
AND epen.CREATED_TIME BETWEEN #{startTime} AND epen.CREATED_TIME BETWEEN #{startTime}
@ -177,7 +206,8 @@
WHERE WHERE
epen.DEL_FLAG = '0' epen.DEL_FLAG = '0'
<if test="gridIdList != null and gridIdList.size() > 0"> <if test="gridIdList != null and gridIdList.size() > 0">
AND epen.GRID_ID in <foreach item="item" collection="gridIdList" open="(" separator="," close=")"> #{item} </foreach> AND epen.GRID_ID in
<foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
</if> </if>
<if test="startTime != null and endTime != null and endTime != ''"> <if test="startTime != null and endTime != null and endTime != ''">
AND epen.CREATED_TIME BETWEEN #{startTime} AND epen.CREATED_TIME BETWEEN #{startTime}
@ -200,7 +230,8 @@
WHERE WHERE
epgr.DEL_FLAG = '0' AND ( epgr.STATE = '10' OR epgr.STATE = '15' ) epgr.DEL_FLAG = '0' AND ( epgr.STATE = '10' OR epgr.STATE = '15' )
<if test="gridIdList != null and gridIdList.size() > 0"> <if test="gridIdList != null and gridIdList.size() > 0">
AND epgr.GRID_ID in <foreach item="item" collection="gridIdList" open="(" separator="," close=")"> #{item} </foreach> AND epgr.GRID_ID in
<foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
</if> </if>
<if test="startTime != null and endTime != null and endTime != ''"> <if test="startTime != null and endTime != null and endTime != ''">
AND epgr.CREATED_TIME BETWEEN #{startTime} AND epgr.CREATED_TIME BETWEEN #{startTime}
@ -210,7 +241,8 @@
</select> </select>
<select id="getUserStatistics" resultType="com.elink.esua.epdc.dto.user.result.UserAnalysisCountDTO" parameterType="com.elink.esua.epdc.dto.user.form.UserCountDTO"> <select id="getUserStatistics" resultType="com.elink.esua.epdc.dto.user.result.UserAnalysisCountDTO"
parameterType="com.elink.esua.epdc.dto.user.form.UserCountDTO">
SELECT SELECT
t.userCount, t.userCount,
t.partyMemberCount, t.partyMemberCount,
@ -242,7 +274,8 @@
)t )t
</select> </select>
<select id="getGridStatistics" resultType="com.elink.esua.epdc.dto.user.result.GriddingCountDTO" parameterType="com.elink.esua.epdc.dto.user.form.UserCountDTO"> <select id="getGridStatistics" resultType="com.elink.esua.epdc.dto.user.result.GriddingCountDTO"
parameterType="com.elink.esua.epdc.dto.user.form.UserCountDTO">
SELECT SELECT
COUNT( ad.id) gridTotle, COUNT( ad.id) gridTotle,
COUNT( ac.ID) gridCount COUNT( ac.ID) gridCount
@ -337,7 +370,9 @@
WHERE WHERE
ad.type_key = 'grid_party' ad.type_key = 'grid_party'
AND ad.del_flag = 0 AND ad.del_flag = 0
AND ama.ID IS NOT NULL AND ama.ID IS
<if test='category != null and category == "0"'>NOT</if>
NULL
<if test="gridId != null and grid != ''">and (ad1.id = #{gridId} or ad2.id = #{gridId})</if> <if test="gridId != null and grid != ''">and (ad1.id = #{gridId} or ad2.id = #{gridId})</if>
GROUP BY GROUP BY
ad.id ad.id
@ -358,7 +393,8 @@
WHERE WHERE
uu.DEL_FLAG = '0' uu.DEL_FLAG = '0'
<if test="gridIdList != null and gridIdList.size() > 0"> <if test="gridIdList != null and gridIdList.size() > 0">
AND uu.DEPT_ID in <foreach item="item" collection="gridIdList" open="(" separator="," close=")"> #{item} </foreach> AND uu.DEPT_ID in
<foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
</if> </if>
<if test="startTime != null and endTime != null and endTime != ''"> <if test="startTime != null and endTime != null and endTime != ''">
AND uu.CREATED_TIME BETWEEN #{startTime} AND uu.CREATED_TIME BETWEEN #{startTime}

Loading…
Cancel
Save