Files
cai-server/ruoyi-cai/src/main/resources/mapper/cai/UserCountMapper.xml
2025-02-17 16:50:26 +08:00

69 lines
2.6 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.ruoyi.cai.mapper.UserCountMapper">
<resultMap type="com.ruoyi.cai.domain.UserCount" id="CaiUserCountResult">
<result property="userId" column="user_id"/>
<result property="fansCount" column="fans_count"/>
<result property="followCount" column="follow_count"/>
<result property="visitorCount" column="visitor_count"/>
<result property="photoCount" column="photo_count"/>
<result property="dynamicCount" column="dynamic_count"/>
<result property="receiveGiftCount" column="receive_gift_count"/>
<result property="giveGiftCount" column="give_gift_count"/>
<result property="createTime" column="create_time"/>
</resultMap>
<update id="newStarIncs">
update cai_user_count
set new_fans_count = new_fans_count + 1
where user_id = #{userId}
</update>
<update id="newVisitorIncs">
update cai_user_count
set new_visitor_count = new_visitor_count + 1
where user_id = #{userId}
</update>
<update id="visitorIncs">
update cai_user_count
set
foot_count = foot_count + #{footIncs},
visitor_count = visitor_count + #{visitorIncs}
where user_id = #{userId}
</update>
<update id="resetNewStarIncs">
update cai_user_count
set new_fans_count = 0
where user_id = #{userId} and new_fans_count > 0
</update>
<update id="resetNewVisitorIncs">
update cai_user_count
set new_visitor_count = 0
where user_id = #{userId} and new_visitor_count > 0
</update>
<select id="starIncs">
update cai_user_count
set
fans_count = fans_count + #{fansIncs},
follow_count = follow_count + #{followIncs}
where user_id = #{userId}
</select>
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.UserCountAdminVo">
select t1.*,t2.usercode,t2.nickname,t2.mobile,t2.avatar,t2.gender,t2.is_anchor,t2.age,t2.status
from cai_user_count t1
left join cai_user t2 on t1.user_id = t2.id
<where>
<if test="bo.mobile != null and bo.mobile != ''">
and t2.mobile = #{bo.mobile}
</if>
<if test="bo.usercode != null and bo.usercode != ''">
and t2.usercode = #{bo.usercode}
</if>
</where>
order by t2.create_time desc
</select>
</mapper>