1.调整收货地址表数据结构以及接口

2.增加粉丝表数据结构以及接口
master
panqihua 2 years ago
parent f41c24f8d5
commit ff432fd2a9
  1. 98
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformFollowerController.java
  2. 6
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
  3. 23
      sql/ttsbg.sql
  4. 11
      ttsbg-platform/src/main/java/com/ruoyi/platform/domain/PlatformAddress.java
  5. 88
      ttsbg-platform/src/main/java/com/ruoyi/platform/domain/PlatformFollower.java
  6. 10
      ttsbg-platform/src/main/java/com/ruoyi/platform/mapper/PlatformFollowerMapper.java
  7. 61
      ttsbg-platform/src/main/java/com/ruoyi/platform/service/IPlatformFollowerService.java
  8. 1
      ttsbg-platform/src/main/java/com/ruoyi/platform/service/impl/PlatformAddressServiceImpl.java
  9. 90
      ttsbg-platform/src/main/java/com/ruoyi/platform/service/impl/PlatformFollowerServiceImpl.java
  10. 55
      ttsbg-platform/src/main/resources/mapper/platform/PlatformFollowerMapper.xml

@ -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<PlatformFollower> 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<PlatformFollower> list = platformFollowerService.selectPlatformFollowerList(userId);
ExcelUtil<PlatformFollower> 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));
}
}

@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="balance" column="balance" />
<result property="referrerId" column="referrer_id" />
<association property="referrerSysUser" javaType="SysUser">
<result property="phonenumber" column="referrer_phonenumber"/>
<result property="nickName" column="referrer_nickName"/>
</association>
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
@ -63,7 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wechat_nick_name,u.balance, d.dept_name, d.leader,referrer.phonenumber as referrer_phonenumber from sys_user u
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wechat_nick_name,u.balance,
d.dept_name, d.leader,referrer.nick_name as referrer_nickName from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user referrer on u.referrer_id = referrer.user_id
where u.del_flag = '0'

@ -25,7 +25,28 @@ create table ttsbg.platform_address
create_by varchar(64) null,
update_by varchar(64) null,
remark varchar(500) null,
update_time datetime null
update_time datetime null,
user_id bigint null comment '关联用户',
constraint platform_address_sys_user_user_id_fk
foreign key (user_id) references ttsbg.sys_user (user_id)
)
comment '收货地址表';
create table platform_follower
(
id bigint auto_increment
primary key,
create_time datetime default CURRENT_TIMESTAMP not null,
following bigint not null comment '关注的人',
follower bigint not null comment '粉丝',
constraint follower_user_id
foreign key (follower) references sys_user (user_id),
constraint following_user_id
foreign key (following) references sys_user (user_id)
)
comment '粉丝表';

