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>
<otherwise>
<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>
</otherwise>
</choose>
@ -48,7 +49,36 @@
</if>
AND ad.id IS NOT NULL
) 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
order by COUNT( t.age > 50 OR NULL ) asc
</when>
<otherwise>
GROUP BY t.streetId
</otherwise>
</choose>
) t1
/*待补充排序功能 order by t1.oldCount asc */
</select>
@ -73,10 +103,6 @@
and ad2.ID in
<foreach collection="streetIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach>
</if>
<if test="startTime != null and endTime != null and endTime != ''">
AND uu.CREATED_TIME BETWEEN #{startTime}
AND #{endTime}
</if>
GROUP BY
ad2.ID
</select>
@ -118,7 +144,8 @@
WHERE
nn.DEL_FLAG = '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 test="startTime != null and endTime != null and endTime != ''">
AND nn.CREATED_TIME BETWEEN #{startTime}
@ -137,7 +164,8 @@
WHERE
nn.DEL_FLAG = '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 test="startTime != null and endTime != null and endTime != ''">
AND nn.CREATED_TIME BETWEEN #{startTime}
@ -156,7 +184,8 @@
WHERE
epen.DEL_FLAG = '0' AND epen.EVENT_STATE = '4'
<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 test="startTime != null and endTime != null and endTime != ''">
AND epen.CREATED_TIME BETWEEN #{startTime}
@ -177,7 +206,8 @@
WHERE
epen.DEL_FLAG = '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 test="startTime != null and endTime != null and endTime != ''">
AND epen.CREATED_TIME BETWEEN #{startTime}
@ -200,7 +230,8 @@
WHERE
epgr.DEL_FLAG = '0' AND ( epgr.STATE = '10' OR epgr.STATE = '15' )
<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 test="startTime != null and endTime != null and endTime != ''">
AND epgr.CREATED_TIME BETWEEN #{startTime}
@ -210,7 +241,8 @@
</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
t.userCount,
t.partyMemberCount,
@ -242,7 +274,8 @@
)t
</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
COUNT( ad.id) gridTotle,
COUNT( ac.ID) gridCount
@ -337,7 +370,9 @@
WHERE
ad.type_key = 'grid_party'
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>
GROUP BY
ad.id
@ -358,7 +393,8 @@
WHERE
uu.DEL_FLAG = '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 test="startTime != null and endTime != null and endTime != ''">
AND uu.CREATED_TIME BETWEEN #{startTime}

Loading…
Cancel
Save