完成基本功能

This commit is contained in:
wxl 2024-12-25 00:07:09 +08:00
parent d215cf0a81
commit f965fdaee3
24 changed files with 1168 additions and 0 deletions

View File

@ -0,0 +1,88 @@
package com.dd.admin.business.follow.controller;
import cn.hutool.core.bean.BeanUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.dd.admin.common.model.UpdateGroup;
import com.dd.admin.common.model.result.ResultBean;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
import com.dd.admin.business.follow.entity.Follow;
import com.dd.admin.business.follow.domain.FollowVo;
import com.dd.admin.business.follow.domain.FollowDto;
import com.dd.admin.business.follow.service.FollowService;
import java.util.List;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 关注表 前端控制器
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Api(tags = "关注表")
@RestController
public class FollowController {
@Autowired
FollowService followService;
@ApiOperation(value = "关注表-分页列表")
@ApiOperationSupport(order = 1)
@GetMapping("/admin/follow/page")
public ResultBean<IPage<FollowVo>> page(FollowDto followDto) {
IPage<FollowVo> pageInfo = followService.selectFollowPage(followDto);
return ResultBean.success(pageInfo);
}
@ApiOperation(value = "关注表-列表")
@ApiOperationSupport(order = 2)
@GetMapping("/admin/follow/list")
public ResultBean<List<FollowVo>> list(FollowDto followDto) {
List<FollowVo> list = followService.selectFollowList(followDto);
return ResultBean.success(list);
}
@ApiOperation(value = "关注表-添加")
@ApiOperationSupport(order = 3)
@PostMapping("/admin/follow/add")
public ResultBean<Follow> add(@RequestBody @Validated FollowDto followDto) {
Follow follow = BeanUtil.copyProperties(followDto, Follow.class);
followService.save(follow);
return ResultBean.success(follow);
}
@ApiOperation(value = "关注表-查询")
@ApiOperationSupport(order = 4)
@GetMapping("/admin/follow/{followId}")
public ResultBean<FollowVo> get(@PathVariable @NotBlank String followId) {
Follow follow = followService.getById(followId);
FollowVo followVo = BeanUtil.copyProperties(follow,FollowVo.class);
return ResultBean.success(followVo);
}
@ApiOperation(value = "关注表-修改")
@ApiOperationSupport(order = 5)
@PostMapping("/admin/follow/update")
public ResultBean<Follow> update(@RequestBody @Validated(UpdateGroup.class) FollowDto followDto) {
Follow follow = BeanUtil.copyProperties(followDto, Follow.class);
followService.updateById(follow);
return ResultBean.success(follow);
}
@ApiOperation(value = "关注表-删除")
@ApiOperationSupport(order = 6)
@GetMapping("/admin/follow/delete/{followId}")
public ResultBean<Follow> delete(@PathVariable @NotBlank String followId) {
Boolean b = followService.removeById(followId);
return ResultBean.success(b);
}
}

View File

@ -0,0 +1,51 @@
package com.dd.admin.business.follow.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import com.dd.admin.common.model.UpdateGroup;
/**
* <p>
* 关注表返回对象
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@ApiModel(value="关注表接收对象")
public class FollowDto {
@NotBlank(message = "关注表id不能为空",groups = UpdateGroup.class)
private String id;
@ApiModelProperty(value = "被关注id")
private String authorId;
@ApiModelProperty(value = "被关注名字")
private String authorName;
@ApiModelProperty(value = "关注者")
private String followId;
@ApiModelProperty(value = "关注者名字")
private String followName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@ -0,0 +1,47 @@
package com.dd.admin.business.follow.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 关注表返回对象
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@ApiModel(value="关注表返回对象")
public class FollowVo {
private String id;
@ApiModelProperty(value = "被关注id")
private String authorId;
@ApiModelProperty(value = "被关注名字")
private String authorName;
@ApiModelProperty(value = "关注者")
private String followId;
@ApiModelProperty(value = "关注者名字")
private String followName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@ -0,0 +1,56 @@
package com.dd.admin.business.follow.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 关注表
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("business_follow")
@ApiModel(value="Follow对象", description="关注表")
public class Follow implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "ID", type = IdType.ASSIGN_UUID)
private String id;
@ApiModelProperty(value = "被关注id")
@TableField("AUTHOR_ID")
private String authorId;
@ApiModelProperty(value = "被关注名字")
@TableField("AUTHOR_NAME")
private String authorName;
@ApiModelProperty(value = "关注者")
@TableField("FOLLOW_ID")
private String followId;
@ApiModelProperty(value = "关注者名字")
@TableField("FOLLOW_NAME")
private String followName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
}

View File

@ -0,0 +1,28 @@
package com.dd.admin.business.follow.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.business.follow.entity.Follow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dd.admin.business.follow.domain.FollowVo;
import com.dd.admin.business.follow.domain.FollowDto;
import java.util.List;
/**
* <p>
* 关注表 Mapper 接口
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Mapper
public interface FollowMapper extends BaseMapper<Follow> {
IPage<FollowVo> selectFollowPage(Page<FollowVo> page, @Param("followDto") FollowDto followDto);
List<FollowVo> selectFollowList(@Param("followDto") FollowDto followDto);
}

View File

@ -0,0 +1,31 @@
<?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.dd.admin.business.follow.mapper.FollowMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.dd.admin.business.follow.entity.Follow">
<id column="ID" property="id" />
<result column="AUTHOR_ID" property="authorId" />
<result column="AUTHOR_NAME" property="authorName" />
<result column="FOLLOW_ID" property="followId" />
<result column="FOLLOW_NAME" property="followName" />
<result column="CREATE_TIME" property="createTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ID, AUTHOR_ID, AUTHOR_NAME, FOLLOW_ID, FOLLOW_NAME, CREATE_TIME
</sql>
<select id="selectFollowPage" resultType="com.dd.admin.business.follow.domain.FollowVo">
select
*
from business_follow where 1 = 1
</select>
<select id="selectFollowList" resultType="com.dd.admin.business.follow.domain.FollowVo">
select
*
from business_follow where 1 = 1
</select>
</mapper>

View File

@ -0,0 +1,28 @@
package com.dd.admin.business.follow.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dd.admin.business.follow.entity.Follow;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dd.admin.business.follow.domain.FollowVo;
import com.dd.admin.business.follow.domain.FollowDto;
import java.util.List;
/**
* <p>
* 关注表 服务类
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
public interface FollowService extends IService<Follow> {
//关注表-分页列表
IPage<FollowVo> selectFollowPage(FollowDto followDto);
//关注表-列表
List<FollowVo> selectFollowList(FollowDto followDto);
List<Follow> selectFollowListByFollowId(String followId);
}

View File

@ -0,0 +1,44 @@
package com.dd.admin.business.follow.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.common.model.PageFactory;
import com.dd.admin.business.follow.entity.Follow;
import com.dd.admin.business.follow.mapper.FollowMapper;
import com.dd.admin.business.follow.service.FollowService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.dd.admin.business.follow.domain.FollowVo;
import com.dd.admin.business.follow.domain.FollowDto;
import java.util.List;
/**
* <p>
* 关注表 服务实现类
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Service
public class FollowServiceImpl extends ServiceImpl<FollowMapper, Follow> implements FollowService {
@Override
public IPage<FollowVo> selectFollowPage(FollowDto followDto) {
Page page = PageFactory.defaultPage();
return baseMapper.selectFollowPage(page,followDto);
}
@Override
public List<FollowVo> selectFollowList(FollowDto followDto) {
return baseMapper.selectFollowList(followDto);
}
@Override
public List<Follow> selectFollowListByFollowId(String followId) {
LambdaQueryWrapper<Follow> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Follow::getFollowId,followId);
return this.list(queryWrapper);
}
}

View File

@ -0,0 +1,88 @@
package com.dd.admin.business.starNotes.controller;
import cn.hutool.core.bean.BeanUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.dd.admin.common.model.UpdateGroup;
import com.dd.admin.common.model.result.ResultBean;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
import com.dd.admin.business.starNotes.entity.StarNotes;
import com.dd.admin.business.starNotes.domain.StarNotesVo;
import com.dd.admin.business.starNotes.domain.StarNotesDto;
import com.dd.admin.business.starNotes.service.StarNotesService;
import java.util.List;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 收藏笔记列表 前端控制器
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Api(tags = "收藏笔记列表")
@RestController
public class StarNotesController {
@Autowired
StarNotesService starNotesService;
@ApiOperation(value = "收藏笔记列表-分页列表")
@ApiOperationSupport(order = 1)
@GetMapping("/admin/starNotes/page")
public ResultBean<IPage<StarNotesVo>> page(StarNotesDto starNotesDto) {
IPage<StarNotesVo> pageInfo = starNotesService.selectStarNotesPage(starNotesDto);
return ResultBean.success(pageInfo);
}
@ApiOperation(value = "收藏笔记列表-列表")
@ApiOperationSupport(order = 2)
@GetMapping("/admin/starNotes/list")
public ResultBean<List<StarNotesVo>> list(StarNotesDto starNotesDto) {
List<StarNotesVo> list = starNotesService.selectStarNotesList(starNotesDto);
return ResultBean.success(list);
}
@ApiOperation(value = "收藏笔记列表-添加")
@ApiOperationSupport(order = 3)
@PostMapping("/admin/starNotes/add")
public ResultBean<StarNotes> add(@RequestBody @Validated StarNotesDto starNotesDto) {
StarNotes starNotes = BeanUtil.copyProperties(starNotesDto, StarNotes.class);
starNotesService.save(starNotes);
return ResultBean.success(starNotes);
}
@ApiOperation(value = "收藏笔记列表-查询")
@ApiOperationSupport(order = 4)
@GetMapping("/admin/starNotes/{starNotesId}")
public ResultBean<StarNotesVo> get(@PathVariable @NotBlank String starNotesId) {
StarNotes starNotes = starNotesService.getById(starNotesId);
StarNotesVo starNotesVo = BeanUtil.copyProperties(starNotes,StarNotesVo.class);
return ResultBean.success(starNotesVo);
}
@ApiOperation(value = "收藏笔记列表-修改")
@ApiOperationSupport(order = 5)
@PostMapping("/admin/starNotes/update")
public ResultBean<StarNotes> update(@RequestBody @Validated(UpdateGroup.class) StarNotesDto starNotesDto) {
StarNotes starNotes = BeanUtil.copyProperties(starNotesDto, StarNotes.class);
starNotesService.updateById(starNotes);
return ResultBean.success(starNotes);
}
@ApiOperation(value = "收藏笔记列表-删除")
@ApiOperationSupport(order = 6)
@GetMapping("/admin/starNotes/delete/{starNotesId}")
public ResultBean<StarNotes> delete(@PathVariable @NotBlank String starNotesId) {
Boolean b = starNotesService.removeById(starNotesId);
return ResultBean.success(b);
}
}

View File

@ -0,0 +1,55 @@
package com.dd.admin.business.starNotes.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import com.dd.admin.common.model.UpdateGroup;
/**
* <p>
* 收藏笔记列表返回对象
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@ApiModel(value="收藏笔记列表接收对象")
public class StarNotesDto {
@NotBlank(message = "收藏笔记列表id不能为空",groups = UpdateGroup.class)
private String starNoteId;
private String noteId;
private String noteTitle;
@ApiModelProperty(value = "被关注id")
private String authorId;
@ApiModelProperty(value = "被关注名字")
private String authorName;
@ApiModelProperty(value = "关注者")
private String followId;
@ApiModelProperty(value = "关注者名字")
private String followName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@ -0,0 +1,51 @@
package com.dd.admin.business.starNotes.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 收藏笔记列表返回对象
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@ApiModel(value="收藏笔记列表返回对象")
public class StarNotesVo {
private String starNoteId;
private String noteId;
private String noteTitle;
@ApiModelProperty(value = "被关注id")
private String authorId;
@ApiModelProperty(value = "被关注名字")
private String authorName;
@ApiModelProperty(value = "关注者")
private String followId;
@ApiModelProperty(value = "关注者名字")
private String followName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@ -0,0 +1,62 @@
package com.dd.admin.business.starNotes.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 收藏笔记列表
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("business_star_notes")
@ApiModel(value="StarNotes对象", description="收藏笔记列表")
public class StarNotes implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "STAR_NOTE_ID", type = IdType.ASSIGN_UUID)
private String starNoteId;
@TableField("NOTE_ID")
private String noteId;
@TableField("NOTE_TITLE")
private String noteTitle;
@ApiModelProperty(value = "被关注id")
@TableField("AUTHOR_ID")
private String authorId;
@ApiModelProperty(value = "被关注名字")
@TableField("AUTHOR_NAME")
private String authorName;
@ApiModelProperty(value = "关注者")
@TableField("FOLLOW_ID")
private String followId;
@ApiModelProperty(value = "关注者名字")
@TableField("FOLLOW_NAME")
private String followName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
}

View File

@ -0,0 +1,28 @@
package com.dd.admin.business.starNotes.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.business.starNotes.entity.StarNotes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dd.admin.business.starNotes.domain.StarNotesVo;
import com.dd.admin.business.starNotes.domain.StarNotesDto;
import java.util.List;
/**
* <p>
* 收藏笔记列表 Mapper 接口
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Mapper
public interface StarNotesMapper extends BaseMapper<StarNotes> {
IPage<StarNotesVo> selectStarNotesPage(Page<StarNotesVo> page, @Param("starNotesDto") StarNotesDto starNotesDto);
List<StarNotesVo> selectStarNotesList(@Param("starNotesDto") StarNotesDto starNotesDto);
}

View File

@ -0,0 +1,36 @@
<?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.dd.admin.business.starNotes.mapper.StarNotesMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.dd.admin.business.starNotes.entity.StarNotes">
<id column="STAR_NOTE_ID" property="starNoteId" />
<result column="NOTE_ID" property="noteId" />
<result column="NOTE_TITLE" property="noteTitle" />
<result column="AUTHOR_ID" property="authorId" />
<result column="AUTHOR_NAME" property="authorName" />
<result column="FOLLOW_ID" property="followId" />
<result column="FOLLOW_NAME" property="followName" />
<result column="CREATE_TIME" property="createTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
STAR_NOTE_ID, NOTE_ID, NOTE_TITLE, AUTHOR_ID, AUTHOR_NAME, FOLLOW_ID, FOLLOW_NAME, CREATE_TIME
</sql>
<select id="selectStarNotesPage" resultType="com.dd.admin.business.starNotes.domain.StarNotesVo">
select
*
from business_star_notes where 1 = 1
</select>
<select id="selectStarNotesList" resultType="com.dd.admin.business.starNotes.domain.StarNotesVo">
select
*
from business_star_notes where 1 = 1
<if test="starNotesDto.followId != null and starNotesDto.followId != ''">
and FOLLOW_ID = #{starNotesDto.followId}
</if>
</select>
</mapper>

View File

@ -0,0 +1,29 @@
package com.dd.admin.business.starNotes.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dd.admin.business.starNotes.entity.StarNotes;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dd.admin.business.starNotes.domain.StarNotesVo;
import com.dd.admin.business.starNotes.domain.StarNotesDto;
import com.dd.admin.business.upNotes.domain.UpNotesDto;
import com.dd.admin.business.upNotes.domain.UpNotesVo;
import java.util.List;
/**
* <p>
* 收藏笔记列表 服务类
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
public interface StarNotesService extends IService<StarNotes> {
//收藏笔记列表-分页列表
IPage<StarNotesVo> selectStarNotesPage(StarNotesDto starNotesDto);
//收藏笔记列表-列表
List<StarNotesVo> selectStarNotesList(StarNotesDto starNotesDto);
}

View File

@ -0,0 +1,36 @@
package com.dd.admin.business.starNotes.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.common.model.PageFactory;
import com.dd.admin.business.starNotes.entity.StarNotes;
import com.dd.admin.business.starNotes.mapper.StarNotesMapper;
import com.dd.admin.business.starNotes.service.StarNotesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.dd.admin.business.starNotes.domain.StarNotesVo;
import com.dd.admin.business.starNotes.domain.StarNotesDto;
import java.util.List;
/**
* <p>
* 收藏笔记列表 服务实现类
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Service
public class StarNotesServiceImpl extends ServiceImpl<StarNotesMapper, StarNotes> implements StarNotesService {
@Override
public IPage<StarNotesVo> selectStarNotesPage(StarNotesDto starNotesDto) {
Page page = PageFactory.defaultPage();
return baseMapper.selectStarNotesPage(page,starNotesDto);
}
@Override
public List<StarNotesVo> selectStarNotesList(StarNotesDto starNotesDto) {
return baseMapper.selectStarNotesList(starNotesDto);
}
}

View File

@ -0,0 +1,88 @@
package com.dd.admin.business.upNotes.controller;
import cn.hutool.core.bean.BeanUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.dd.admin.common.model.UpdateGroup;
import com.dd.admin.common.model.result.ResultBean;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
import com.dd.admin.business.upNotes.entity.UpNotes;
import com.dd.admin.business.upNotes.domain.UpNotesVo;
import com.dd.admin.business.upNotes.domain.UpNotesDto;
import com.dd.admin.business.upNotes.service.UpNotesService;
import java.util.List;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 点赞笔记列表 前端控制器
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Api(tags = "点赞笔记列表")
@RestController
public class UpNotesController {
@Autowired
UpNotesService upNotesService;
@ApiOperation(value = "点赞笔记列表-分页列表")
@ApiOperationSupport(order = 1)
@GetMapping("/admin/upNotes/page")
public ResultBean<IPage<UpNotesVo>> page(UpNotesDto upNotesDto) {
IPage<UpNotesVo> pageInfo = upNotesService.selectUpNotesPage(upNotesDto);
return ResultBean.success(pageInfo);
}
@ApiOperation(value = "点赞笔记列表-列表")
@ApiOperationSupport(order = 2)
@GetMapping("/admin/upNotes/list")
public ResultBean<List<UpNotesVo>> list(UpNotesDto upNotesDto) {
List<UpNotesVo> list = upNotesService.selectUpNotesList(upNotesDto);
return ResultBean.success(list);
}
@ApiOperation(value = "点赞笔记列表-添加")
@ApiOperationSupport(order = 3)
@PostMapping("/admin/upNotes/add")
public ResultBean<UpNotes> add(@RequestBody @Validated UpNotesDto upNotesDto) {
UpNotes upNotes = BeanUtil.copyProperties(upNotesDto, UpNotes.class);
upNotesService.save(upNotes);
return ResultBean.success(upNotes);
}
@ApiOperation(value = "点赞笔记列表-查询")
@ApiOperationSupport(order = 4)
@GetMapping("/admin/upNotes/{upNotesId}")
public ResultBean<UpNotesVo> get(@PathVariable @NotBlank String upNotesId) {
UpNotes upNotes = upNotesService.getById(upNotesId);
UpNotesVo upNotesVo = BeanUtil.copyProperties(upNotes,UpNotesVo.class);
return ResultBean.success(upNotesVo);
}
@ApiOperation(value = "点赞笔记列表-修改")
@ApiOperationSupport(order = 5)
@PostMapping("/admin/upNotes/update")
public ResultBean<UpNotes> update(@RequestBody @Validated(UpdateGroup.class) UpNotesDto upNotesDto) {
UpNotes upNotes = BeanUtil.copyProperties(upNotesDto, UpNotes.class);
upNotesService.updateById(upNotes);
return ResultBean.success(upNotes);
}
@ApiOperation(value = "点赞笔记列表-删除")
@ApiOperationSupport(order = 6)
@GetMapping("/admin/upNotes/delete/{upNotesId}")
public ResultBean<UpNotes> delete(@PathVariable @NotBlank String upNotesId) {
Boolean b = upNotesService.removeById(upNotesId);
return ResultBean.success(b);
}
}

View File

@ -0,0 +1,55 @@
package com.dd.admin.business.upNotes.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import com.dd.admin.common.model.UpdateGroup;
/**
* <p>
* 点赞笔记列表返回对象
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@ApiModel(value="点赞笔记列表接收对象")
public class UpNotesDto {
@NotBlank(message = "点赞笔记列表id不能为空",groups = UpdateGroup.class)
private String upNoteId;
private String noteId;
private String noteTitle;
@ApiModelProperty(value = "被关注id")
private String authorId;
@ApiModelProperty(value = "被关注名字")
private String authorName;
@ApiModelProperty(value = "关注者")
private String followId;
@ApiModelProperty(value = "关注者名字")
private String followName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@ -0,0 +1,53 @@
package com.dd.admin.business.upNotes.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 点赞笔记列表返回对象
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@ApiModel(value="点赞笔记列表返回对象")
public class UpNotesVo {
private String upNoteId;
private Integer upCount;
private String noteId;
private String noteTitle;
@ApiModelProperty(value = "被关注id")
private String authorId;
@ApiModelProperty(value = "被关注名字")
private String authorName;
@ApiModelProperty(value = "关注者")
private String followId;
@ApiModelProperty(value = "关注者名字")
private String followName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

View File

@ -0,0 +1,62 @@
package com.dd.admin.business.upNotes.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 点赞笔记列表
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("business_up_notes")
@ApiModel(value="UpNotes对象", description="点赞笔记列表")
public class UpNotes implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "UP_NOTE_ID", type = IdType.ASSIGN_UUID)
private String upNoteId;
@TableField("NOTE_ID")
private String noteId;
@TableField("NOTE_TITLE")
private String noteTitle;
@ApiModelProperty(value = "被关注id")
@TableField("AUTHOR_ID")
private String authorId;
@ApiModelProperty(value = "被关注名字")
@TableField("AUTHOR_NAME")
private String authorName;
@ApiModelProperty(value = "关注者")
@TableField("FOLLOW_ID")
private String followId;
@ApiModelProperty(value = "关注者名字")
@TableField("FOLLOW_NAME")
private String followName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
}

View File

@ -0,0 +1,32 @@
package com.dd.admin.business.upNotes.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.business.upNotes.entity.UpNotes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dd.admin.business.upNotes.domain.UpNotesVo;
import com.dd.admin.business.upNotes.domain.UpNotesDto;
import java.util.List;
/**
* <p>
* 点赞笔记列表 Mapper 接口
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Mapper
public interface UpNotesMapper extends BaseMapper<UpNotes> {
IPage<UpNotesVo> selectUpNotesPage(Page<UpNotesVo> page, @Param("upNotesDto") UpNotesDto upNotesDto);
List<UpNotesVo> selectUpNotesList(@Param("upNotesDto") UpNotesDto upNotesDto);
List<UpNotesVo> selectAllUpCount();
}

View File

@ -0,0 +1,39 @@
<?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.dd.admin.business.upNotes.mapper.UpNotesMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.dd.admin.business.upNotes.entity.UpNotes">
<id column="UP_NOTE_ID" property="upNoteId" />
<result column="NOTE_ID" property="noteId" />
<result column="NOTE_TITLE" property="noteTitle" />
<result column="AUTHOR_ID" property="authorId" />
<result column="AUTHOR_NAME" property="authorName" />
<result column="FOLLOW_ID" property="followId" />
<result column="FOLLOW_NAME" property="followName" />
<result column="CREATE_TIME" property="createTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
UP_NOTE_ID, NOTE_ID, NOTE_TITLE, AUTHOR_ID, AUTHOR_NAME, FOLLOW_ID, FOLLOW_NAME, CREATE_TIME
</sql>
<select id="selectUpNotesPage" resultType="com.dd.admin.business.upNotes.domain.UpNotesVo">
select
*
from business_up_notes where 1 = 1
</select>
<select id="selectUpNotesList" resultType="com.dd.admin.business.upNotes.domain.UpNotesVo">
select
*
from business_up_notes where 1 = 1
<if test="upNotesDto.followId != null and upNotesDto.followId != ''">
and FOLLOW_ID = #{upNotesDto.followId}
</if>
</select>
<select id="selectAllUpCount" resultType="com.dd.admin.business.upNotes.domain.UpNotesVo">
select note_id,count(1) upCount from business_up_notes group by NOTE_ID
</select>
</mapper>

View File

@ -0,0 +1,30 @@
package com.dd.admin.business.upNotes.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dd.admin.business.upNotes.entity.UpNotes;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dd.admin.business.upNotes.domain.UpNotesVo;
import com.dd.admin.business.upNotes.domain.UpNotesDto;
import java.util.List;
/**
* <p>
* 点赞笔记列表 服务类
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
public interface UpNotesService extends IService<UpNotes> {
//点赞笔记列表-分页列表
IPage<UpNotesVo> selectUpNotesPage(UpNotesDto upNotesDto);
//点赞笔记列表-列表
List<UpNotesVo> selectUpNotesList(UpNotesDto upNotesDto);
List<UpNotesVo> selectAllUpCount();
UpNotes selectOneByFollowId(String noteId,String authorId,String followId);
}

View File

@ -0,0 +1,51 @@
package com.dd.admin.business.upNotes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.common.model.PageFactory;
import com.dd.admin.business.upNotes.entity.UpNotes;
import com.dd.admin.business.upNotes.mapper.UpNotesMapper;
import com.dd.admin.business.upNotes.service.UpNotesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.dd.admin.business.upNotes.domain.UpNotesVo;
import com.dd.admin.business.upNotes.domain.UpNotesDto;
import java.util.List;
/**
* <p>
* 点赞笔记列表 服务实现类
* </p>
*
* @author 727869402@qq.com
* @since 2024-12-24
*/
@Service
public class UpNotesServiceImpl extends ServiceImpl<UpNotesMapper, UpNotes> implements UpNotesService {
@Override
public IPage<UpNotesVo> selectUpNotesPage(UpNotesDto upNotesDto) {
Page page = PageFactory.defaultPage();
return baseMapper.selectUpNotesPage(page,upNotesDto);
}
@Override
public List<UpNotesVo> selectUpNotesList(UpNotesDto upNotesDto) {
return baseMapper.selectUpNotesList(upNotesDto);
}
@Override
public List<UpNotesVo> selectAllUpCount() {
return baseMapper.selectAllUpCount();
}
@Override
public UpNotes selectOneByFollowId(String noteId,String authorId, String followId) {
LambdaQueryWrapper<UpNotes> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(UpNotes::getNoteId,noteId);
queryWrapper.eq(UpNotes::getAuthorId,authorId);
queryWrapper.eq(UpNotes::getFollowId,followId);
return this.getOne(queryWrapper);
}
}