From 6513a5b5f3449def38f027cecdb5145ce0c850a4 Mon Sep 17 00:00:00 2001 From: haotianmingyue <2421912570@qq.com> Date: Thu, 26 Dec 2024 11:22:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=8F=91=E5=B8=83--=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0--FollowInfo=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FollowInfoController.java | 104 +++++++++++++++++ .../com/ruoyi/system/domain/FollowInfo.java | 110 ++++++++++++++++++ .../ruoyi/system/mapper/FollowInfoMapper.java | 61 ++++++++++ .../system/service/IFollowInfoService.java | 61 ++++++++++ .../service/impl/FollowInfoServiceImpl.java | 93 +++++++++++++++ .../mapper/system/FollowInfoMapper.xml | 79 +++++++++++++ 6 files changed, 508 insertions(+) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/FollowInfoController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/FollowInfo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/FollowInfoMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IFollowInfoService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FollowInfoServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/FollowInfoMapper.xml diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/FollowInfoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/FollowInfoController.java new file mode 100644 index 00000000..1c6cb660 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/FollowInfoController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.FollowInfo; +import com.ruoyi.system.service.IFollowInfoService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 关注信息Controller + * + * @author haotian + * @date 2024-12-26 + */ +@RestController +@RequestMapping("/system/info") +public class FollowInfoController extends BaseController +{ + @Autowired + private IFollowInfoService followInfoService; + + /** + * 查询关注信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:info:list')") + @GetMapping("/list") + public TableDataInfo list(FollowInfo followInfo) + { + startPage(); + List list = followInfoService.selectFollowInfoList(followInfo); + return getDataTable(list); + } + + /** + * 导出关注信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:info:export')") + @Log(title = "关注信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, FollowInfo followInfo) + { + List list = followInfoService.selectFollowInfoList(followInfo); + ExcelUtil util = new ExcelUtil(FollowInfo.class); + util.exportExcel(response, list, "关注信息数据"); + } + + /** + * 获取关注信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:info:query')") + @GetMapping(value = "/{followInfoId}") + public AjaxResult getInfo(@PathVariable("followInfoId") Long followInfoId) + { + return success(followInfoService.selectFollowInfoByFollowInfoId(followInfoId)); + } + + /** + * 新增关注信息 + */ + @PreAuthorize("@ss.hasPermi('system:info:add')") + @Log(title = "关注信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FollowInfo followInfo) + { + return toAjax(followInfoService.insertFollowInfo(followInfo)); + } + + /** + * 修改关注信息 + */ + @PreAuthorize("@ss.hasPermi('system:info:edit')") + @Log(title = "关注信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FollowInfo followInfo) + { + return toAjax(followInfoService.updateFollowInfo(followInfo)); + } + + /** + * 删除关注信息 + */ + @PreAuthorize("@ss.hasPermi('system:info:remove')") + @Log(title = "关注信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{followInfoIds}") + public AjaxResult remove(@PathVariable Long[] followInfoIds) + { + return toAjax(followInfoService.deleteFollowInfoByFollowInfoIds(followInfoIds)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/FollowInfo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/FollowInfo.java new file mode 100644 index 00000000..d011323e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/FollowInfo.java @@ -0,0 +1,110 @@ +package com.ruoyi.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 关注信息对象 follow_info + * + * @author haotian + * @date 2024-12-26 + */ +public class FollowInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 关注信息id,主键,唯一 */ + private Long followInfoId; + + /** 关注者id,关联user_account中的user_id */ + @Excel(name = "关注者id,关联user_account中的user_id") + private String followerId; + + /** 被关注者id */ + @Excel(name = "被关注者id") + private String userId; + + /** 关注时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "关注时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date followTime; + + /** 删除标志:0代表未删除,1代表删除 */ + private String delFlag; + + /** 关注状态:0单方面关注,1互关 */ + @Excel(name = "关注状态:0单方面关注,1互关") + private String followStatus; + + public void setFollowInfoId(Long followInfoId) + { + this.followInfoId = followInfoId; + } + + public Long getFollowInfoId() + { + return followInfoId; + } + public void setFollowerId(String followerId) + { + this.followerId = followerId; + } + + public String getFollowerId() + { + return followerId; + } + public void setUserId(String userId) + { + this.userId = userId; + } + + public String getUserId() + { + return userId; + } + public void setFollowTime(Date followTime) + { + this.followTime = followTime; + } + + public Date getFollowTime() + { + return followTime; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + public void setFollowStatus(String followStatus) + { + this.followStatus = followStatus; + } + + public String getFollowStatus() + { + return followStatus; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("followInfoId", getFollowInfoId()) + .append("followerId", getFollowerId()) + .append("userId", getUserId()) + .append("followTime", getFollowTime()) + .append("delFlag", getDelFlag()) + .append("remark", getRemark()) + .append("followStatus", getFollowStatus()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FollowInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FollowInfoMapper.java new file mode 100644 index 00000000..729c9419 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FollowInfoMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.FollowInfo; + +/** + * 关注信息Mapper接口 + * + * @author haotian + * @date 2024-12-26 + */ +public interface FollowInfoMapper +{ + /** + * 查询关注信息 + * + * @param followInfoId 关注信息主键 + * @return 关注信息 + */ + public FollowInfo selectFollowInfoByFollowInfoId(Long followInfoId); + + /** + * 查询关注信息列表 + * + * @param followInfo 关注信息 + * @return 关注信息集合 + */ + public List selectFollowInfoList(FollowInfo followInfo); + + /** + * 新增关注信息 + * + * @param followInfo 关注信息 + * @return 结果 + */ + public int insertFollowInfo(FollowInfo followInfo); + + /** + * 修改关注信息 + * + * @param followInfo 关注信息 + * @return 结果 + */ + public int updateFollowInfo(FollowInfo followInfo); + + /** + * 删除关注信息 + * + * @param followInfoId 关注信息主键 + * @return 结果 + */ + public int deleteFollowInfoByFollowInfoId(Long followInfoId); + + /** + * 批量删除关注信息 + * + * @param followInfoIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteFollowInfoByFollowInfoIds(Long[] followInfoIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IFollowInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IFollowInfoService.java new file mode 100644 index 00000000..9c2a9052 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IFollowInfoService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.FollowInfo; + +/** + * 关注信息Service接口 + * + * @author haotian + * @date 2024-12-26 + */ +public interface IFollowInfoService +{ + /** + * 查询关注信息 + * + * @param followInfoId 关注信息主键 + * @return 关注信息 + */ + public FollowInfo selectFollowInfoByFollowInfoId(Long followInfoId); + + /** + * 查询关注信息列表 + * + * @param followInfo 关注信息 + * @return 关注信息集合 + */ + public List selectFollowInfoList(FollowInfo followInfo); + + /** + * 新增关注信息 + * + * @param followInfo 关注信息 + * @return 结果 + */ + public int insertFollowInfo(FollowInfo followInfo); + + /** + * 修改关注信息 + * + * @param followInfo 关注信息 + * @return 结果 + */ + public int updateFollowInfo(FollowInfo followInfo); + + /** + * 批量删除关注信息 + * + * @param followInfoIds 需要删除的关注信息主键集合 + * @return 结果 + */ + public int deleteFollowInfoByFollowInfoIds(Long[] followInfoIds); + + /** + * 删除关注信息信息 + * + * @param followInfoId 关注信息主键 + * @return 结果 + */ + public int deleteFollowInfoByFollowInfoId(Long followInfoId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FollowInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FollowInfoServiceImpl.java new file mode 100644 index 00000000..d95b30e4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FollowInfoServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.FollowInfoMapper; +import com.ruoyi.system.domain.FollowInfo; +import com.ruoyi.system.service.IFollowInfoService; + +/** + * 关注信息Service业务层处理 + * + * @author haotian + * @date 2024-12-26 + */ +@Service +public class FollowInfoServiceImpl implements IFollowInfoService +{ + @Autowired + private FollowInfoMapper followInfoMapper; + + /** + * 查询关注信息 + * + * @param followInfoId 关注信息主键 + * @return 关注信息 + */ + @Override + public FollowInfo selectFollowInfoByFollowInfoId(Long followInfoId) + { + return followInfoMapper.selectFollowInfoByFollowInfoId(followInfoId); + } + + /** + * 查询关注信息列表 + * + * @param followInfo 关注信息 + * @return 关注信息 + */ + @Override + public List selectFollowInfoList(FollowInfo followInfo) + { + return followInfoMapper.selectFollowInfoList(followInfo); + } + + /** + * 新增关注信息 + * + * @param followInfo 关注信息 + * @return 结果 + */ + @Override + public int insertFollowInfo(FollowInfo followInfo) + { + return followInfoMapper.insertFollowInfo(followInfo); + } + + /** + * 修改关注信息 + * + * @param followInfo 关注信息 + * @return 结果 + */ + @Override + public int updateFollowInfo(FollowInfo followInfo) + { + return followInfoMapper.updateFollowInfo(followInfo); + } + + /** + * 批量删除关注信息 + * + * @param followInfoIds 需要删除的关注信息主键 + * @return 结果 + */ + @Override + public int deleteFollowInfoByFollowInfoIds(Long[] followInfoIds) + { + return followInfoMapper.deleteFollowInfoByFollowInfoIds(followInfoIds); + } + + /** + * 删除关注信息信息 + * + * @param followInfoId 关注信息主键 + * @return 结果 + */ + @Override + public int deleteFollowInfoByFollowInfoId(Long followInfoId) + { + return followInfoMapper.deleteFollowInfoByFollowInfoId(followInfoId); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/FollowInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/system/FollowInfoMapper.xml new file mode 100644 index 00000000..ec582bef --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/FollowInfoMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + select follow_info_id, follower_id, user_id, follow_time, del_flag, remark, follow_status from follow_info + + + + + + + + insert into follow_info + + follower_id, + user_id, + follow_time, + del_flag, + remark, + follow_status, + + + #{followerId}, + #{userId}, + #{followTime}, + #{delFlag}, + #{remark}, + #{followStatus}, + + + + + update follow_info + + follower_id = #{followerId}, + user_id = #{userId}, + follow_time = #{followTime}, + del_flag = #{delFlag}, + remark = #{remark}, + follow_status = #{followStatus}, + + where follow_info_id = #{followInfoId} + + + + delete from follow_info where follow_info_id = #{followInfoId} + + + + delete from follow_info where follow_info_id in + + #{followInfoId} + + + \ No newline at end of file