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.
322 lines
13 KiB
322 lines
13 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.epmet.modules.partyOrg.dao.IcPartyOrgDao">
|
|
|
|
<resultMap type="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity" id="icPartyOrgMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="customerId" column="CUSTOMER_ID"/>
|
|
<result property="orgPid" column="ORG_PID"/>
|
|
<result property="orgPids" column="ORG_PIDS"/>
|
|
<result property="agencyId" column="AGENCY_ID"/>
|
|
<result property="agencyPids" column="AGENCY_PIDS"/>
|
|
<result property="partyOrgType" column="PARTY_ORG_TYPE"/>
|
|
<result property="partyOrgName" column="PARTY_ORG_NAME"/>
|
|
<result property="partyOrgCode" column="PARTY_ORG_CODE"/>
|
|
<result property="longitude" column="LONGITUDE"/>
|
|
<result property="latitude" column="LATITUDE"/>
|
|
<result property="address" column="ADDRESS"/>
|
|
<result property="introduction" column="INTRODUCTION"/>
|
|
<result property="delFlag" column="DEL_FLAG"/>
|
|
<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"/>
|
|
</resultMap>
|
|
|
|
<!-- 党组织修改负责人 -->
|
|
<update id="editPrincipal">
|
|
update ic_party_org
|
|
set PRINCIPAL_MOBILE = #{principalMobile},
|
|
PRINCIPAL = #{principal},
|
|
PRINCIPAL_STAFF_ID = #{principalStaffId},
|
|
UPDATED_TIME = NOW()
|
|
where id = #{partyOrgId}
|
|
</update>
|
|
|
|
<select id="getTreelist" resultType="com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO">
|
|
select ID,
|
|
CUSTOMER_ID,
|
|
ORG_PID as pid,
|
|
ORG_PIDS,
|
|
AGENCY_ID,
|
|
AGENCY_PIDS,
|
|
PARTY_ORG_TYPE,
|
|
PARTY_ORG_NAME,
|
|
PRINCIPAL_MOBILE,
|
|
PRINCIPAL
|
|
from ic_party_org
|
|
where DEL_FLAG=0
|
|
and CUSTOMER_ID=#{customerId}
|
|
<choose>
|
|
<when test="orgPid != '' and orgPid != null and agencyId != null and agencyId != ''">
|
|
AND ((AGENCY_ID = #{agencyId} or AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' ))
|
|
or
|
|
id =#{orgPid})
|
|
</when>
|
|
<otherwise>
|
|
<if test="agencyId != null and agencyId != ''">
|
|
AND (AGENCY_ID = #{agencyId} or AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' ))
|
|
</if>
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
<select id="selectAllByOrgId" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
|
|
select * from ic_party_org
|
|
where DEL_FLAG='0'
|
|
AND ORG_PIDS LIKE concat('%',#{id}, '%' )
|
|
</select>
|
|
<select id="selectByCuIdAndNameOrCode" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
|
|
select * from ic_party_org
|
|
where DEL_FLAG='0'
|
|
and CUSTOMER_ID=#{customerId}
|
|
<if test="partyOrgName != null and partyOrgName != ''">
|
|
AND PARTY_ORG_NAME=#{partyOrgName}
|
|
</if>
|
|
<if test="partyOrgCode != null and partyOrgCode != ''">
|
|
AND PARTY_ORG_CODE=#{partyOrgCode}
|
|
</if>
|
|
|
|
</select>
|
|
<select id="selectByAgencyId" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
|
|
select * from ic_party_org
|
|
where DEL_FLAG='0'
|
|
and PARTY_ORG_TYPE!=#{partyOrgType}
|
|
and AGENCY_ID =#{agencyId}
|
|
</select>
|
|
<select id="selectLevelOneOrgByCustomerId" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
|
|
select * from ic_party_org
|
|
where DEL_FLAG='0'
|
|
and CUSTOMER_ID=#{customerId}
|
|
and ORG_PID='0'
|
|
</select>
|
|
<select id="selectAllBranchByAgencyId"
|
|
resultType="com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeSubDTO">
|
|
select ID as value,
|
|
CUSTOMER_ID,
|
|
ORG_PID as pid,
|
|
ORG_PIDS,
|
|
AGENCY_ID,
|
|
AGENCY_PIDS,
|
|
PARTY_ORG_TYPE,
|
|
PARTY_ORG_NAME as label,
|
|
PRINCIPAL_MOBILE,
|
|
PRINCIPAL
|
|
from ic_party_org
|
|
where DEL_FLAG=0
|
|
and CUSTOMER_ID=#{customerId}
|
|
and PARTY_ORG_TYPE = '5'
|
|
<if test="agencyId != null and agencyId != ''">
|
|
AND (AGENCY_ID = #{agencyId} or AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' ))
|
|
</if>
|
|
</select>
|
|
<select id="getSearchTreelist"
|
|
resultType="com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO">
|
|
select ID,
|
|
CUSTOMER_ID,
|
|
ORG_PID as pid,
|
|
ORG_PIDS,
|
|
AGENCY_ID,
|
|
AGENCY_PIDS,
|
|
PARTY_ORG_TYPE,
|
|
PARTY_ORG_NAME,
|
|
PRINCIPAL_MOBILE,
|
|
PRINCIPAL
|
|
from ic_party_org
|
|
where DEL_FLAG=0
|
|
and CUSTOMER_ID=#{customerId}
|
|
<if test="agencyId != null and agencyId != ''">
|
|
AND( AGENCY_ID=#{agencyId} OR AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' )
|
|
or
|
|
(PARTY_ORG_TYPE = '5' and AGENCY_ID=#{agencyId}))
|
|
</if>
|
|
</select>
|
|
<select id="selectParentOrgByAgencyPid"
|
|
resultType="com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO">
|
|
select ID,
|
|
CUSTOMER_ID,
|
|
ORG_PID as pid,
|
|
ORG_PIDS,
|
|
AGENCY_ID,
|
|
AGENCY_PIDS,
|
|
PARTY_ORG_TYPE,
|
|
PARTY_ORG_NAME,
|
|
PRINCIPAL_MOBILE,
|
|
PRINCIPAL
|
|
from ic_party_org
|
|
where DEL_FLAG = 0
|
|
and CUSTOMER_ID=#{customerId}
|
|
<if test="agencyId != null and agencyId != ''">
|
|
AND (AGENCY_ID = #{agencyId} or AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' ))
|
|
</if>
|
|
<if test="agencyPid != null and agencyPid != ''">
|
|
and AGENCY_ID=#{agencyPid}
|
|
</if>
|
|
<if test="partyOrgType != null and partyOrgType != ''">
|
|
and PARTY_ORG_TYPE = #{partyOrgType}
|
|
</if>
|
|
</select>
|
|
<select id="selectByCustomerIdAndFirstOrg" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
|
|
select *
|
|
from ic_party_org
|
|
where DEL_FLAG = 0
|
|
and CUSTOMER_ID=#{customerId}
|
|
and ORG_PID = '0'
|
|
</select>
|
|
|
|
<select id="getPartyOrg" resultType="com.epmet.resi.partymember.dto.partyOrg.result.ActAndScheduleListResultDTO$JoinOrgDTO">
|
|
SELECT
|
|
ID AS partyOrgId,
|
|
PARTY_ORG_NAME
|
|
FROM ic_party_org
|
|
WHERE DEL_FLAG = 0
|
|
<if test="null != orgIds and orgIds.size() != 0">
|
|
AND ID IN (
|
|
<foreach collection="orgIds" item="id" separator=",">#{id}</foreach>
|
|
)
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectDefaultPartyOrg" parameterType="map" resultType="IcPartyOrgEntity">
|
|
SELECT
|
|
o.*
|
|
FROM
|
|
ic_party_org o
|
|
WHERE
|
|
o.DEL_FLAG = '0'
|
|
AND o.AGENCY_ID like concat('%', #{agencyId})
|
|
<if test="level!= null and level == 'province' ">
|
|
AND o.PARTY_ORG_TYPE = '0'
|
|
</if>
|
|
<if test="level!= null and level == 'city' ">
|
|
AND o.PARTY_ORG_TYPE = '1'
|
|
</if>
|
|
<if test="level!= null and level == 'district' ">
|
|
AND o.PARTY_ORG_TYPE = '2'
|
|
</if>
|
|
<if test="level!= null and level == 'street' ">
|
|
AND o.PARTY_ORG_TYPE = '3'
|
|
</if>
|
|
<if test="level!= null and level == 'community' ">
|
|
AND o.PARTY_ORG_TYPE = '4'
|
|
</if>
|
|
order by CREATED_TIME asc
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="getUserIdByPartyOrgIds" resultType="java.lang.String">
|
|
SELECT
|
|
pi.user_id
|
|
FROM
|
|
ic_party_org ipo
|
|
INNER JOIN ic_party_member ipm ON ipm.del_flag = '0' AND ipo.id = ipm.sszb
|
|
INNER JOIN partymember_info pi ON pi.del_flag = '0' AND ipm.id_card = pi.id_card
|
|
WHERE
|
|
ipo.del_flag = '0'
|
|
<foreach collection="partyOrgIdList" item="id" open="AND ipo.id IN (" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
ORDER BY ipo.id
|
|
</select>
|
|
|
|
<select id="getSelfAndSub" resultType="com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO">
|
|
SELECT
|
|
*
|
|
FROM
|
|
ic_party_org
|
|
WHERE
|
|
del_flag = '0'
|
|
AND (
|
|
id = #{joinOrgId}
|
|
OR org_pid = #{joinOrgId}
|
|
)
|
|
ORDER BY
|
|
party_org_type ASC
|
|
</select>
|
|
|
|
<select id="partOrgList" resultType="com.epmet.resi.partymember.dto.partyOrg.result.PartyOrgListResultDTO">
|
|
SELECT
|
|
id partyOrgId,
|
|
org_pids partyOrgPath,
|
|
party_org_name partyOrgName
|
|
FROM
|
|
ic_party_org
|
|
WHERE
|
|
del_flag = '0'
|
|
AND party_org_type = '5'
|
|
AND (AGENCY_ID = #{agencyId} OR agency_pids LIKE CONCAT('%', #{agencyId}, '%'))
|
|
ORDER BY org_pids ASC
|
|
</select>
|
|
|
|
<!--党建引领,党组织和数量。AGENCY_PIDS和AGENCY_ID双条件组合。agencyId的所有下级+agencyId的本级-->
|
|
<select id="listPartyOrgCategoryAndQuantity"
|
|
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgCategoryResultDTO">
|
|
select PARTY_ORG_TYPE partyOrgType, count(*) as 'value'
|
|
from ic_party_org
|
|
where CUSTOMER_ID=#{customerId}
|
|
and (AGENCY_PIDS like CONCAT(#{agencyOrgIdPath}, '%') or AGENCY_ID = #{agencyId})
|
|
and DEL_FLAG = 0
|
|
group by PARTY_ORG_TYPE
|
|
order by PARTY_ORG_TYPE asc
|
|
</select>
|
|
|
|
<!--获取党委以上组织列表-->
|
|
<select id="getPartyOrgsLteDangwei"
|
|
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO$PartyOrg">
|
|
select org.ID id
|
|
, org.ORG_PID pid
|
|
, org.PARTY_ORG_TYPE org_type
|
|
, org.PARTY_ORG_NAME name
|
|
, count(mem.ID) num
|
|
from ic_party_org org
|
|
left join ic_party_member mem on (mem.DEL_FLAG = 0 and mem.ORG_PIDS like concat(org.ORG_PIDS, ':', org.ID, '%'))
|
|
where org.DEL_FLAG = 0
|
|
and org.PARTY_ORG_TYPE <= '4'
|
|
and (org.AGENCY_ID = #{agencyId} or org.AGENCY_PIDS like CONCAT(#{orgIdpath}, '%'))
|
|
group by org.ID, org.PARTY_ORG_NAME
|
|
</select>
|
|
|
|
<!--获取支部列表-->
|
|
<select id="getPartyOrgsOfBranch"
|
|
resultType="com.epmet.resi.partymember.dto.partymember.result.LingShanScreenPartyOrgTreeResultDTO$PartyOrg">
|
|
select org.ID id
|
|
, org.ORG_PID pid
|
|
, org.PARTY_ORG_TYPE org_type
|
|
, org.PARTY_ORG_NAME name
|
|
, count(mem.ID) num
|
|
from ic_party_org org
|
|
left join ic_party_member mem on (mem.DEL_FLAG = 0 and mem.SSZB = org.ID)
|
|
where org.DEL_FLAG = 0
|
|
and org.PARTY_ORG_TYPE = '5'
|
|
and (org.AGENCY_ID = #{agencyId} or org.AGENCY_PIDS like CONCAT(#{orgIdpath}, '%'))
|
|
group by org.ID, org.PARTY_ORG_NAME
|
|
</select>
|
|
|
|
<!-- 灵山:省委~党委党组织+党员数量列表 -->
|
|
<select id="lingshanListDw"
|
|
resultType="com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO">
|
|
select
|
|
o.ID, o.PARTY_ORG_NAME name, o.LATITUDE, o.LONGITUDE, count(*) partymember_qty
|
|
from ic_party_org o
|
|
left join ic_party_member m on (o.AGENCY_ID = m.AGENCY_ID and m.DEL_FLAG = 0)
|
|
where o.DEL_FLAG = 0
|
|
and (o.AGENCY_PIDS = #{orgIdPath} or o.AGENCY_ID=#{orgId})
|
|
and o.PARTY_ORG_TYPE = 4
|
|
group by o.ID, o.PARTY_ORG_NAME, o.LATITUDE, o.LONGITUDE
|
|
</select>
|
|
|
|
<!--直属支部-->
|
|
<select id="lingshanListZsBranchs"
|
|
resultType="com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO">
|
|
select
|
|
o.ID, o.PARTY_ORG_NAME name, o.LATITUDE, o.LONGITUDE, count(*) partymember_qty
|
|
from ic_party_org o
|
|
left join ic_party_member m on (o.ID = m.SSZB and m.DEL_FLAG = 0)
|
|
where o.DEL_FLAG = 0
|
|
and o.AGENCY_ID like #{orgId}
|
|
and o.PARTY_ORG_TYPE = 5
|
|
group by o.ID, o.PARTY_ORG_NAME, o.LATITUDE, o.LONGITUDE
|
|
</select>
|
|
|
|
</mapper>
|