<?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.panzhihua.service_dangjian.dao.ComPbOrgDAO">
|
|
<resultMap type="com.panzhihua.service_dangjian.model.dos.ComPbOrgDO" id="ComPbOrgMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="level" column="level" jdbcType="INTEGER"/>
|
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="communityId" column="community_id" jdbcType="INTEGER"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
<result property="type" column="type" jdbcType="INTEGER"/>
|
<result property="subjection" column="subjection" jdbcType="INTEGER"/>
|
<result property="areaId" column="area_id" jdbcType="INTEGER"/>
|
<result property="address" column="address" jdbcType="VARCHAR"/>
|
<result property="longitude" column="longitude" jdbcType="VARCHAR"/>
|
<result property="latitude" column="latitude" jdbcType="VARCHAR"/>
|
<result property="oneId" column="one_id" jdbcType="INTEGER"/>
|
<result property="twoId" column="two_id" jdbcType="INTEGER"/>
|
<result property="thirdId" column="third_id" jdbcType="INTEGER"/>
|
<result property="fourId" column="four_id" jdbcType="INTEGER"/>
|
<result property="fiveId" column="five_id" jdbcType="INTEGER"/>
|
<result property="buildId" column="build_id" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<select id="listPartyOrganizationAll" resultType="com.panzhihua.common.model.vos.partybuilding.west.PartyOrganizationVO">
|
SELECT
|
cpo.id,
|
cpo.`name`,
|
cpo.`status`,
|
cpo.parent_id,
|
cpo.subjection,
|
cpo.area_id,
|
cpo.build_id,
|
cpo.address,
|
cpo.longitude,
|
cpo.latitude,
|
cpo.type,
|
cmv.`name` AS areaName,
|
cmb.`name` AS buildName,
|
cpmr.`name` AS userName,
|
cpmr.phone,
|
(select count(id) from com_pb_member where org_id = cpo.id and audit_result = 1) as countPerson
|
FROM
|
com_pb_org AS cpo
|
LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cpo.area_id
|
left join com_mng_building as cmb on cmb.id = cpo.build_id
|
LEFT JOIN com_pb_member_role cpmr ON cpmr.org_id = cpo.id
|
<where>
|
<if test="partyOrganizationVO.communityId != null">
|
and cpo.community_id = ${partyOrganizationVO.communityId}
|
</if>
|
<if test="partyOrganizationVO.keyWord == null or partyOrganizationVO.keyWord == ''">
|
AND cpo.parent_id = 0
|
</if>
|
<if test="partyOrganizationVO.keyWord != null and partyOrganizationVO.keyWord != ''">
|
and cpo.`name` like CONCAT(#{partyOrganizationVO.keyWord}, '%')
|
</if>
|
<if test="partyOrganizationVO.subjection != null">
|
and cpo.subjection = #{partyOrganizationVO.subjection}
|
</if>
|
<if test="partyOrganizationVO.areaId != null">
|
and cpo.area_id = #{partyOrganizationVO.areaId}
|
</if>
|
<if test="partyOrganizationVO.buildId != null">
|
and cpo.build_id = #{partyOrganizationVO.buildId}
|
</if>
|
</where>
|
GROUP BY cpo.id
|
ORDER BY cpo.id desc
|
</select>
|
|
<select id="getChildOrgList" resultType="com.panzhihua.common.model.vos.partybuilding.west.PartyOrganizationVO">
|
SELECT
|
cpo.id,
|
cpo.`name`,
|
cpo.`status`,
|
cpo.parent_id,
|
cpo.subjection,
|
cpo.area_id,
|
cpo.build_id,
|
cpo.address,
|
cpo.longitude,
|
cpo.latitude,
|
cpo.type,
|
cmv.`name` AS areaName,
|
cmb.`name` AS buildName,
|
cpmr.`name` AS userName,
|
cpmr.phone AS phone,
|
(select count(id) from com_pb_member where org_id = cpo.id and audit_result = 1) as countPerson
|
FROM
|
com_pb_org AS cpo
|
LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cpo.area_id
|
LEFT JOIN com_pb_member_role AS cpmr ON cpmr.org_id = cpo.id
|
left join com_mng_building as cmb on cmb.id = cpo.build_id
|
<where>
|
<if test="partyOrganizationVO.parentId != null">
|
AND cpo.parent_id = ${partyOrganizationVO.parentId}
|
</if>
|
<if test="partyOrganizationVO.communityId != null">
|
and cpo.community_id = ${partyOrganizationVO.communityId}
|
</if>
|
<if test="partyOrganizationVO.subjection != null">
|
and cpo.subjection = #{partyOrganizationVO.subjection}
|
</if>
|
<if test="partyOrganizationVO.areaId != null">
|
and cpo.area_id = #{partyOrganizationVO.areaId}
|
</if>
|
<if test="partyOrganizationVO.buildId != null">
|
and cpo.build_id = #{partyOrganizationVO.buildId}
|
</if>
|
</where>
|
GROUP BY cpo.id
|
ORDER BY cpo.id desc
|
</select>
|
|
<select id="getPbOrgAllList" resultType="com.panzhihua.common.model.vos.partybuilding.west.PartyOrganizationVO">
|
SELECT
|
cpo.id,
|
cpo.`name`,
|
cpo.`status`,
|
cpo.parent_id,
|
cpo.subjection,
|
cpo.area_id,
|
cpo.build_id,
|
cpo.address,
|
cpo.longitude,
|
cpo.latitude,
|
cpo.type,
|
cmv.`name` AS areaName,
|
cmb.`name` AS buildName,
|
cpmr.`name` AS userName,
|
cpmr.phone AS phone,
|
(select count(id) from com_pb_member where org_id = cpo.id and audit_result = 1) as countPerson
|
FROM
|
com_pb_org AS cpo
|
LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cpo.area_id
|
LEFT JOIN com_pb_member_role AS cpmr ON cpmr.org_id = cpo.id
|
left join com_mng_building as cmb on cmb.id = cpo.build_id
|
<where>
|
<if test="partyOrganizationVO.communityId != null">
|
and cpo.community_id = ${partyOrganizationVO.communityId}
|
</if>
|
<if test="partyOrganizationVO.keyWord == null or partyOrganizationVO.keyWord == ''">
|
AND cpo.parent_id = 0
|
</if>
|
<if test="partyOrganizationVO.keyWord != null and partyOrganizationVO.keyWord != ''">
|
and cpo.`name` like CONCAT(#{partyOrganizationVO.keyword}, '%')
|
</if>
|
<if test="partyOrganizationVO.subjection != null">
|
and cpo.subjection = #{partyOrganizationVO.subjection}
|
</if>
|
<if test="partyOrganizationVO.areaId != null">
|
and cpo.area_id = #{partyOrganizationVO.areaId}
|
</if>
|
<if test="partyOrganizationVO.buildId != null">
|
and cpo.build_id = #{partyOrganizationVO.buildId}
|
</if>
|
</where>
|
GROUP BY cpo.id
|
ORDER BY cpo.id desc
|
</select>
|
|
</mapper>
|