提交 b177b042 作者: 张小凤

Dynamicxml(update)

上级 554db757
......@@ -198,4 +198,6 @@ public interface DynamicDao {
List<PostingLeaderboardDTO> postingLeaderboardCount(PostingLeaderboardQO postingLeaderboardQO);
List<ForumGambitDTO> selectGambitDTO(Integer id);
void updateDiscussionCounts(Integer id);
}
......@@ -127,4 +127,6 @@ public interface GambitDao {
int selectCountAttention(Integer userId);
int selectCountAttentions(Integer userAccountId,Integer userId);
int selectGambitAndDynamic(Integer id);
}
......@@ -51,6 +51,8 @@ public class ForumGambitDO {
@ApiModelProperty(value = "话题参与讨论数量",example = "1")
private Integer discussionCount;
private Integer checkStatus;
public ForumGambitDO(ForumGambitVO forumGambitVO){
......
......@@ -113,6 +113,11 @@ public class GambitServiceImpl implements GambitService {
@Override
public ResultBody deleteGambit(Integer id) {
int count= gambitDao.selectGambitAndDynamic(id);
if (count==0){
return ResultBody.error("话题关联了动态无法删除");
}
gambitDao.deleteGambit(id);
gambitDao.forumDynamicGambit(id);
return ResultBody.success();
......
......@@ -136,6 +136,7 @@ public class BackstageForumServiceImpl implements BackstageForumService {
@Override
public ResultBody deleteDynamic(Integer dynamicId) {
dynamicDao.deleteDynamic(dynamicId);
gambitDao.deleteForumGambit(dynamicId);
return ResultBody.success();
}
......
......@@ -104,12 +104,14 @@ public class DynamicServiceImpl implements DynamicService {
forumGambitDO.setGambitName(s);
ForumGambitDO forumGambitDO1 = gambitDao.selectGambitMessage(forumGambitDO.getGambitName());
if (forumGambitDO1==null){
forumGambitDO.setCheckStatus(0);
dynamicDao.insertforumGambit(forumGambitDO);
}
if (forumGambitDO1!=null){
forumGambitDO.setId(forumGambitDO1.getId());
}
DynamicGambitDO dynamicGambitDO = new DynamicGambitDO(forumDynamicDO,forumGambitDO);
dynamicGambitDO.setCheckStatus(0);
dynamicDao.insertDynamicGambit(dynamicGambitDO);
}
}
......@@ -124,24 +126,33 @@ public class DynamicServiceImpl implements DynamicService {
//话题通过
List<String> gambitName = dynamicVO.getGambitName();
ForumGambitDO forumGambitDO = new ForumGambitDO(forumDynamicDO);
if (gambitName.size()!=0){
for (String s : gambitName) {
boolean b = s.startsWith("#");
if (b==true){
forumGambitDO.setGambitName(s);
ForumGambitDO forumGambitDO1 = gambitDao.selectGambitMessage(forumGambitDO.getGambitName());
if (forumGambitDO1==null){
dynamicDao.insertforumGambit(forumGambitDO);
if (gambitName!=null){
if (gambitName.size()!=0 ){
for (String s : gambitName) {
boolean b = s.startsWith("#");
if (b==true){
forumGambitDO.setGambitName(s);
ForumGambitDO forumGambitDO1 = gambitDao.selectGambitMessage(forumGambitDO.getGambitName());
if (forumGambitDO1==null){
forumGambitDO.setCheckStatus(1);
dynamicDao.insertforumGambit(forumGambitDO);
Integer id = forumDynamicDO.getId();
dynamicDao.updateDynamic(id);
dynamicDao.updateDiscussionCounts(id);
}
if (forumGambitDO1!=null){
forumGambitDO.setId(forumGambitDO1.getId());
}
DynamicGambitDO dynamicGambitDO = new DynamicGambitDO(forumDynamicDO,forumGambitDO);
dynamicGambitDO.setCheckStatus(1);
dynamicDao.insertDynamicGambit(dynamicGambitDO);
Integer id = forumGambitDO.getId();
dynamicDao.updateDynamic(id);
dynamicDao.updateDiscussionCounts(id);
}
if (forumGambitDO1!=null){
forumGambitDO.setId(forumGambitDO1.getId());
}
DynamicGambitDO dynamicGambitDO = new DynamicGambitDO(forumDynamicDO,forumGambitDO);
dynamicDao.insertDynamicGambit(dynamicGambitDO);
}
}
}
} else {
forumDynamicDO.setCheckStatus(2);
dynamicDao.insertDynamic(forumDynamicDO);
......@@ -330,7 +341,7 @@ public class DynamicServiceImpl implements DynamicService {
forumDynamicList.stream().map(ForumDynamicDO::getId).collect(Collectors.toList());
// 根据id集合查询评论
List<ForumDynamicDO> commentList = dynamicDao.firstTwoItemsComment(ids);
Map<String, List<ForumDynamicDO>> commentMap = commentList.stream().collect(Collectors.groupingBy(ForumDynamicDO::getRootPath));
Map<String, List<ForumDynamicDO>> commentMap = commentList.stream().filter(map->map.getRootPath()!=null).collect(Collectors.groupingBy(ForumDynamicDO::getRootPath));
// 根据id集合查询图片
List<ForumResourceDO> forumImageList = dynamicDao.listDynamicPicture(ids);
Map<Integer, List<ForumResourceDO>> ImageMap =
......
......@@ -67,14 +67,14 @@
</insert>
<insert id="insertforumGambit" parameterType="com.mmc.csf.release.entity.gambit.ForumGambitDO" keyProperty="id" useGeneratedKeys="true">
insert into forum_gambit(gambit_name,gambit_icon,gambit_cover,
user_account_id,create_time,update_time)
user_account_id,create_time,update_time,check_status)
values (#{gambitName},#{gambitIcon},#{gambitCover},
#{userAccountId},NOW(),NOW())
#{userAccountId},NOW(),NOW(),#{checkStatus})
</insert>
<insert id="insertDynamicGambit" parameterType="com.mmc.csf.release.entity.forum.DynamicGambitDO">
insert into forum_dynamic_gambit(dynamic_id,gambit_id,user_account_id,create_time,update_time)
values (#{dynamicId},#{gambitId},#{userAccountId},NOW(),NOW())
insert into forum_dynamic_gambit(dynamic_id,gambit_id,user_account_id,create_time,update_time,check_status)
values (#{dynamicId},#{gambitId},#{userAccountId},NOW(),NOW(),#{checkStatus})
</insert>
<update id="updateDynamic" >
......@@ -90,6 +90,14 @@
where id=#{gambitId}
</update>
<update id="updateDiscussionCounts">
update forum_gambit
set discussion_count=discussion_count+1,
update_time=NOW()
where id=#{gambitId}
</update>
<update id="updateDiscussionCount">
update forum_gambit
set discussion_count=#{count},
......
......@@ -195,6 +195,10 @@
select count(*) from forum_attention where attention_user_account_id=#{userId} and user_account_id=#{userAccountId}
</select>
<select id="selectGambitAndDynamic" resultType="java.lang.Integer">
select count(*) from forum_dynamic_gambit where gambit_id=#{id}
</select>
<select id="selectResourceList" resultType="com.mmc.csf.release.entity.forum.ForumResourceDO">
select dynamic_id,resource_url,create_time,update_time,`type` from forum_resource where dynamic_id=#{dynamicId}
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论