<?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_community.dao.ComActIntegralUserMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActIntegralUserDO">
|
<id column="id" property="id" />
|
<result column="user_id" property="userId" />
|
<result column="community_id" property="communityId" />
|
<result column="integral_sum" property="integralSum" />
|
<result column="integral_available_sum" property="integralAvailableSum" />
|
<result column="integral_frozen_sum" property="integralFrozenSum" />
|
<result column="integral_party" property="integralParty" />
|
<result column="integral_available_party" property="integralAvailableParty" />
|
<result column="integral_frozen_party" property="integralFrozenParty" />
|
<result column="integral_volunteer" property="integralVolunteer" />
|
<result column="integral_available_volunteer" property="integralAvailableVolunteer" />
|
<result column="integral_frozen_volunteer" property="integralFrozenVolunteer" />
|
<result column="integral_resident" property="integralResident" />
|
<result column="integral_available_resident" property="integralAvailableResident" />
|
<result column="integral_frozen_resident" property="integralFrozenResident" />
|
<result column="create_at" property="createAt" />
|
<result column="update_at" property="updateAt" />
|
<result column="status" property="status" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, user_id, community_id, integral_sum, integral_available_sum, integral_frozen_sum, integral_party, integral_available_party, integral_frozen_party, integral_volunteer, integral_available_volunteer, integral_frozen_volunteer, integral_resident, integral_available_resident, integral_frozen_resident, create_at, update_at
|
</sql>
|
|
<select id="getIntegralUserListApplets" resultType="com.panzhihua.common.model.vos.community.integral.ComActIntegralUserListVO">
|
SELECT
|
caiu.integral_sum as amount,
|
caiu.community_id,
|
ca.`name` AS communityName
|
FROM
|
com_act_integral_user AS caiu
|
LEFT JOIN com_act AS ca ON ca.community_id = caiu.community_id
|
WHERE
|
caiu.user_id = #{userId}
|
</select>
|
|
<select id="getIntegralUserRank" resultType="com.panzhihua.common.model.vos.community.integral.IntegralUserRankVO">
|
SELECT
|
*
|
FROM
|
(
|
SELECT
|
t1.user_id,
|
@rank := @rank + 1 AS rank
|
FROM
|
(
|
SELECT
|
caiu.user_id,
|
caiu.integral_sum
|
FROM
|
com_act_integral_user as caiu
|
left join sys_user as su on su.user_id = caiu.user_id
|
WHERE
|
caiu.community_id = #{communityId}
|
ORDER BY
|
caiu.integral_sum DESC,su.create_at asc
|
) AS t1,
|
( SELECT @rank := 0 ) AS t2
|
) AS m
|
WHERE
|
user_id = #{userId}
|
</select>
|
|
<select id="getIntegralCommunityRankApplets" parameterType="com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO"
|
resultType="com.panzhihua.common.model.vos.community.integral.ComActIntegralCommunityRankVO">
|
SELECT
|
su.nick_name,
|
su.image_url,
|
<if test="communityRankDTO.type == 1">
|
caiu.integral_sum as amount,
|
</if>
|
<if test="communityRankDTO.type == 2">
|
caiu.integral_resident as amount,
|
</if>
|
<if test="communityRankDTO.type == 3">
|
caiu.integral_volunteer as amount,
|
</if>
|
<if test="communityRankDTO.type == 4">
|
caiu.integral_party as amount,
|
</if>
|
su.is_partymember,
|
su.is_volunteer
|
FROM
|
com_act_integral_user AS caiu
|
LEFT JOIN sys_user AS su ON su.user_id = caiu.user_id
|
WHERE
|
caiu.community_id = #{communityRankDTO.communityId}
|
<if test="communityRankDTO.type == 3">
|
and su.is_volunteer = 1
|
</if>
|
<if test="communityRankDTO.type == 4">
|
and su.is_partymember = 1
|
</if>
|
|
<if test="communityRankDTO.type == 1">
|
order by caiu.integral_sum desc,su.create_at asc
|
</if>
|
<if test="communityRankDTO.type == 2">
|
order by caiu.integral_resident desc,su.create_at asc
|
</if>
|
<if test="communityRankDTO.type == 3">
|
order by caiu.integral_volunteer desc,su.create_at asc
|
</if>
|
<if test="communityRankDTO.type == 4">
|
order by caiu.integral_party desc,su.create_at asc
|
</if>
|
</select>
|
|
<select id="getTaskActivityPeopleList" resultType="com.panzhihua.common.model.vos.community.integral.admin.ComActActivityPeopleVO">
|
select caas.user_id,caas.activity_id,caa.community_id,caas.is_volunteer from com_act_act_sign as caas left join com_act_activity as caa on caa.id = caas.activity_id where caa.id = #{activityId}
|
</select>
|
|
</mapper>
|