130 lines
4.4 KiB
XML
130 lines
4.4 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.PublishMapper">
|
|
<insert id="insertPublish">
|
|
insert into cc_publish
|
|
(tenant_id, community_id, user_id, content, image_url, file_url, file_name, publish_time)
|
|
values (#{publish.tenantId}, #{publish.communityId}, #{publish.userId}, #{publish.content}, #{publish.imageUrl},
|
|
#{publish.fileUrl}, #{publish.fileName}, #{publish.publishTime})
|
|
</insert>
|
|
<update id="elitePublish">
|
|
update cc_publish
|
|
set is_elite = !is_elite
|
|
where community_id = #{communityId}
|
|
and id = #{publishId}
|
|
</update>
|
|
<select id="selectByTenantIdAndCommunityIdPage" resultType="com.mcwl.communityCenter.domain.Publish">
|
|
select id,
|
|
tenant_id,
|
|
community_id,
|
|
user_id,
|
|
content,
|
|
image_url,
|
|
file_url,
|
|
publish_time,
|
|
like_num,
|
|
comment_num,
|
|
status,
|
|
create_by,
|
|
create_time
|
|
from cc_publish
|
|
where tenant_id = #{tenantId}
|
|
and community_id = #{communityId}
|
|
and del_flag = '0'
|
|
</select>
|
|
<select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Publish">
|
|
select id,
|
|
tenant_id,
|
|
community_id,
|
|
user_id,
|
|
content,
|
|
image_url,
|
|
file_url,
|
|
publish_time,
|
|
like_num,
|
|
comment_num,
|
|
status,
|
|
create_by,
|
|
create_time
|
|
from cc_publish
|
|
where id = #{id}
|
|
and tenant_id = #{tenantId}
|
|
and community_id = #{communityId}
|
|
and del_flag = '0'
|
|
</select>
|
|
<select id="selectByTenantIdAndCommunityIdAndNotNullImagePage"
|
|
resultType="com.mcwl.communityCenter.domain.Publish">
|
|
select id,
|
|
tenant_id,
|
|
community_id,
|
|
user_id,
|
|
content,
|
|
image_url,
|
|
file_url,
|
|
publish_time,
|
|
like_num,
|
|
comment_num,
|
|
status,
|
|
create_by,
|
|
create_time
|
|
from cc_publish
|
|
where tenant_id = #{tenantId}
|
|
and community_id = #{communityId}
|
|
and del_flag = '0'
|
|
and image_url is not null
|
|
</select>
|
|
<select id="selectByTenantIdAndCommunityIdAndNotNullFilePage"
|
|
resultType="com.mcwl.communityCenter.domain.Publish">
|
|
select id,
|
|
tenant_id,
|
|
community_id,
|
|
user_id,
|
|
content,
|
|
image_url,
|
|
file_url,
|
|
publish_time,
|
|
like_num,
|
|
comment_num,
|
|
status,
|
|
create_by,
|
|
create_time
|
|
from cc_publish
|
|
where tenant_id = #{tenantId}
|
|
and community_id = #{communityId}
|
|
and del_flag = '0'
|
|
and file_url is not null
|
|
</select>
|
|
<select id="publishList" resultType="com.mcwl.communityCenter.domain.Publish">
|
|
select *
|
|
from cc_publish
|
|
<where>
|
|
and tenant_id = #{publishPageRes.tenantId}
|
|
and community_id = #{publishPageRes.communityId}
|
|
and del_flag = '0'
|
|
<if test="publishPageRes.type != null">
|
|
<if test="publishPageRes.type == 0">
|
|
and user_id = #{publishPageRes.tenantId}
|
|
</if>
|
|
<if test="publishPageRes.type == 1">
|
|
and is_elite = 1
|
|
</if>
|
|
</if>
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
<select id="myPublishList" resultType="com.mcwl.communityCenter.domain.vo.PublishVo">
|
|
select p.*, IF(pc.id is not null, 1, 0) as is_collect
|
|
from cc_publish p left join cc_publish_collect pc
|
|
on p.id = pc.publish_id
|
|
and p.tenant_id = pc.tenant_id
|
|
and p.community_id = pc.community_id
|
|
<where>
|
|
and p.tenant_id = #{myPublishPageRes.tenantId}
|
|
and p.community_id = #{myPublishPageRes.communityId}
|
|
and p.user_id = #{userId}
|
|
and p.del_flag = '0'
|
|
</where>
|
|
</select>
|
|
</mapper> |