67 lines
2.8 KiB
XML
67 lines
2.8 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.DynamicMapper">
|
|
|
|
<resultMap type="com.ruoyi.cai.domain.Dynamic" id="CaiDynamicResult">
|
|
<result property="id" column="id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="content" column="content"/>
|
|
<result property="cityId" column="city_id"/>
|
|
<result property="isAttach" column="is_attach"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="sort" column="sort"/>
|
|
</resultMap>
|
|
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.DynamicListVo">
|
|
select
|
|
t2.age,t2.gender,t2.avatar,t2.nickname,if(t3.id is null,0,1) as star,
|
|
t1.id,t1.user_id,t1.city_id,t1.city,t1.is_attach,t1.audit_status,t1.create_time,t1.content
|
|
from cai_dynamic t1
|
|
left join cai_user t2 on t1.user_id = t2.id
|
|
left join cai_user_follow t3 on t1.user_id = t3.follow_user and t3.user_id = #{query.currentUserId}
|
|
where t1.audit_status = 2 and t2.status = 0
|
|
<if test="query.userId != null">
|
|
and t1.user_id = #{query.userId}
|
|
</if>
|
|
<if test="query.type != null and query.type == 2">
|
|
and t3.id is not null
|
|
</if>
|
|
<if test="query.type != null and query.type == 3">
|
|
and t1.city_id = #{query.cityId}
|
|
</if>
|
|
<if test="query.type != null and query.type == 1">
|
|
order by t1.sort desc, t1.create_time desc
|
|
</if>
|
|
<if test="query.type == null or query.type != 1">
|
|
order by t1.create_time desc
|
|
</if>
|
|
</select>
|
|
<select id="selectDynamicImageList" resultType="java.lang.String">
|
|
select t2.url
|
|
from cai_dynamic t1
|
|
join cai_dynamic_images t2 on t1.user_id = t2.user_id and t1.id = t2.dynamic_id
|
|
where t1.audit_status = 2 and t1.user_id = #{userId}
|
|
limit #{limit}
|
|
</select>
|
|
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.DynamicAdminVo">
|
|
select t1.*, t2.usercode,t2.nickname,t2.mobile,t2.avatar,t2.gender,t2.is_anchor,t2.age,t2.status
|
|
from cai_dynamic 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>
|
|
<if test="bo.auditStatus != null">
|
|
and t1.audit_status = #{bo.auditStatus}
|
|
</if>
|
|
</where>
|
|
order by t1.sort desc, t1.create_time desc
|
|
</select>
|
|
|
|
|
|
</mapper>
|