214 lines
11 KiB
XML
214 lines
11 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.app.mapper.AppUserDynamicMapper">
|
|
|
|
<resultMap type="AppUserDynamic" id="AppUserDynamicResult">
|
|
<result property="id" column="id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="content" column="content" />
|
|
<result property="videoUrl" column="video_url" />
|
|
<result property="topicId" column="topic_id" />
|
|
<result property="address" column="address" />
|
|
<result property="privacyStatus" column="privacy_status" />
|
|
<result property="remark" column="remark" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateBy" column="updateBy" />
|
|
<result property="isTop" column="is_top" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAppUserDynamicVo">
|
|
select id, user_id, content, video_url, topic_id, address, privacy_status, remark, create_time, update_time, create_by, updateBy,is_top ,city_id , province_id , town_id from app_user_dynamic
|
|
</sql>
|
|
|
|
<select id="selectAppUserDynamicList" parameterType="AppUserDynamic" resultMap="AppUserDynamicResult">
|
|
<include refid="selectAppUserDynamicVo"/>
|
|
<where>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
|
<if test="videoUrl != null and videoUrl != ''"> and video_url = #{videoUrl}</if>
|
|
<if test="topicId != null "> and topic_id = #{topicId}</if>
|
|
<if test="address != null and address != ''"> and address = #{address}</if>
|
|
<if test="privacyStatus != null "> and privacy_status = #{privacyStatus}</if>
|
|
<if test="updateBy != null and updateBy != ''"> and updateBy = #{updateBy}</if>
|
|
<if test="isTop != null "> and is_top = #{isTop}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectDynamicList" parameterType="AppUserDynamic" resultType="com.ruoyi.app.domain.vo.AppUserDynamicVo">
|
|
select a.id as "id",a.user_id as "userId",a.content as "content",a.video_url as "videoUrl",a.topic_id as "topicId",a.address as "address",
|
|
a.is_top as "isTop",
|
|
a.privacy_status as "privacyStatus",
|
|
u.username as "username",
|
|
u.avatar_url as "avatarUrl",
|
|
u.education as "education",
|
|
u.school as "school",
|
|
u.major as "major",
|
|
u.start_time as "startTime",
|
|
u.end_time as "endTime",
|
|
u.is_member as "isMember",
|
|
a.create_time as "createTime",
|
|
a.town_id as "townId",
|
|
a.province_id as "provinceId",
|
|
a.city_id as "cityId",
|
|
c.name as "cityName",
|
|
t.name as "townName",
|
|
p.name as "provinceName",
|
|
u.`check` as "check",
|
|
u.nickname as "nickname"
|
|
from app_user_dynamic a
|
|
left join app_user u on u.id = a.user_id
|
|
left join app_city c on c.id = a.city_id
|
|
left join app_province p on p.id = a.province_id
|
|
left join app_town t on t.id = a.town_id
|
|
<where>
|
|
<if test="userId != null "> and a.user_id = #{userId}</if>
|
|
<if test="username != null "> and
|
|
(u.username like concat('%',#{username},'%')
|
|
or a.content like concat('%',#{username},'%')
|
|
)
|
|
</if>
|
|
<if test="content != null and content != ''"> and a.content like concat('%',#{content},'%')</if>
|
|
<if test="videoUrl != null and videoUrl != ''"> and a.video_url = #{videoUrl}</if>
|
|
<if test="topicId != null "> and a.topic_id like concat('%',#{topicId},'%')</if>
|
|
<if test="address != null and address != ''"> and a.address = #{address}</if>
|
|
<if test="privacyStatus != null ">
|
|
and (
|
|
a.privacy_status = #{privacyStatus}
|
|
<if test="dynamicIds != null and dynamicIds.size() > 0">
|
|
or a.id in
|
|
<foreach collection="dynamicIds" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="userId != null "> or a.user_id = #{userId}</if>
|
|
)
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''"> and a.updateBy = #{updateBy}</if>
|
|
<if test="isTop != null "> and a.is_top = #{isTop}</if>
|
|
<if test="isMember != null "> and u.is_member = #{isMember}</if>
|
|
<if test="cityId != null "> and a.city_id = #{cityId}</if>
|
|
<if test="provinceId != null"> and a.province_id = #{provinceId}</if>
|
|
<if test="townId != null"> and a.town_id = #{townId}</if>
|
|
<if test="ids != null and ids.size() > 0">
|
|
and a.id in
|
|
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
order by a.is_top,a.create_time desc
|
|
</select>
|
|
|
|
<select id="selectAppUserDynamicById" parameterType="Long" resultMap="AppUserDynamicResult">
|
|
<include refid="selectAppUserDynamicVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<select id="listByUserIds" parameterType="Long" resultType="Long">
|
|
select id from app_user_dynamic
|
|
where privacy_status = 1 and user_id in
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="selectcById" parameterType="Long" resultType="com.ruoyi.app.domain.vo.AppUserDynamicVo">
|
|
select a.id as "id",a.user_id as "userId",a.content as "content",a.video_url as "videoUrl",a.topic_id as "topicId",a.address as "address",
|
|
a.is_top as "isTop",
|
|
a.privacy_status as "privacyStatus",
|
|
u.username as "username",
|
|
u.avatar_url as "avatarUrl",
|
|
u.education as "education",
|
|
u.school as "school",
|
|
u.nickname as "nickname",
|
|
u.major as "major",
|
|
u.start_time as "startTime",
|
|
u.end_time as "endTime",
|
|
u.is_member as "isMember",
|
|
a.create_time as "createTime",
|
|
a.town_id as "townId",
|
|
a.province_id as "provinceId",
|
|
a.city_id as "cityId",
|
|
c.name as "cityName",
|
|
t.name as "townName",
|
|
p.name as "provinceName"
|
|
from app_user_dynamic a
|
|
left join app_user u on u.id = a.user_id
|
|
left join app_city c on c.id = a.city_id
|
|
left join app_province p on p.id = a.province_id
|
|
left join app_town t on t.id = a.town_id
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertAppUserDynamic" parameterType="AppUserDynamic" useGeneratedKeys="true" keyProperty="id">
|
|
insert into app_user_dynamic
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="content != null">content,</if>
|
|
<if test="videoUrl != null">video_url,</if>
|
|
<if test="topicId != null">topic_id,</if>
|
|
<if test="address != null">address,</if>
|
|
<if test="privacyStatus != null">privacy_status,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="updateBy != null">updateBy,</if>
|
|
<if test="isTop != null">is_top,</if>
|
|
<if test="cityId != null">city_id,</if>
|
|
<if test="provinceId != null">province_id,</if>
|
|
<if test="townId != null">town_id,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="content != null">#{content},</if>
|
|
<if test="videoUrl != null">#{videoUrl},</if>
|
|
<if test="topicId != null">#{topicId},</if>
|
|
<if test="address != null">#{address},</if>
|
|
<if test="privacyStatus != null">#{privacyStatus},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="isTop != null">#{isTop},</if>
|
|
<if test="cityId != null">#{cityId},</if>
|
|
<if test="provinceId != null">#{provinceId},</if>
|
|
<if test="townId != null">#{townId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateAppUserDynamic" parameterType="AppUserDynamic">
|
|
update app_user_dynamic
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="content != null">content = #{content},</if>
|
|
<if test="videoUrl != null">video_url = #{videoUrl},</if>
|
|
<if test="topicId != null">topic_id = #{topicId},</if>
|
|
<if test="address != null">address = #{address},</if>
|
|
<if test="privacyStatus != null">privacy_status = #{privacyStatus},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="updateBy != null">updateBy = #{updateBy},</if>
|
|
<if test="isTop != null">is_top = #{isTop},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteAppUserDynamicById" parameterType="Long">
|
|
delete from app_user_dynamic where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteAppUserDynamicByIds" parameterType="String">
|
|
delete from app_user_dynamic where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |