评论及敏感词管理--修正
parent
eb1aa6d0fd
commit
e4dbc70f04
@ -0,0 +1,24 @@
|
||||
package com.example.venue_reservation_service.config;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Configuration
|
||||
public class DateTimeConfig {
|
||||
|
||||
@Value("${spring.jackson.date-format}") // 支持配置文件覆盖
|
||||
private String pattern;
|
||||
|
||||
@Bean
|
||||
public LocalDateTimeSerializer localDateTimeSerializer() {
|
||||
return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomizer() {
|
||||
return builder -> builder.serializers(localDateTimeSerializer());
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.example.venue_reservation_service.controller;
|
||||
|
||||
import com.example.venue_reservation_service.domain.Comment;
|
||||
import com.example.venue_reservation_service.service.CommentService;
|
||||
import com.example.venue_reservation_service.vo.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/comment")
|
||||
@CrossOrigin
|
||||
@Api("用户评论管理")
|
||||
public class CommentController {
|
||||
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
|
||||
@ApiOperation("发布评论")
|
||||
@PostMapping("/create")
|
||||
public Result create(@RequestBody Comment comment){
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.example.venue_reservation_service.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/word")
|
||||
@CrossOrigin
|
||||
@Api("敏感词管理")
|
||||
public class WordController {
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.example.venue_reservation_service.mapper;
|
||||
|
||||
import com.example.venue_reservation_service.domain.Comment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_comment(用户评论主表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
* @Entity generator.domain.Comment
|
||||
*/
|
||||
public interface CommentMapper extends BaseMapper<Comment> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.example.venue_reservation_service.mapper;
|
||||
|
||||
import com.example.venue_reservation_service.domain.UserLike;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_user_like(用户点赞关系表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
* @Entity generator.domain.UserLike
|
||||
*/
|
||||
public interface UserLikeMapper extends BaseMapper<UserLike> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.example.venue_reservation_service.mapper;
|
||||
|
||||
import com.example.venue_reservation_service.domain.Word;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_word(敏感词库表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
* @Entity generator.domain.Word
|
||||
*/
|
||||
public interface WordMapper extends BaseMapper<Word> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.example.venue_reservation_service.service;
|
||||
|
||||
import com.example.venue_reservation_service.domain.Comment;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.example.venue_reservation_service.vo.Result;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_comment(用户评论主表)】的数据库操作Service
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
*/
|
||||
public interface CommentService extends IService<Comment> {
|
||||
|
||||
Result createComment(Comment comment);
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.example.venue_reservation_service.service;
|
||||
|
||||
import com.example.venue_reservation_service.domain.UserLike;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_user_like(用户点赞关系表)】的数据库操作Service
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
*/
|
||||
public interface UserLikeService extends IService<UserLike> {
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.example.venue_reservation_service.service;
|
||||
|
||||
import com.example.venue_reservation_service.domain.Word;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_word(敏感词库表)】的数据库操作Service
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
*/
|
||||
public interface WordService extends IService<Word> {
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.example.venue_reservation_service.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.example.venue_reservation_service.domain.Comment;
|
||||
import com.example.venue_reservation_service.mapper.CommentMapper;
|
||||
import com.example.venue_reservation_service.service.CommentService;
|
||||
import com.example.venue_reservation_service.vo.Result;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_comment(用户评论主表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
*/
|
||||
@Service
|
||||
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment>
|
||||
implements CommentService{
|
||||
|
||||
@Override
|
||||
public Result createComment(Comment comment) {
|
||||
// TODO 对敏感词进行脱敏处理 --
|
||||
comment.setCreateTime(LocalDateTime.now());
|
||||
comment.setUpdateTime(LocalDateTime.now());
|
||||
// TODO 保存评论记录
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.example.venue_reservation_service.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.example.venue_reservation_service.domain.UserLike;
|
||||
import com.example.venue_reservation_service.mapper.UserLikeMapper;
|
||||
import com.example.venue_reservation_service.service.UserLikeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_user_like(用户点赞关系表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
*/
|
||||
@Service
|
||||
public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike>
|
||||
implements UserLikeService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.example.venue_reservation_service.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.example.venue_reservation_service.domain.Word;
|
||||
import com.example.venue_reservation_service.service.WordService;
|
||||
import com.example.venue_reservation_service.mapper.WordMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 31586
|
||||
* @description 针对表【venue_word(敏感词库表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-03 15:00:23
|
||||
*/
|
||||
@Service
|
||||
public class WordServiceImpl extends ServiceImpl<WordMapper, Word>
|
||||
implements WordService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
<?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.example.venue_reservation_service.mapper.CommentMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.example.venue_reservation_service.domain.Comment">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="CHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,content,
|
||||
status,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
<?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.example.venue_reservation_service.mapper.UserLikeMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.example.venue_reservation_service.domain.UserLike">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="commentId" column="comment_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,comment_id,
|
||||
create_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
<?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.example.venue_reservation_service.mapper.WordMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.example.venue_reservation_service.domain.Word">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="word" column="word" jdbcType="VARCHAR"/>
|
||||
<result property="level" column="level" jdbcType="CHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,word,level,
|
||||
create_time
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in New Issue