You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
238 lines
9.8 KiB
238 lines
9.8 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.elink.esua.epdc.dao.PartyMembersDao">
|
|
|
|
<resultMap type="com.elink.esua.epdc.entity.PartyMembersEntity" id="partyMembersMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="realName" column="REAL_NAME"/>
|
|
<result property="mobile" column="MOBILE"/>
|
|
<result property="identityNo" column="IDENTITY_NO"/>
|
|
<result property="post" column="POST"/>
|
|
<result property="postValue" column="POST_VALUE"/>
|
|
<result property="cadreFlag" column="CADRE_FLAG"/>
|
|
<result property="registFlag" column="REGIST_FLAG"/>
|
|
<result property="registTime" column="REGIST_TIME"/>
|
|
<result property="streetName" column="STREET_NAME"/>
|
|
<result property="streetId" column="STREET_ID"/>
|
|
<result property="communityName" column="COMMUNITY_NAME"/>
|
|
<result property="communityId" column="COMMUNITY_ID"/>
|
|
<result property="gridName" column="GRID_NAME"/>
|
|
<result property="gridId" column="GRID_ID"/>
|
|
<result property="deptId" column="DEPT_ID"/>
|
|
<result property="revision" column="REVISION"/>
|
|
<result property="createdBy" column="CREATED_BY"/>
|
|
<result property="createdTime" column="CREATED_TIME"/>
|
|
<result property="updatedBy" column="UPDATED_BY"/>
|
|
<result property="updatedTime" column="UPDATED_TIME"/>
|
|
<result property="delFlag" column="DEL_FLAG"/>
|
|
</resultMap>
|
|
<!--管理系统 列表-->
|
|
<select id="pageDIY" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
|
|
SELECT
|
|
pm.CADRE_FLAG,
|
|
pm.CREATED_BY,pm.CREATED_TIME,
|
|
pm.DEPT_ID,
|
|
pm.ID,pm.IDENTITY_NO,pm.MOBILE,pm.POST,
|
|
pm.POST_VALUE,pm.REAL_NAME,pm.REGIST_FLAG,pm.REGIST_TIME,
|
|
pm.REVISION,
|
|
pm.PARTY_ORGANIZATION,
|
|
GROUP_CONCAT( ut.TAG_NAME ) TAG_NAME,
|
|
pm.ALL_DEPT_NAMES as allDeptNames
|
|
FROM
|
|
epdc_party_members pm
|
|
LEFT JOIN epdc_party_tag_relation pt ON pm.ID = pt.PARTY_ID
|
|
LEFT JOIN epdc_user_tag ut ON pt.TAG_ID = ut.ID
|
|
AND ut.DEL_FLAG = '0'
|
|
WHERE
|
|
pm.DEL_FLAG = '0'
|
|
<if test="realName != null and realName != '' ">
|
|
and pm.REAL_NAME = #{realName}
|
|
</if>
|
|
<if test="mobile != null and mobile != '' ">
|
|
and pm.MOBILE = #{mobile}
|
|
</if>
|
|
|
|
<if test="streetId != '' and streetId != null">
|
|
AND (find_in_set(#{streetId},pm.PARENT_DEPT_IDS)
|
|
OR find_in_set(#{streetId},pm.ALL_DEPT_IDS))
|
|
</if>
|
|
<if test="communityId != '' and communityId != null">
|
|
AND (find_in_set(#{communityId},pm.PARENT_DEPT_IDS)
|
|
OR find_in_set(#{communityId},pm.ALL_DEPT_IDS))
|
|
</if>
|
|
<if test="gridId != '' and gridId != null">
|
|
and (pm.grid_id = #{gridId}
|
|
OR find_in_set(#{gridId},pm.ALL_DEPT_IDS))
|
|
</if>
|
|
<if test="identityNo != null and identityNo != '' ">
|
|
and pm.IDENTITY_NO = #{identityNo}
|
|
</if>
|
|
<if test="registFlag != null and registFlag != '' ">
|
|
and pm.REGIST_FLAG = #{registFlag}
|
|
</if>
|
|
<if test="postId != null and postId != '' ">
|
|
and pm.POST_ID = #{postId}
|
|
</if>
|
|
<if test="startTime != null and startTime != '' ">
|
|
and pm.REGIST_TIME >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != '' ">
|
|
<![CDATA[ and pm.REGIST_TIME <= ]]> #{endTime}
|
|
</if>
|
|
GROUP BY
|
|
pm.ID
|
|
ORDER BY
|
|
pm.CREATED_TIME DESC
|
|
</select>
|
|
|
|
<select id="hasAuthenticationPartyPage" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
|
|
SELECT
|
|
pm.CADRE_FLAG, pm.CREATED_BY,eu.CREATED_TIME, pm.DEPT_ID,
|
|
pm.ID,eu.IDENTITY_NO,eu.MOBILE,pm.POST,
|
|
pm.POST_VALUE,eu.REAL_NAME,pm.REGIST_FLAG,eu.REGISTER_TIME as registTime,
|
|
GROUP_CONCAT( ut.TAG_NAME ) TAG_NAME, eu.ALL_DEPT_NAMES as allDeptNames
|
|
FROM
|
|
epdc_user eu
|
|
LEFT JOIN epdc_party_members pm on pm.IDENTITY_NO = eu.IDENTITY_NO and pm.REAL_NAME = eu.REAL_NAME
|
|
LEFT JOIN epdc_party_tag_relation pt ON pm.ID = pt.PARTY_ID
|
|
LEFT JOIN epdc_user_tag ut ON pt.TAG_ID = ut.ID
|
|
AND ut.DEL_FLAG = '0'
|
|
WHERE
|
|
eu.PARTY_FLAG = '1' and eu.DEL_FLAG = '0'
|
|
<if test="realName != null and realName != '' ">and pm.REAL_NAME = #{realName}</if>
|
|
<if test="mobile != null and mobile != '' ">and pm.MOBILE = #{mobile}</if>
|
|
<if test="identityNo != null and identityNo != '' ">and pm.IDENTITY_NO = #{identityNo}</if>
|
|
<if test="registFlag != null and registFlag != '' ">and pm.REGIST_FLAG = #{registFlag}</if>
|
|
<if test="postId != null and postId != '' ">and pm.POST_ID = #{postId}</if>
|
|
<if test="startTime != null and startTime != '' ">and pm.REGIST_TIME >= #{startTime}</if>
|
|
<if test="endTime != null and endTime != '' "> <![CDATA[ and pm.REGIST_TIME <= ]]> #{endTime}</if>
|
|
<if test="streetId != '' and streetId != null">
|
|
AND (find_in_set(#{streetId},eu.PARENT_DEPT_IDS) OR find_in_set(#{streetId},eu.ALL_DEPT_IDS))
|
|
</if>
|
|
<if test="communityId != '' and communityId != null">
|
|
AND (find_in_set(#{communityId},eu.PARENT_DEPT_IDS) OR find_in_set(#{communityId},eu.ALL_DEPT_IDS))
|
|
</if>
|
|
<if test="gridId != '' and gridId != null">
|
|
and (eu.dept_id = #{gridId} OR find_in_set(#{gridId},eu.ALL_DEPT_IDS))
|
|
</if>
|
|
GROUP BY eu.ID ORDER BY eu.REGISTER_TIME DESC
|
|
</select>
|
|
|
|
<!--管理系统-->
|
|
<select id="selectByIdNew" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
|
|
SELECT
|
|
pm.*,
|
|
pm.ALL_DEPT_IDS as deptStrIds,
|
|
GROUP_CONCAT(DISTINCT(partytag.TAG_ID)) AS tagIds
|
|
FROM
|
|
epdc_party_members AS pm
|
|
LEFT JOIN epdc_party_tag_relation AS partytag ON pm.ID = partytag.PARTY_ID
|
|
AND partytag.DEL_FLAG = '0'
|
|
WHERE
|
|
1 = 1
|
|
AND pm.ID = #{id}
|
|
AND pm.DEL_FLAG = '0'
|
|
GROUP BY
|
|
pm.ID;
|
|
</select>
|
|
|
|
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
|
|
SELECT
|
|
ID,
|
|
PARENT_DEPT_IDS,
|
|
PARENT_DEPT_NAMES,
|
|
ALL_DEPT_IDS as allDeptIdsStr,
|
|
ALL_DEPT_NAMES
|
|
FROM
|
|
epdc_party_members
|
|
WHERE
|
|
FIND_IN_SET( #{deptId}, ALL_DEPT_IDS )
|
|
</select>
|
|
|
|
<update id="updateGridByDeptId">
|
|
UPDATE epdc_party_members SET GRID_NAME = #{newDeptName}, UPDATED_TIME = NOW() WHERE GRID_ID = #{deptId}
|
|
</update>
|
|
|
|
<!--已认证党员分页-->
|
|
<select id="optimizeHasAuthenticationPartyPage" resultType="String">
|
|
SELECT
|
|
eu.ID
|
|
FROM
|
|
epdc_user eu
|
|
WHERE
|
|
eu.PARTY_FLAG = '1' and eu.DEL_FLAG = '0'
|
|
<if test="realName != null and realName != '' ">and eu.REAL_NAME = #{realName}</if>
|
|
<if test="mobile != null and mobile != '' ">and eu.MOBILE = #{mobile}</if>
|
|
<if test="identityNo != null and identityNo != '' ">and eu.IDENTITY_NO = #{identityNo}</if>
|
|
<if test="registFlag != null and registFlag != '' ">and eu.REGIST_FLAG = #{registFlag}</if>
|
|
<if test="startTime != null and startTime != '' ">and eu.CREATE_TIME >= #{startTime}</if>
|
|
<if test="endTime != null and endTime != '' "> <![CDATA[ and eu.CREATE_TIME <= ]]> #{endTime}</if>
|
|
<if test="streetId != '' and streetId != null">
|
|
AND (find_in_set(#{streetId},eu.PARENT_DEPT_IDS) OR find_in_set(#{streetId},eu.ALL_DEPT_IDS))
|
|
</if>
|
|
<if test="communityId != '' and communityId != null">
|
|
AND (find_in_set(#{communityId},eu.PARENT_DEPT_IDS) OR find_in_set(#{communityId},eu.ALL_DEPT_IDS))
|
|
</if>
|
|
<if test="gridId != '' and gridId != null">
|
|
and (eu.dept_id = #{gridId} OR find_in_set(#{gridId},eu.ALL_DEPT_IDS))
|
|
</if>
|
|
ORDER BY eu.REGISTER_TIME DESC
|
|
|
|
|
|
</select>
|
|
<!--已认证党员填充数据-->
|
|
<select id="optimizeHasAuthenticationPartyPageInfo" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
|
|
SELECT
|
|
pm.CADRE_FLAG,
|
|
pm.CREATED_BY,
|
|
pm.DEPT_ID,
|
|
pm.ID,
|
|
pm.POST,
|
|
pm.POST_VALUE,
|
|
pm.REGIST_FLAG,
|
|
GROUP_CONCAT(ut.TAG_NAME) TAG_NAME,
|
|
allu.CREATED_TIME,
|
|
allu.IDENTITY_NO,
|
|
allu.MOBILE,
|
|
allu.REAL_NAME,
|
|
allu.registTime,
|
|
allu.ALL_DEPT_NAMES
|
|
FROM
|
|
(
|
|
SELECT
|
|
eu.ID,
|
|
eu.CREATED_TIME,
|
|
eu.IDENTITY_NO,
|
|
eu.MOBILE,
|
|
eu.REAL_NAME,
|
|
eu.REGISTER_TIME as registTime,
|
|
eu.ALL_DEPT_NAMES
|
|
FROM
|
|
epdc_user eu
|
|
WHERE
|
|
eu.ID IN
|
|
<foreach collection="userIdList" index="index" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
) allu
|
|
LEFT JOIN epdc_party_members pm ON pm.IDENTITY_NO = allu.IDENTITY_NO
|
|
AND pm.REAL_NAME = allu.REAL_NAME
|
|
LEFT JOIN epdc_party_tag_relation pt ON pm.ID = pt.PARTY_ID
|
|
LEFT JOIN epdc_user_tag ut ON pt.TAG_ID = ut.ID
|
|
AND ut.DEL_FLAG = '0'
|
|
GROUP BY
|
|
allu.ID
|
|
ORDER BY
|
|
allu.registTime DESC
|
|
</select>
|
|
<!--删除党员时候校验是否被认证-->
|
|
<select id="selectCountByIdentity" resultType="Integer">
|
|
SELECT
|
|
COUNT(u.ID)
|
|
FROM
|
|
epdc_user u
|
|
WHERE
|
|
u.IDENTITY_NO = #{IdentityNo}
|
|
</select>
|
|
</mapper>
|
|
|