@ -61,6 +61,17 @@ public class PlatformAddress extends BaseEntity {
@Excel(name = "是否默认")
private Boolean isDefault;
private Long userId;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public void setId(Long id) {
this.id = id;
}

@ -0,0 +1,88 @@
package com.ruoyi.platform.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 粉丝对象 platform_follower
*
* @author ruoyi
* @date 2023-01-13
*/
public class PlatformFollower extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* 关注的人
*/
@Excel(name = "关注的人")
private Long following;
/**
* 粉丝
*/
@Excel(name = "粉丝")
private Long follower;
private SysUser followingUser;
private SysUser followerUser;
public SysUser getFollowingUser() {
return followingUser;
}
public void setFollowingUser(SysUser followingUser) {
this.followingUser = followingUser;
}
public SysUser getFollowerUser() {
return followerUser;
}
public void setFollowerUser(SysUser followerUser) {
this.followerUser = followerUser;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setFollowing(Long following) {
this.following = following;
}
public Long getFollowing() {
return following;
}
public void setFollower(Long follower) {
this.follower = follower;
}
public Long getFollower() {
return follower;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("createTime", getCreateTime())
.append("following", getFollowing())
.append("follower", getFollower())
.toString();
}
}

@ -0,0 +1,10 @@
package com.ruoyi.platform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.platform.domain.PlatformFollower;
import java.util.List;
public interface PlatformFollowerMapper extends BaseMapper<PlatformFollower> {
List<PlatformFollower> selectPlatformFollowerList(Long userId);
}

@ -0,0 +1,61 @@
package com.ruoyi.platform.service;
import com.ruoyi.platform.domain.PlatformFollower;
import java.util.List;
/**
* 粉丝Service接口
*
* @author ruoyi
* @date 2023-01-13
*/
public interface IPlatformFollowerService {
/**
* 查询粉丝
*
* @param id 粉丝主键
* @return 粉丝
*/
public PlatformFollower selectPlatformFollowerById(Long id);
/**
* 查询粉丝列表
*
* @param platformFollower 粉丝
* @return 粉丝集合
*/
public List<PlatformFollower> selectPlatformFollowerList(Long userId);
/**
* 新增粉丝
*
* @param platformFollower 粉丝
* @return 结果
*/
public int insertPlatformFollower(PlatformFollower platformFollower);
/**
* 修改粉丝
*
* @param platformFollower 粉丝
* @return 结果
*/
public int updatePlatformFollower(PlatformFollower platformFollower);
/**
* 批量删除粉丝
*
* @param ids 需要删除的粉丝主键集合
* @return 结果
*/
public int deletePlatformFollowerByIds(Long[] ids);
/**
* 删除粉丝信息
*
* @param id 粉丝主键
* @return 结果
*/
public int deletePlatformFollowerById(Long id);
}

@ -45,6 +45,7 @@ public class PlatformAddressServiceImpl implements IPlatformAddressService {
if (platformAddress.getConsignee() != null) {
wrapper.like(PlatformAddress::getConsignee, platformAddress.getAddress());
}
wrapper.eq(PlatformAddress::getUserId, platformAddress.getUserId());
return platformAddressMapper.selectList(wrapper);
}

@ -0,0 +1,90 @@
package com.ruoyi.platform.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.platform.domain.PlatformFollower;
import com.ruoyi.platform.mapper.PlatformFollowerMapper;
import com.ruoyi.platform.service.IPlatformFollowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
* 粉丝Service业务层处理
*
* @author ruoyi
* @date 2023-01-13
*/
@Service
public class PlatformFollowerServiceImpl implements IPlatformFollowerService {
@Autowired
private PlatformFollowerMapper platformFollowerMapper;
/**
* 查询粉丝
*
* @param id 粉丝主键
* @return 粉丝
*/
@Override
public PlatformFollower selectPlatformFollowerById(Long id) {
return platformFollowerMapper.selectById(id);
}
/**
* 查询粉丝列表
*
* @param platformFollower 粉丝
* @return 粉丝
*/
@Override
public List<PlatformFollower> selectPlatformFollowerList(Long userId) {
return platformFollowerMapper.selectPlatformFollowerList(userId);
}
/**
* 新增粉丝
*
* @param platformFollower 粉丝
* @return 结果
*/
@Override
public int insertPlatformFollower(PlatformFollower platformFollower) {
platformFollower.setCreateTime(DateUtils.getNowDate());
return platformFollowerMapper.insert(platformFollower);
}
/**
* 修改粉丝
*
* @param platformFollower 粉丝
* @return 结果
*/
@Override
public int updatePlatformFollower(PlatformFollower platformFollower) {
return platformFollowerMapper.updateById(platformFollower);
}
/**
* 批量删除粉丝
*
* @param ids 需要删除的粉丝主键
* @return 结果
*/
@Override
public int deletePlatformFollowerByIds(Long[] ids) {
return platformFollowerMapper.deleteBatchIds(Arrays.asList(ids));
}
/**
* 删除粉丝信息
*
* @param id 粉丝主键
* @return 结果
*/
@Override
public int deletePlatformFollowerById(Long id) {
return platformFollowerMapper.deleteById(id);
}
}

@ -0,0 +1,55 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.platform.mapper.PlatformFollowerMapper">
<resultMap type="com.ruoyi.platform.domain.PlatformFollower" id="PlatformFollowerResult">
<id property="id" column="id"/>
<result property="following" column="following"/>
<result property="follower" column="follower"/>
<result property="createTime" column="bind_time"/>
<association property="followingUser" column="following"
javaType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult"/>
<association property="followerUser" column="follower"
javaType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult"/>
</resultMap>
<resultMap type="com.ruoyi.common.core.domain.entity.SysUser" id="SysUserResult">
<id property="userId" column="user_id"/>
<result property="nickName" column="nick_name"/>
<result property="phonenumber" column="phonenumber"/>
<result property="sex" column="sex"/>
<result property="avatar" column="avatar"/>
<result property="remark" column="remark"/>
<result property="wechatNickName" column="wechat_nick_name"/>
<result property="createTime" column="create_time"/>
<result property="loginDate" column="login_date"/>
<result property="referrerId" column="referrer_id"/>
<result property="status" column="status"/>
<association property="referrerSysUser" javaType="com.ruoyi.common.core.domain.entity.SysUser">
<result property="nickName" column="follower_referrer_nick_name"/>
</association>
</resultMap>
<select id="selectPlatformFollowerList" parameterType="Long" resultMap="PlatformFollowerResult">
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}
</select>
</mapper>
Loading…
Cancel
Save