From ff432fd2a9b4349db2d577ba7b07e893e2c749b3 Mon Sep 17 00:00:00 2001 From: panqihua Date: Sat, 14 Jan 2023 12:08:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E6=94=B6=E8=B4=A7=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E8=A1=A8=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=8E=A5=E5=8F=A3=202.=E5=A2=9E=E5=8A=A0=E7=B2=89?= =?UTF-8?q?=E4=B8=9D=E8=A1=A8=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/PlatformFollowerController.java | 98 +++++++++++++++++++ .../resources/mapper/system/SysUserMapper.xml | 6 +- sql/ttsbg.sql | 23 ++++- .../platform/domain/PlatformAddress.java | 11 +++ .../platform/domain/PlatformFollower.java | 88 +++++++++++++++++ .../mapper/PlatformFollowerMapper.java | 10 ++ .../service/IPlatformFollowerService.java | 61 ++++++++++++ .../impl/PlatformAddressServiceImpl.java | 1 + .../impl/PlatformFollowerServiceImpl.java | 90 +++++++++++++++++ .../platform/PlatformFollowerMapper.xml | 55 +++++++++++ 10 files changed, 440 insertions(+), 3 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformFollowerController.java create mode 100644 ttsbg-platform/src/main/java/com/ruoyi/platform/domain/PlatformFollower.java create mode 100644 ttsbg-platform/src/main/java/com/ruoyi/platform/mapper/PlatformFollowerMapper.java create mode 100644 ttsbg-platform/src/main/java/com/ruoyi/platform/service/IPlatformFollowerService.java create mode 100644 ttsbg-platform/src/main/java/com/ruoyi/platform/service/impl/PlatformFollowerServiceImpl.java create mode 100644 ttsbg-platform/src/main/resources/mapper/platform/PlatformFollowerMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformFollowerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformFollowerController.java new file mode 100644 index 0000000..9ca9154 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformFollowerController.java @@ -0,0 +1,98 @@ +package com.ruoyi.platform.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.platform.domain.PlatformFollower; +import com.ruoyi.platform.service.IPlatformFollowerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 粉丝Controller + * + * @author ruoyi + * @date 2023-01-13 + */ +@RestController +@RequestMapping("/platform/follower") +public class PlatformFollowerController extends BaseController { + @Autowired + private IPlatformFollowerService platformFollowerService; + + /** + * 查询粉丝列表 + */ + @PreAuthorize("@ss.hasPermi('platform:follower:list')") + @GetMapping("/list/{userId}") + public TableDataInfo list(@PathVariable Long userId) { + if (userId != null) { + startPage(); + List list = platformFollowerService.selectPlatformFollowerList(userId); + return getDataTable(list); + } else { + TableDataInfo info = new TableDataInfo(); + info.setCode(400); + info.setMsg("参数不合法,userId不能为空!"); + return info; + } + } + + /** + * 导出粉丝列表 + */ + @PreAuthorize("@ss.hasPermi('platform:follower:export')") + @Log(title = "粉丝", businessType = BusinessType.EXPORT) + @PostMapping("/export/{userId}") + public void export(HttpServletResponse response, @PathVariable Long userId) { + List list = platformFollowerService.selectPlatformFollowerList(userId); + ExcelUtil util = new ExcelUtil<>(PlatformFollower.class); + util.exportExcel(response, list, "粉丝数据"); + } + + /** + * 获取粉丝详细信息 + */ + @PreAuthorize("@ss.hasPermi('platform:follower:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(platformFollowerService.selectPlatformFollowerById(id)); + } + + /** + * 新增粉丝 + */ + @PreAuthorize("@ss.hasPermi('platform:follower:add')") + @Log(title = "粉丝", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PlatformFollower platformFollower) { + return toAjax(platformFollowerService.insertPlatformFollower(platformFollower)); + } + + /** + * 修改粉丝 + */ + @PreAuthorize("@ss.hasPermi('platform:follower:edit')") + @Log(title = "粉丝", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PlatformFollower platformFollower) { + return toAjax(platformFollowerService.updatePlatformFollower(platformFollower)); + } + + /** + * 删除粉丝 + */ + @PreAuthorize("@ss.hasPermi('platform:follower:remove')") + @Log(title = "粉丝", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(platformFollowerService.deletePlatformFollowerByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 003ac6b..c900b78 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -63,7 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select f.id, + f.following, + f.follower, + f.create_time as bind_time, + u2.user_id, + u2.nick_name, + u2.phonenumber, + u2.sex, + u2.avatar, + u2.wechat_nick_name, + u2.create_time, + u2.login_date, + u2.status, + u2r.nick_name as follower_referrer_nick_name + from platform_follower f + left join sys_user u1 on f.following = u1.user_id + left join sys_user u2 on f.follower = u2.user_id + left join sys_user u2r on u2.referrer_id = u2r.user_id + where f.following = #{userId} + +