mcwl-ai/mcwl-communityCenter/src/main/resources/mapper/communityCenter/CommunityUserMapper.xml

57 lines
2.1 KiB
XML

<?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.mcwl.communityCenter.mapper.CommunityUserMapper">
<select id="selectByTenantIdAndCommunityIdAndUserId"
resultType="com.mcwl.communityCenter.domain.CommunityUser">
select id,
tenant_id,
community_id,
user_id
from cc_community_user
where tenant_id = #{tenantId}
and community_id = #{communityId}
and user_id = #{userId}
and del_flag = '0';
</select>
<select id="getJoinNum" resultType="java.lang.Integer">
select count(*)
from cc_community_user
where tenant_id = #{tenantId}
and community_id = #{communityId}
and del_flag = '0';
</select>
<select id="isJoinCommunity" resultType="java.lang.Integer">
select COALESCE(count(*), 0)
from cc_community_user
where tenant_id = #{tenantId}
and community_id = #{communityId}
and user_id = #{userId}
and del_flag = '0';
</select>
<select id="getCommunityUserList" resultType="com.mcwl.communityCenter.domain.vo.CommunityUserVo">
select cu.id,
cu.tenant_id,
cu.community_id,
cu.user_id,
u.avatar,
u.nick_name,
IF(cu.community_price != 0, '收费', '免费') AS join_type,
cu.start_time,
u.login_date,
cu.end_time
from cc_community_user cu
left join sys_user u on cu.user_id = u.user_id
<where>
cu.community_id = #{communityUserListPageRes.communityId}
<if test="communityUserListPageRes.searchContent != null and communityUserListPageRes.searchContent != ''">
and u.nick_name like concat('%', #{communityUserListPageRes.searchContent}, '%')
</if>
and (cu.blank_end_time is null or NOW() &gt;= cu.blank_end_time)
and cu.is_blank = '0'
and cu.del_flag = '0'
</where>
</select>
</mapper>