Browse Source

查询民警时添加排序

hotfix/yujt_opt
yujt 5 years ago
parent
commit
6a2b72f043
  1. 66
      epdc-cloud-property/src/main/resources/mapper/police/PoliceDao.xml

66
epdc-cloud-property/src/main/resources/mapper/police/PoliceDao.xml

@ -50,56 +50,25 @@
</select>
<select id="selectPoliceGroupInfo" resultType="com.elink.esua.epdc.dto.police.result.PoliceResultDTO">
SELECT
eg.id AS GROUP_ID,
eg.GROUP_NAME,
eg.GROUP_AVATAR,
SUM(
CASE
WHEN eu.STATE = '10' THEN
1
ELSE
0
END
) AS NUMBER_GROUP_MEMBER,
SUM(
CASE
WHEN eu.PARTY_MEMBER = '1'
AND eu.STATE = '10' THEN
1
ELSE
0
END
) AS NUMBER_GROUP_PARTY_MEMBER,
SUM(
CASE
WHEN eu.USER_ID = #{userId}
AND eu.STATE = '0' THEN
1
WHEN eu.USER_ID = #{userId}
AND eu.STATE = '10' THEN
2
ELSE
0
END
) AS GROUP_MEMBER_FLAG,
eg.STATE AS GROUP_STATE
eg.id AS GROUP_ID,
eg.GROUP_NAME,
eg.GROUP_AVATAR,
SUM( CASE WHEN eu.STATE = '10' THEN 1 ELSE 0 END ) AS NUMBER_GROUP_MEMBER,
SUM( CASE WHEN eu.PARTY_MEMBER = '1' AND eu.STATE = '10' THEN 1 ELSE 0 END ) AS NUMBER_GROUP_PARTY_MEMBER,
SUM( CASE WHEN eu.USER_ID = #{userId} AND eu.STATE = '0' THEN 1 WHEN eu.USER_ID = #{userId} AND eu.STATE = '10' THEN 2 ELSE 0 END ) AS GROUP_MEMBER_FLAG,
eg.STATE AS GROUP_STATE
FROM
epdc_group eg
LEFT JOIN epdc_user_group eu ON eg.id = eu.GROUP_ID
AND eu.DEL_FLAG = '0'
epdc_group eg
LEFT JOIN epdc_user_group eu ON eg.id = eu.GROUP_ID AND eu.DEL_FLAG = '0'
WHERE
eg.DEL_FLAG = '0'
AND eg.GROUP_CATEGORY = '3'
AND (
eg.STATE = '10'
OR eg.STATE = '15'
)
<if test="gridId != null and gridId != ''">
AND (eg.GRID_ID = #{gridId}
OR find_in_set(#{gridId},eg.ALL_DEPT_IDS))
</if>
GROUP BY
eg.ID
eg.DEL_FLAG = '0'
AND eg.GROUP_CATEGORY = '3'
AND ( eg.STATE = '10' OR eg.STATE = '15' )
<if test="gridId != null and gridId != ''">
AND (eg.GRID_ID = #{gridId}
OR find_in_set(#{gridId},eg.ALL_DEPT_IDS))
</if>
GROUP BY eg.ID
</select>
<select id="selectPoliceInfo" resultType="com.elink.esua.epdc.dto.police.result.PoliceInfoResultDTO">
@ -115,6 +84,7 @@
<if test="parentDeptIds != null and parentDeptIds != ''">
AND ALL_DEPT_IDS = #{parentDeptIds}
</if>
order by UPDATED_TIME desc
</select>
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.police.PoliceDTO">
SELECT

Loading…
Cancel
Save