删除comment
This commit is contained in:
@@ -43,4 +43,6 @@ public interface CommentDao {
|
||||
*/
|
||||
|
||||
List<CommentNode> querySecondCommentList(Integer UrlId);
|
||||
|
||||
public String queryChildId(String commentId);
|
||||
}
|
@@ -26,4 +26,6 @@ public interface CommentService {
|
||||
List<CommentNode> queryCommentByUrlId (Integer UrlId );
|
||||
|
||||
CommentUser queryCommentUserById(Integer id);
|
||||
|
||||
public String SelectChildAndDelete(String commentId);
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import com.lovenav.entity.CommentUser;
|
||||
import com.lovenav.entity.User;
|
||||
import com.lovenav.service.CommentService;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
@@ -169,5 +170,21 @@ public class CommentServiceImpl implements CommentService {
|
||||
}
|
||||
return firstList;
|
||||
}
|
||||
public String SelectChildAndDelete(String commentId)
|
||||
{
|
||||
|
||||
String child = commentDao.queryChildId(commentId);
|
||||
String [] childrens = child.split(",");
|
||||
int flag = 0;
|
||||
for(String id : childrens)
|
||||
{
|
||||
flag = commentDao.deleteByPrimaryKey(Integer.valueOf(id));
|
||||
if (String.valueOf(flag).equals("0")){
|
||||
return "出现错误";
|
||||
}
|
||||
}
|
||||
return "处理完成";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user