feat(work): 添加关注和作品收藏功能
- 新增 TpFollow 和 TpWorks 表及相关实体类 - 实现关注和作品收藏的 CRUD 接口和业务逻辑 - 添加相关控制器和 Mapper 接口 - 更新 TpOrder 表,增加备用字段
This commit is contained in:
@@ -83,4 +83,19 @@ public class SysPicture extends BaseEntity {
|
||||
*/
|
||||
private Integer tenant;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 工种ID
|
||||
*/
|
||||
private Long work;
|
||||
|
||||
/**
|
||||
* 工种名称
|
||||
*/
|
||||
private String workName;
|
||||
|
||||
}
|
||||
|
||||
@@ -89,4 +89,23 @@ public class SysPictureBo extends BaseEntity {
|
||||
*/
|
||||
private String flags;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 工种ID
|
||||
*/
|
||||
private Long work;
|
||||
|
||||
/**
|
||||
* 工种名称
|
||||
*/
|
||||
private String workName;
|
||||
|
||||
/**
|
||||
* 图片集
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -109,4 +109,19 @@ public class SysPictureVo implements Serializable {
|
||||
*/
|
||||
private Integer tenant;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 工种ID
|
||||
*/
|
||||
private Long work;
|
||||
|
||||
/**
|
||||
* 工种名称
|
||||
*/
|
||||
private String workName;
|
||||
|
||||
}
|
||||
|
||||
@@ -192,4 +192,14 @@ public class SysUserVo implements Serializable {
|
||||
*/
|
||||
private Long num;
|
||||
|
||||
/**
|
||||
* 作品数量
|
||||
*/
|
||||
private Long workNum;
|
||||
|
||||
/**
|
||||
* 该用户作品集
|
||||
*/
|
||||
private List<SysPictureVo> pictures;
|
||||
|
||||
}
|
||||
|
||||
@@ -239,4 +239,12 @@ public interface ISysUserService {
|
||||
List<Long> getOrderTypeIds();
|
||||
|
||||
TableDataInfo<SysUserVo> getJSList(SysUserBo user, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
* @param bo
|
||||
* @param pageQuery
|
||||
* @return
|
||||
*/
|
||||
TableDataInfo<SysUserVo> selectPageList(SysUserBo bo, PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -92,8 +92,11 @@ public class SysPictureServiceImpl implements ISysPictureService {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysPicture> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getType() != null, SysPicture::getType, bo.getType());
|
||||
lqw.eq(bo.getUserId() != null, SysPicture::getUserId, bo.getUserId());
|
||||
lqw.eq(bo.getWork() != null, SysPicture::getWork, bo.getWork());
|
||||
lqw.eq(bo.getTenant() != null, SysPicture::getTenant, bo.getTenant());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getTitle()), SysPicture::getTitle, bo.getTitle());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getWorkName()), SysPicture::getWorkName, bo.getWorkName());
|
||||
lqw.eq(bo.getStatus() != null, SysPicture::getStatus, bo.getStatus());
|
||||
lqw.eq(bo.getSort() != null, SysPicture::getSort, bo.getSort());
|
||||
lqw.in(bo.getFlags() != null, SysPicture::getFlag, Arrays.asList(bo.getFlags().split(",")));
|
||||
|
||||
@@ -55,6 +55,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
private final SysPostMapper postMapper;
|
||||
private final SysUserRoleMapper userRoleMapper;
|
||||
private final SysUserPostMapper userPostMapper;
|
||||
private final SysPictureMapper pictureMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
||||
@@ -86,6 +87,27 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
*
|
||||
* @param bo
|
||||
* @param pageQuery
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysUserVo> selectPageList(SysUserBo bo, PageQuery pageQuery) {
|
||||
Page<SysUserVo> page = baseMapper.selectPageUserList2(pageQuery.build(), this.buildQueryWrapper1(bo));
|
||||
//统计该用户作品数量
|
||||
page.getRecords().forEach(r -> r.setWorkNum(pictureMapper.selectCount(new LambdaQueryWrapper<SysPicture>().eq(SysPicture::getUserId, r.getUserId()))));
|
||||
|
||||
//获取该用户最新的两个作品对象
|
||||
page.getRecords().forEach(r -> {
|
||||
List<SysPictureVo> pictures = pictureMapper.selectVoList(new LambdaQueryWrapper<SysPicture>().eq(SysPicture::getUserId, r.getUserId()).orderByDesc(SysPicture::getCreateTime).last("limit 3"));
|
||||
r.setPictures(pictures);
|
||||
});
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user