Browse Source

添加排序功能

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

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

@ -5,80 +5,106 @@
<select id="selectListUserDataRank" resultType="com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO"> <select id="selectListUserDataRank" resultType="com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO">
SELECT SELECT
t1.*, t1.*,
t1.userCount - t1.partyMemberCount AS residentCount, t1.userCount - t1.partyMemberCount AS residentCount,
t1.oldCount / t1.userCount oldPercent, t1.oldCount / t1.userCount oldPercent,
t1.youngCount / t1.userCount youngPercent t1.youngCount / t1.userCount youngPercent
FROM FROM
( SELECT ( SELECT
t.streetName, t.streetId, t.streetName, t.streetId,
COUNT( t.userId ) userCount, COUNT( t.userId ) userCount,
count( t.SEX = '1' OR NULL ) maleCount, count( t.SEX = '1' OR NULL ) maleCount,
count( t.SEX = '0' OR NULL ) femaleCount, count( t.SEX = '0' OR NULL ) femaleCount,
count( t.SEX = '2' OR NULL ) unknownSexCount, count( t.SEX = '2' OR NULL ) unknownSexCount,
COUNT( t.PARTY_FLAG = '1' OR NULL ) partyMemberCount, COUNT( t.PARTY_FLAG = '1' OR NULL ) partyMemberCount,
COUNT( t.age > 50 OR NULL ) oldCount, COUNT( t.age > 50 OR NULL ) oldCount,
COUNT( ( t.age &lt;= 50 AND t.age > 0 ) OR NULL ) youngCount COUNT( ( t.age &lt;= 50 AND t.age > 0 ) OR NULL ) youngCount
FROM ( FROM (
SELECT SELECT
uu.ID AS userId, uu.ID AS userId,
CASE WHEN uu.SEX != '0' AND uu.SEX != '1' THEN '2' ELSE uu.SEX END AS SEX, CASE WHEN uu.SEX != '0' AND uu.SEX != '1' THEN '2' ELSE uu.SEX END AS SEX,
uu.STATE, uu.PARTY_FLAG, uu.DEPT_ID, uu.STATE, uu.PARTY_FLAG, uu.DEPT_ID,
IFNULL( TIMESTAMPDIFF( YEAR, uu.BIRTHDAY, CURDATE()), 0 ) age, IFNULL( TIMESTAMPDIFF( YEAR, uu.BIRTHDAY, CURDATE()), 0 ) age,
ad2.`name` streetName, ad2.id streetId ad2.`name` streetName, ad2.id streetId
FROM FROM
esua_epdc_user.epdc_user uu esua_epdc_user.epdc_user uu
LEFT JOIN esua_epdc_admin.sys_dept ad ON uu.DEPT_ID = ad.ID AND ad.type_key = 'grid_party' LEFT JOIN esua_epdc_admin.sys_dept ad ON uu.DEPT_ID = ad.ID AND ad.type_key = 'grid_party'
LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id
LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad1.pid = ad2.id LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad1.pid = ad2.id
WHERE uu.DEL_FLAG = '0' WHERE uu.DEL_FLAG = '0'
<if test='partyFlag != null and partyFlag = "1"'>AND uu.PARTY_FLAG = '1'</if> <if test='partyFlag != null and partyFlag = "1"'>AND uu.PARTY_FLAG = '1'</if>
<choose> <choose>
<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
</if> <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach>
</otherwise> </if>
</choose> </otherwise>
/*待补充按时间筛选*/ </choose>
<if test="startTime != null and endTime != null and endTime != ''"> /*待补充按时间筛选*/
AND uu.CREATED_TIME BETWEEN #{startTime} <if test="startTime != null and endTime != null and endTime != ''">
AND #{endTime} AND uu.CREATED_TIME BETWEEN #{startTime}
</if> AND #{endTime}
AND ad.id IS NOT NULL </if>
) t AND ad.id IS NOT NULL
GROUP BY t.streetId ) t
) t1 <choose>
/*待补充排序功能 order by t1.oldCount asc */ <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> </select>
<select id="selectListPartyAuthFailureCountByStreetId" <select id="selectListPartyAuthFailureCountByStreetId"
resultType="com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO"> resultType="com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO">
SELECT SELECT
ad2.id AS streetId, ad2.id AS streetId,
COUNT( DISTINCT uf.USER_ID ) partyAuthFailureCount COUNT( DISTINCT uf.USER_ID ) partyAuthFailureCount
FROM FROM
esua_epdc_user.epdc_user uu esua_epdc_user.epdc_user uu
LEFT JOIN esua_epdc_user.epdc_party_authentication_failed uf ON uu.id = uf.user_id LEFT JOIN esua_epdc_user.epdc_party_authentication_failed uf ON uu.id = uf.user_id
LEFT JOIN esua_epdc_admin.sys_dept ad ON uu.DEPT_ID = ad.ID LEFT JOIN esua_epdc_admin.sys_dept ad ON uu.DEPT_ID = ad.ID
AND ad.type_key = 'grid_party' AND ad.type_key = 'grid_party'
LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id
LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad1.pid = ad2.id LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad1.pid = ad2.id
WHERE WHERE
uu.DEL_FLAG = '0' uu.DEL_FLAG = '0'
AND uu.PARTY_FLAG = '0' AND uu.PARTY_FLAG = '0'
AND ad.id IS NOT NULL AND ad.id IS NOT NULL
<if test="streetIdList != null and streetIdList.size() > 0"> <if test="streetIdList != null and streetIdList.size() > 0">
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>
@ -112,18 +138,19 @@
<!--新闻数--> <!--新闻数-->
<select id="selectListNewsCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO"> <select id="selectListNewsCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT SELECT
COUNT(nn.ID) newsCount,nn.DEPT_ID gridId COUNT(nn.ID) newsCount,nn.DEPT_ID gridId
FROM FROM
esua_epdc_news.epdc_news nn esua_epdc_news.epdc_news nn
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
</if> <foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
<if test="startTime != null and endTime != null and endTime != ''"> </if>
AND nn.CREATED_TIME BETWEEN #{startTime} <if test="startTime != null and endTime != null and endTime != ''">
AND #{endTime} AND nn.CREATED_TIME BETWEEN #{startTime}
</if> AND #{endTime}
</if>
GROUP BY nn.DEPT_ID GROUP BY nn.DEPT_ID
</select> </select>
@ -131,18 +158,19 @@
<!--通知数--> <!--通知数-->
<select id="selectListNoticeCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO"> <select id="selectListNoticeCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT SELECT
COUNT(nn.ID) newsCount,nn.DEPT_ID gridId COUNT(nn.ID) newsCount,nn.DEPT_ID gridId
FROM FROM
esua_epdc_news.epdc_notice nn esua_epdc_news.epdc_notice nn
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
</if> <foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
<if test="startTime != null and endTime != null and endTime != ''"> </if>
AND nn.CREATED_TIME BETWEEN #{startTime} <if test="startTime != null and endTime != null and endTime != ''">
AND #{endTime} AND nn.CREATED_TIME BETWEEN #{startTime}
</if> AND #{endTime}
</if>
GROUP BY nn.DEPT_ID GROUP BY nn.DEPT_ID
</select> </select>
@ -150,18 +178,19 @@
<!--议题数--> <!--议题数-->
<select id="selectListEventCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO"> <select id="selectListEventCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT SELECT
epen.GRID_ID gridId, COUNT( epen.ID ) eventCount epen.GRID_ID gridId, COUNT( epen.ID ) eventCount
FROM FROM
esua_epdc_events.epdc_events epen esua_epdc_events.epdc_events epen
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
</if> <foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
<if test="startTime != null and endTime != null and endTime != ''"> </if>
AND epen.CREATED_TIME BETWEEN #{startTime} <if test="startTime != null and endTime != null and endTime != ''">
AND #{endTime} AND epen.CREATED_TIME BETWEEN #{startTime}
</if> AND #{endTime}
</if>
GROUP BY epen.GRID_ID GROUP BY epen.GRID_ID
</select> </select>
@ -169,60 +198,63 @@
<!--项目数--> <!--项目数-->
<select id="selectListItemCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO"> <select id="selectListItemCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT SELECT
epen.GRID_ID gridId, epen.GRID_ID gridId,
COUNT( epen.ID ) itemCount, COUNT( epen.ID ) itemCount,
count(epen.ITEM_STATE = '10' or null) itemCloseCount count(epen.ITEM_STATE = '10' or null) itemCloseCount
FROM FROM
esua_epdc_events.epdc_item epen esua_epdc_events.epdc_item epen
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
</if> <foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
<if test="startTime != null and endTime != null and endTime != ''"> </if>
AND epen.CREATED_TIME BETWEEN #{startTime} <if test="startTime != null and endTime != null and endTime != ''">
AND #{endTime} AND epen.CREATED_TIME BETWEEN #{startTime}
</if> AND #{endTime}
</if>
GROUP BY epen.GRID_ID GROUP BY epen.GRID_ID
</select> </select>
<!--社群数--> <!--社群数-->
<select id="selectListCommunityCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO"> <select id="selectListCommunityCount" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT SELECT
epgr.GRID_ID gridId, epgr.GRID_ID gridId,
COUNT( DISTINCT epgr.ID ) communityCount, COUNT( DISTINCT epgr.ID ) communityCount,
COUNT( DISTINCT ug.user_id ) communityMemberCount, COUNT( DISTINCT ug.user_id ) communityMemberCount,
COUNT( DISTINCT ut.ID ) communityTopicCount COUNT( DISTINCT ut.ID ) communityTopicCount
FROM FROM
esua_epdc_group.epdc_group epgr esua_epdc_group.epdc_group epgr
LEFT JOIN esua_epdc_group.epdc_user_group ug ON epgr.id = ug.group_id AND ug.DEL_FLAG = '0' LEFT JOIN esua_epdc_group.epdc_user_group ug ON epgr.id = ug.group_id AND ug.DEL_FLAG = '0'
LEFT JOIN esua_epdc_group.epdc_topic ut ON epgr.id = ut.group_id AND ut.DEL_FLAG = '0' LEFT JOIN esua_epdc_group.epdc_topic ut ON epgr.id = ut.group_id AND ut.DEL_FLAG = '0'
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
</if> <foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
<if test="startTime != null and endTime != null and endTime != ''"> </if>
AND epgr.CREATED_TIME BETWEEN #{startTime} <if test="startTime != null and endTime != null and endTime != ''">
AND #{endTime} AND epgr.CREATED_TIME BETWEEN #{startTime}
</if> AND #{endTime}
</if>
GROUP BY epgr.GRID_ID GROUP BY epgr.GRID_ID
</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,
t.residentCount - t.partyMemberCount residentCount t.residentCount - t.partyMemberCount residentCount
FROM FROM
( (
SELECT SELECT
COUNT( u.ID ) userCount, COUNT( u.ID ) userCount,
COUNT( u.STATE != '0' OR NULL ) residentCount, COUNT( u.STATE != '0' OR NULL ) residentCount,
COUNT( u.party_flag = '1' OR NULL ) partyMemberCount COUNT( u.party_flag = '1' OR NULL ) partyMemberCount
FROM FROM
esua_epdc_user.epdc_user u esua_epdc_user.epdc_user u
LEFT JOIN esua_epdc_admin.sys_dept ad ON u.DEPT_ID = ad.ID LEFT JOIN esua_epdc_admin.sys_dept ad ON u.DEPT_ID = ad.ID
AND ad.type_key = 'grid_party' AND ad.type_key = 'grid_party'
LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id
@ -231,7 +263,7 @@
u.DEL_FLAG = '0' u.DEL_FLAG = '0'
AND ad.id IS NOT NULL AND ad.id IS NOT NULL
<if test="deptIdList != null and deptIdList.size() > 0"> <if test="deptIdList != null and deptIdList.size() > 0">
and ad2.ID in and ad2.ID in
<foreach item="deptIdItem" collection="deptIdList" open="(" separator="," close=")"> <foreach item="deptIdItem" collection="deptIdList" open="(" separator="," close=")">
#{deptIdItem} #{deptIdItem}
</foreach> </foreach>
@ -242,20 +274,21 @@
)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
FROM FROM
esua_epdc_admin.sys_dept ad esua_epdc_admin.sys_dept ad
LEFT JOIN esua_epdc_admin.epdc_dept_ma_code ac ON ad.id = ac.GRID_ID LEFT JOIN esua_epdc_admin.epdc_dept_ma_code ac ON ad.id = ac.GRID_ID
LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad.pid = ad1.id
LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad1.pid = ad2.id LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad1.pid = ad2.id
WHERE WHERE
ad.type_key = 'grid_party' ad.type_key = 'grid_party'
<if test="deptIdList != null and deptIdList.size() > 0"> <if test="deptIdList != null and deptIdList.size() > 0">
and ad2.ID in and ad2.ID in
<foreach item="deptIdItem" collection="deptIdList" open="(" separator="," close=")"> <foreach item="deptIdItem" collection="deptIdList" open="(" separator="," close=")">
#{deptIdItem} #{deptIdItem}
</foreach> </foreach>
@ -265,7 +298,7 @@
AND ad2.id = #{formDto.deptId} AND ad2.id = #{formDto.deptId}
</if> </if>
ORDER BY ORDER BY
ad.create_date ASC ad.create_date ASC
</select> </select>
<select id="userRegisterSort" <select id="userRegisterSort"
resultType="com.elink.esua.epdc.dto.user.result.UserSortRankResultDTO"> resultType="com.elink.esua.epdc.dto.user.result.UserSortRankResultDTO">
@ -292,7 +325,7 @@
uu.DEL_FLAG = '0' uu.DEL_FLAG = '0'
AND ad.id IS NOT NULL AND ad.id IS NOT NULL
<if test="deptIdList != null and deptIdList.size() > 0"> <if test="deptIdList != null and deptIdList.size() > 0">
and ad2.ID in and ad2.ID in
<foreach item="deptIdItem" collection="deptIdList" open="(" separator="," close=")"> <foreach item="deptIdItem" collection="deptIdList" open="(" separator="," close=")">
#{deptIdItem} #{deptIdItem}
</foreach> </foreach>
@ -322,50 +355,53 @@
<select id="selectListGridHasMaCode" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO"> <select id="selectListGridHasMaCode" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT SELECT
ad.id gridId, ad.id gridId,
CONCAT( ad2.`name`, '-', ad1.`name`, '-', ad.`name` ) AS allDeptName, CONCAT( ad2.`name`, '-', ad1.`name`, '-', ad.`name` ) AS allDeptName,
GROUP_CONCAT( DISTINCT u.real_name ) gridLeader GROUP_CONCAT( DISTINCT u.real_name ) gridLeader
FROM FROM
esua_epdc_admin.sys_dept ad esua_epdc_admin.sys_dept ad
LEFT JOIN esua_epdc_admin.epdc_dept_ma_code ama ON ad.id = ama.GRID_ID AND ama.DEL_FLAG = '0' LEFT JOIN esua_epdc_admin.epdc_dept_ma_code ama ON ad.id = ama.GRID_ID AND ama.DEL_FLAG = '0'
LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad1.id = ad.pid LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad1.id = ad.pid
LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad2.id = ad1.pid LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad2.id = ad1.pid
LEFT JOIN esua_epdc_admin.sys_role_data_scope ards ON ards.dept_id = ad.id LEFT JOIN esua_epdc_admin.sys_role_data_scope ards ON ards.dept_id = ad.id
LEFT JOIN esua_epdc_admin.sys_role r ON ards.role_id = r.id AND r.DEL_FLAG = 0 and r.type_key = 'gridLeader' LEFT JOIN esua_epdc_admin.sys_role r ON ards.role_id = r.id AND r.DEL_FLAG = 0 and r.type_key = 'gridLeader'
LEFT JOIN esua_epdc_admin.sys_role_user ru ON r.id = ru.role_id LEFT JOIN esua_epdc_admin.sys_role_user ru ON r.id = ru.role_id
LEFT JOIN esua_epdc_admin.sys_user u ON ru.user_id = u.id AND u.del_flag = 0 LEFT JOIN esua_epdc_admin.sys_user u ON ru.user_id = u.id AND u.del_flag = 0
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="gridId != null and grid != ''">and (ad1.id = #{gridId} or ad2.id = #{gridId})</if> <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 GROUP BY
ad.id ad.id
ORDER BY ORDER BY
ama.CREATED_TIME DESC, ama.CREATED_TIME DESC,
ad.create_date DESC ad.create_date DESC
</select> </select>
<select id="selectListReigistData" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO"> <select id="selectListReigistData" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT SELECT
t.DEPT_ID, COUNT( t.ID ) registerCount, t.DEPT_ID, COUNT( t.ID ) registerCount,
COUNT(t.PARTY_FLAG = '0' OR NULL) residentCount, COUNT(t.PARTY_FLAG = '0' OR NULL) residentCount,
COUNT(t.PARTY_FLAG = '1' OR NULL) partyCount COUNT(t.PARTY_FLAG = '1' OR NULL) partyCount
FROM ( FROM (
SELECT SELECT
uu.ID, uu.DEPT_ID, uu.STATE, uu.PARTY_FLAG uu.ID, uu.DEPT_ID, uu.STATE, uu.PARTY_FLAG
FROM FROM
esua_epdc_user.epdc_user uu esua_epdc_user.epdc_user uu
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
</if> <foreach item="item" collection="gridIdList" open="(" separator="," close=")">#{item}</foreach>
<if test="startTime != null and endTime != null and endTime != ''"> </if>
AND uu.CREATED_TIME BETWEEN #{startTime} <if test="startTime != null and endTime != null and endTime != ''">
AND #{endTime} AND uu.CREATED_TIME BETWEEN #{startTime}
</if> AND #{endTime}
AND uu.DEPT_ID IS NOT NULL </if>
) t AND uu.DEPT_ID IS NOT NULL
) t
GROUP BY t.DEPT_ID GROUP BY t.DEPT_ID
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save