btxtgxq-system-bigdata/src/main/resources/mybatis/db2-mapper/kpi/community-boss-mapper.xml

105 lines
3.9 KiB
XML
Raw Normal View History

<?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.cm.bigdata.dao2.kpi.ICommunityBossDao">
<resultMap id="communityBossPO" type="com.cm.bigdata.pojo.pos.kpi.CommunityBossPO">
<id column="id" property="id"/>
<result column="community_boss_id" property="communityBossId"/>
<result column="community_boss_user_id" property="communityBossUserId"/>
<result column="community_boss_parent_id" property="communityBossParentId"/>
<result column="community_boss_parent_user_id" property="communityBossParentUserId"/>
<result column="community_boss_level" property="communityBossLevel"/>
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
<result column="grid_summary" property="gridSummary"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<resultMap id="communityBossDTO" type="com.cm.bigdata.pojo.dtos.kpi.CommunityBossDTO">
<result column="community_boss_id" property="communityBossId"/>
<result column="community_boss_user_id" property="communityBossUserId"/>
<result column="community_boss_parent_id" property="communityBossParentId"/>
<result column="community_boss_parent_user_id" property="communityBossParentUserId"/>
<result column="community_boss_level" property="communityBossLevel"/>
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
<result column="community_id" property="communityId"/>
<result column="community_name" property="communityName"/>
<result column="user_name" property="userName"/>
</resultMap>
<select id="listPO" parameterType="map" resultMap="communityBossPO">
SELECT
id,
community_boss_id,
community_boss_user_id,
community_boss_parent_id,
community_boss_parent_user_id,
community_boss_level,
area_id,
area_name,
grid_summary,
creator,
gmt_create
FROM
city_community_boss
WHERE
is_delete = 0
<if test="areaId != null and areaId != ''">
AND
area_id = #{areaId}
</if>
<if test="communityBossLevel != null and communityBossLevel != ''">
AND
community_boss_level = #{communityBossLevel}
</if>
</select>
<select id="list" parameterType="map" resultMap="communityBossDTO">
SELECT
cc.community_id,
cc.community_name,
ccb.community_boss_id,
ccb.community_boss_user_id,
ccb.community_boss_parent_id,
ccb.community_boss_parent_user_id,
ccb.community_boss_level,
ccb.area_id,
ccb.area_name,
su.user_name
FROM
city_community_boss_community ccbc
INNER JOIN
city_community cc
ON
ccbc.community_id = cc.community_id
INNER JOIN
city_community_boss ccb
ON
ccb.community_boss_id = ccbc.community_boss_id
INNER JOIN
sys_user su
ON
ccb.community_boss_user_id = su.user_id
WHERE
cc.is_delete = 0
AND
ccb.is_delete = 0
AND
su.is_delete = 0
<if test="areaId != null and areaId != ''">
AND
ccb.area_id = #{areaId}
</if>
<if test="communityId != null and communityId != ''">
AND
ccbc.community_id = #{communityId}
</if>
<if test="communityBossLevel != null and communityBossLevel != ''">
AND
ccb.community_boss_level = #{communityBossLevel}
</if>
</select>
</mapper>