- 博客(10)
- 收藏
- 关注
原创 SpringBoot论坛项目-添加评论
原理 依次实现dao,service,controller对应方法实现即可。 实现步骤 dao层:添加增加评论的数据并添加修改帖子的评论数量的方法。 //增加评论 int insertComment(Comment comment); //修改帖子评论数量 int updateCommentCount(int id,int commentCount); service层:处理添加评论的业务,先添加评论,再更新帖子的评论数量。 //增加评论的业务 @
2021-04-26 21:40:36
365
原创 SpringBoot论坛项目-显示评论
原理 依次实现dao,service,controller对应方法实现即可 实现步骤 dao层:需要实现对评论数据的查询和评论数量的统计,另外评论的类型不止一种,例如对帖子的评论或者是对用户评论的评论。 @Mapper public interface CommentMapper { //查询什么评论,是对评论的评论,还是对帖子的评论 List<Comment> selectCommentByEntity(int entityType,int entityId,int o
2021-04-26 21:34:53
303
原创 SpringBoot论坛项目-帖子详情
原理 从dao到service再到controller依次实现查看帖子的方法即可. 实现步骤 DiscussPostMapper 查看帖子的方法 DiscussPost selectDiscussPostById(int id); DiscussPostService 查询帖子的方法 //查询帖子 public DiscussPost findDiscussPostById(int id){ return discussPostMapper.selectDisc
2021-04-26 21:21:17
278
原创 SpringBoot论坛项目-发布帖子
AJAX请求实现发布帖子 Asynchronous Javascript And XML -异步的JavaScript与XML,不是一门新技术,而是一个术语 使用AJAX,网页能够将增量更新呈现在页面上,而不需要刷新整个页面 虽然X代表XML,但目前JSON的使用比XML更加普遍 ...
2021-04-26 21:06:01
616
原创 完全背包
完全背包: 有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大,没见物品可以使用无限次。 一维dp: f[j]:考虑所有物品,背包容量为j时的最大价值 import java.util.*; public class Main{ static int N = 1010; static int n,m; static int[] f = new int[N]; static
2021-04-23 22:13:56
120
原创 01背包
01背包: 有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。 二维dp: f[i][j]:考虑前i件物品,背包容量为j时的最大价值 import java.util.*; public class Main{ static int N = 1010; public static void main(String[] args){ Scanne
2021-04-23 21:29:46
140
原创 SpringBoot论坛项目-过滤敏感词
原理 将敏感词存入前缀树中,使用前缀树来过滤待处理的字符串。 代码实现如下 package com.gyc.community.util; import com.sun.org.apache.bcel.internal.generic.FSUB; import org.apache.commons.lang3.CharUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ster
2021-04-23 18:29:50
1260
1
原创 KMP
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String pp = sc.next(); int m = sc.nextInt(); String ss = sc.next
2021-04-20 11:10:38
124
原创 算法模板
前缀树 //数组模拟前缀树 int son[N][26], cnt[N], idx; // 0号点既是根节点,又是空节点 // son[][]存储树中每个节点的子节点 // cnt[]存储以每个节点结尾的单词数量 // 插入一个字符串 void insert(char *str) { int p = 0; for (int i = 0; str[i]; i ++ ) { int u = str[i] - 'a'; if (!son[p][u]) so
2021-04-14 10:26:43
120
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