main
parent
c00a5e0b34
commit
f81eeef168
|
|
@ -0,0 +1,128 @@
|
||||||
|
package com.ruoyi.app.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.app.domain.AppUserDynamic;
|
||||||
|
import com.ruoyi.app.domain.vo.AppUserDynamicVo;
|
||||||
|
import com.ruoyi.app.service.IAppUserDynamicService;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
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.log.annotation.Log;
|
||||||
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.ruoyi.app.domain.AppUserCollect;
|
||||||
|
import com.ruoyi.app.service.IAppUserCollectService;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收藏Controller
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @date 2024-05-08
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/collect")
|
||||||
|
@Api(tags = "用户收藏" , description = "用户收藏")
|
||||||
|
public class AppUserCollectController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IAppUserCollectService appUserCollectService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAppUserDynamicService appUserDynamicService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户收藏列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("app:collect:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation(value = "查询用户收藏", notes = "查询用户收藏", httpMethod = "GET")
|
||||||
|
public TableDataInfo list(AppUserCollect appUserCollect)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<AppUserCollect> list = appUserCollectService.selectAppUserCollectList(appUserCollect);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出用户收藏列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("app:collect:export")
|
||||||
|
@Log(title = "用户收藏", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, AppUserCollect appUserCollect)
|
||||||
|
{
|
||||||
|
List<AppUserCollect> list = appUserCollectService.selectAppUserCollectList(appUserCollect);
|
||||||
|
ExcelUtil<AppUserCollect> util = new ExcelUtil<AppUserCollect>(AppUserCollect.class);
|
||||||
|
util.exportExcel(response, list, "用户收藏数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户收藏详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("app:collect:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiOperation(value = "获取用户收藏详细信息", notes = "获取用户收藏详细信息", httpMethod = "GET")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(appUserCollectService.selectAppUserCollectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户收藏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("app:collect:add")
|
||||||
|
@ApiOperation(value = "新增用户收藏", notes = "新增用户收藏", httpMethod = "POST")
|
||||||
|
@Log(title = "用户收藏", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
public AjaxResult add(@RequestBody AppUserCollect appUserCollect)
|
||||||
|
{
|
||||||
|
return appUserCollectService.insertAppUserCollect(appUserCollect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户收藏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("app:collect:edit")
|
||||||
|
@ApiOperation(value = "修改用户收藏", notes = "修改用户收藏", httpMethod = "PUT")
|
||||||
|
@Log(title = "用户收藏", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/edit")
|
||||||
|
public AjaxResult edit(@RequestBody AppUserCollect appUserCollect)
|
||||||
|
{
|
||||||
|
return toAjax(appUserCollectService.updateAppUserCollect(appUserCollect));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户收藏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("app:collect:remove")
|
||||||
|
@Log(title = "用户收藏", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(appUserCollectService.deleteAppUserCollectByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/pageList")
|
||||||
|
@ApiOperation(value = "分页app用户收藏列表", notes = "分页app用户收藏列表", httpMethod = "GET")
|
||||||
|
public TableDataInfo pageList(AppUserDynamic appUserDynamic) {
|
||||||
|
startPage();
|
||||||
|
List<AppUserDynamicVo> list = appUserDynamicService.selectDynamicList(appUserDynamic);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.app.domain;
|
package com.ruoyi.app.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
|
@ -11,6 +12,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
* @author wyh
|
* @author wyh
|
||||||
* @date 2024-04-24
|
* @date 2024-04-24
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class AppDynamicLike extends BaseEntity
|
public class AppDynamicLike extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
@ -26,6 +28,8 @@ public class AppDynamicLike extends BaseEntity
|
||||||
@Excel(name = "动态id")
|
@Excel(name = "动态id")
|
||||||
private Long dynamicId;
|
private Long dynamicId;
|
||||||
|
|
||||||
|
private Long dynamicUserId;
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.ruoyi.app.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收藏对象 app_user_collect
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @date 2024-05-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AppUserCollect extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 我的id */
|
||||||
|
@Excel(name = "我的id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 动态id */
|
||||||
|
@Excel(name = "动态id")
|
||||||
|
private Long dynamicId;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setUserId(Long userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
public void setDynamicId(Long dynamicId)
|
||||||
|
{
|
||||||
|
this.dynamicId = dynamicId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDynamicId()
|
||||||
|
{
|
||||||
|
return dynamicId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("userId", getUserId())
|
||||||
|
.append("dynamicId", getDynamicId())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App用户动态对象 app_user_dynamic
|
* App用户动态对象 app_user_dynamic
|
||||||
*
|
*
|
||||||
|
|
@ -57,7 +59,13 @@ public class AppUserDynamic extends BaseEntity
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Excel(name = "是否会员")
|
@Excel(name = "是否会员")
|
||||||
private int isMember;
|
private Integer isMember;
|
||||||
|
|
||||||
|
@Excel(name = "是否收藏0是1否")
|
||||||
|
private int isCollect;
|
||||||
|
|
||||||
|
// 动态ids
|
||||||
|
private List<Long> ids;
|
||||||
|
|
||||||
public void setIsTop(Long isTop)
|
public void setIsTop(Long isTop)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,16 @@ public class AppUserVo extends AppUser
|
||||||
private String schoolName;
|
private String schoolName;
|
||||||
|
|
||||||
private List<UserSkill> userSkillList;
|
private List<UserSkill> userSkillList;
|
||||||
|
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
private int friendNum;
|
||||||
|
|
||||||
|
private int likeNum;
|
||||||
|
|
||||||
|
private int attentionNum;
|
||||||
|
|
||||||
|
private int fansNum;
|
||||||
public void setUserSkillList(List<UserSkill> userSkillList) {
|
public void setUserSkillList(List<UserSkill> userSkillList) {
|
||||||
this.userSkillList = userSkillList;
|
this.userSkillList = userSkillList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.ruoyi.app.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.app.domain.AppUserCollect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收藏Mapper接口
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @date 2024-05-08
|
||||||
|
*/
|
||||||
|
public interface AppUserCollectMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询用户收藏
|
||||||
|
*
|
||||||
|
* @param id 用户收藏主键
|
||||||
|
* @return 用户收藏
|
||||||
|
*/
|
||||||
|
public AppUserCollect selectAppUserCollectById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户收藏列表
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 用户收藏集合
|
||||||
|
*/
|
||||||
|
public List<AppUserCollect> selectAppUserCollectList(AppUserCollect appUserCollect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户收藏
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAppUserCollect(AppUserCollect appUserCollect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户收藏
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAppUserCollect(AppUserCollect appUserCollect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户收藏
|
||||||
|
*
|
||||||
|
* @param id 用户收藏主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppUserCollectById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户收藏
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppUserCollectByIds(Long[] ids);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ruoyi.app.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.app.domain.AppUserCollect;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收藏Service接口
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @date 2024-05-08
|
||||||
|
*/
|
||||||
|
public interface IAppUserCollectService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询用户收藏
|
||||||
|
*
|
||||||
|
* @param id 用户收藏主键
|
||||||
|
* @return 用户收藏
|
||||||
|
*/
|
||||||
|
public AppUserCollect selectAppUserCollectById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户收藏列表
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 用户收藏集合
|
||||||
|
*/
|
||||||
|
public List<AppUserCollect> selectAppUserCollectList(AppUserCollect appUserCollect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户收藏
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult insertAppUserCollect(AppUserCollect appUserCollect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户收藏
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAppUserCollect(AppUserCollect appUserCollect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户收藏
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的用户收藏主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppUserCollectByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户收藏信息
|
||||||
|
*
|
||||||
|
* @param id 用户收藏主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppUserCollectById(Long id);
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.ruoyi.app.service.impl;
|
package com.ruoyi.app.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.app.domain.AppUserDynamic;
|
||||||
|
import com.ruoyi.app.mapper.AppUserDynamicMapper;
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -20,6 +23,9 @@ public class AppDynamicLikeServiceImpl implements IAppDynamicLikeService
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppDynamicLikeMapper appDynamicLikeMapper;
|
private AppDynamicLikeMapper appDynamicLikeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AppUserDynamicMapper appUserDynamicMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询动态点赞
|
* 查询动态点赞
|
||||||
*
|
*
|
||||||
|
|
@ -53,6 +59,10 @@ public class AppDynamicLikeServiceImpl implements IAppDynamicLikeService
|
||||||
@Override
|
@Override
|
||||||
public int insertAppDynamicLike(AppDynamicLike appDynamicLike)
|
public int insertAppDynamicLike(AppDynamicLike appDynamicLike)
|
||||||
{
|
{
|
||||||
|
AppUserDynamic appUserDynamic = appUserDynamicMapper.selectAppUserDynamicById(appDynamicLike.getDynamicUserId());
|
||||||
|
if (appUserDynamic != null) {
|
||||||
|
appDynamicLike.setDynamicUserId(appUserDynamic.getUserId());
|
||||||
|
}
|
||||||
appDynamicLike.setCreateTime(DateUtils.getNowDate());
|
appDynamicLike.setCreateTime(DateUtils.getNowDate());
|
||||||
return appDynamicLikeMapper.insertAppDynamicLike(appDynamicLike);
|
return appDynamicLikeMapper.insertAppDynamicLike(appDynamicLike);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
package com.ruoyi.app.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.app.domain.AppUserDynamic;
|
||||||
|
import com.ruoyi.app.mapper.AppUserDynamicMapper;
|
||||||
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.app.mapper.AppUserCollectMapper;
|
||||||
|
import com.ruoyi.app.domain.AppUserCollect;
|
||||||
|
import com.ruoyi.app.service.IAppUserCollectService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收藏Service业务层处理
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @date 2024-05-08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AppUserCollectServiceImpl implements IAppUserCollectService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private AppUserCollectMapper appUserCollectMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AppUserDynamicMapper appUserDynamicMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户收藏
|
||||||
|
*
|
||||||
|
* @param id 用户收藏主键
|
||||||
|
* @return 用户收藏
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AppUserCollect selectAppUserCollectById(Long id)
|
||||||
|
{
|
||||||
|
return appUserCollectMapper.selectAppUserCollectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户收藏列表
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 用户收藏
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AppUserCollect> selectAppUserCollectList(AppUserCollect appUserCollect)
|
||||||
|
{
|
||||||
|
return appUserCollectMapper.selectAppUserCollectList(appUserCollect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户收藏
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult insertAppUserCollect(AppUserCollect appUserCollect) {
|
||||||
|
if (appUserCollect.getUserId() == null || appUserCollect.getDynamicId() == null) {
|
||||||
|
return AjaxResult.error("用户id不能为空和动态id不能为空");
|
||||||
|
}
|
||||||
|
AppUserDynamic appUserDynamic = appUserDynamicMapper.selectAppUserDynamicById(appUserCollect.getDynamicId());
|
||||||
|
if (appUserDynamic == null) {
|
||||||
|
return AjaxResult.error("该动态不存在");
|
||||||
|
}
|
||||||
|
if (appUserDynamic.getUserId() == appUserCollect.getUserId()) {
|
||||||
|
return AjaxResult.error("不能收藏自己的动态!");
|
||||||
|
}
|
||||||
|
appUserCollect.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return AjaxResult.success(appUserCollectMapper.insertAppUserCollect(appUserCollect));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户收藏
|
||||||
|
*
|
||||||
|
* @param appUserCollect 用户收藏
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateAppUserCollect(AppUserCollect appUserCollect)
|
||||||
|
{
|
||||||
|
appUserCollect.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return appUserCollectMapper.updateAppUserCollect(appUserCollect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户收藏
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的用户收藏主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAppUserCollectByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return appUserCollectMapper.deleteAppUserCollectByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户收藏信息
|
||||||
|
*
|
||||||
|
* @param id 用户收藏主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAppUserCollectById(Long id)
|
||||||
|
{
|
||||||
|
return appUserCollectMapper.deleteAppUserCollectById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,16 +4,13 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.ruoyi.app.domain.AppDynamicComment;
|
import com.ruoyi.app.domain.*;
|
||||||
import com.ruoyi.app.domain.AppDynamicImg;
|
|
||||||
import com.ruoyi.app.domain.AppDynamicLike;
|
|
||||||
import com.ruoyi.app.domain.vo.AppUserDynamicVo;
|
import com.ruoyi.app.domain.vo.AppUserDynamicVo;
|
||||||
import com.ruoyi.app.mapper.*;
|
import com.ruoyi.app.mapper.*;
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.app.domain.AppUserDynamic;
|
|
||||||
import com.ruoyi.app.service.IAppUserDynamicService;
|
import com.ruoyi.app.service.IAppUserDynamicService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,6 +37,9 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppTopicMapper appTopicMapper;
|
private AppTopicMapper appTopicMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AppUserCollectMapper appUserCollectMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询App用户动态
|
* 查询App用户动态
|
||||||
*
|
*
|
||||||
|
|
@ -139,6 +139,12 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AppUserDynamicVo> selectDynamicList(AppUserDynamic appUserDynamic) {
|
public List<AppUserDynamicVo> selectDynamicList(AppUserDynamic appUserDynamic) {
|
||||||
|
if (appUserDynamic.getIsCollect() == 1 && appUserDynamic.getAppId() != null) {
|
||||||
|
AppUserCollect appUserCollect = new AppUserCollect();
|
||||||
|
appUserCollect.setUserId(appUserDynamic.getAppId());
|
||||||
|
List<AppUserCollect> appUserCollects = appUserCollectMapper.selectAppUserCollectList(appUserCollect);
|
||||||
|
appUserDynamic.setIds(appUserCollects.stream().map(x->x.getDynamicId()).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
List<AppUserDynamicVo> list = appUserDynamicMapper.selectDynamicList(appUserDynamic);
|
List<AppUserDynamicVo> list = appUserDynamicMapper.selectDynamicList(appUserDynamic);
|
||||||
for (AppUserDynamicVo appUserDynamicVo : list) {
|
for (AppUserDynamicVo appUserDynamicVo : list) {
|
||||||
Long id = appUserDynamicVo.getId();
|
Long id = appUserDynamicVo.getId();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="userId" column="user_id" />
|
<result property="userId" column="user_id" />
|
||||||
<result property="dynamicId" column="dynamic_id" />
|
<result property="dynamicId" column="dynamic_id" />
|
||||||
|
<result property="dynamicUserId" column="dynamic_user_id" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
|
|
@ -16,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAppDynamicLikeVo">
|
<sql id="selectAppDynamicLikeVo">
|
||||||
select id, user_id, dynamic_id, create_time, update_time, create_by, updateBy, remark from app_dynamic_like
|
select id, user_id, dynamic_id,dynamic_user_id, create_time, update_time, create_by, updateBy, remark from app_dynamic_like
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectAppDynamicLikeList" parameterType="AppDynamicLike" resultMap="AppDynamicLikeResult">
|
<select id="selectAppDynamicLikeList" parameterType="AppDynamicLike" resultMap="AppDynamicLikeResult">
|
||||||
|
|
@ -24,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<where>
|
<where>
|
||||||
<if test="userId != null "> and user_id = #{userId}</if>
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
<if test="dynamicId != null "> and dynamic_id = #{dynamicId}</if>
|
<if test="dynamicId != null "> and dynamic_id = #{dynamicId}</if>
|
||||||
|
<if test="dynamicUserId != null "> and dynamic_user_id = #{dynamicUserId}</if>
|
||||||
<if test="updateBy != null and updateBy != ''"> and updateBy = #{updateBy}</if>
|
<if test="updateBy != null and updateBy != ''"> and updateBy = #{updateBy}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="userId != null">user_id,</if>
|
<if test="userId != null">user_id,</if>
|
||||||
<if test="dynamicId != null">dynamic_id,</if>
|
<if test="dynamicId != null">dynamic_id,</if>
|
||||||
|
<if test="dynamicUserId != null">dynamic_user_id,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
|
|
@ -47,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
<if test="dynamicId != null">#{dynamicId},</if>
|
<if test="dynamicId != null">#{dynamicId},</if>
|
||||||
|
<if test="dynamicUserId != null">#{dynamicUserId},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
|
@ -60,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="userId != null">user_id = #{userId},</if>
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
<if test="dynamicId != null">dynamic_id = #{dynamicId},</if>
|
<if test="dynamicId != null">dynamic_id = #{dynamicId},</if>
|
||||||
|
<if test="dynamicUserId != null">dynamic_user_id = #{dynamicUserId},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?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.ruoyi.app.mapper.AppUserCollectMapper">
|
||||||
|
|
||||||
|
<resultMap type="AppUserCollect" id="AppUserCollectResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="dynamicId" column="dynamic_id" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="updateBy" column="updateBy" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectAppUserCollectVo">
|
||||||
|
select id, user_id, dynamic_id, create_time, update_time, create_by, updateBy, remark from app_user_collect
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAppUserCollectList" parameterType="AppUserCollect" resultMap="AppUserCollectResult">
|
||||||
|
<include refid="selectAppUserCollectVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="dynamicId != null "> and dynamic_id = #{dynamicId}</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''"> and updateBy = #{updateBy}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAppUserCollectById" parameterType="Long" resultMap="AppUserCollectResult">
|
||||||
|
<include refid="selectAppUserCollectVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAppUserCollect" parameterType="AppUserCollect" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into app_user_collect
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="dynamicId != null">dynamic_id,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="updateBy != null">updateBy,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="dynamicId != null">#{dynamicId},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateAppUserCollect" parameterType="AppUserCollect">
|
||||||
|
update app_user_collect
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="dynamicId != null">dynamic_id = #{dynamicId},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="updateBy != null">updateBy = #{updateBy},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteAppUserCollectById" parameterType="Long">
|
||||||
|
delete from app_user_collect where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteAppUserCollectByIds" parameterType="String">
|
||||||
|
delete from app_user_collect where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -66,6 +66,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="updateBy != null and updateBy != ''"> and a.updateBy = #{updateBy}</if>
|
<if test="updateBy != null and updateBy != ''"> and a.updateBy = #{updateBy}</if>
|
||||||
<if test="isTop != null "> and a.is_top = #{isTop}</if>
|
<if test="isTop != null "> and a.is_top = #{isTop}</if>
|
||||||
<if test="isMember != null "> and u.is_member = #{isMember}</if>
|
<if test="isMember != null "> and u.is_member = #{isMember}</if>
|
||||||
|
<if test="ids != null and ids.size() > 0">
|
||||||
|
and a.id in
|
||||||
|
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by a.is_top,a.create_time
|
order by a.is_top,a.create_time
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectAppUserById" parameterType="Long" resultType="com.ruoyi.app.domain.vo.AppUserVo">
|
<select id="selectAppUserById" parameterType="Long" resultType="com.ruoyi.app.domain.vo.AppUserVo">
|
||||||
select
|
select
|
||||||
<include refid="appUserColumns"/>,
|
<include refid="appUserColumns"/>,
|
||||||
s.name as "schoolName"
|
s.name as "schoolName",
|
||||||
|
t.name as "cityName",
|
||||||
|
count(DISTINCT(r.id)) as "friendNum",
|
||||||
|
count(DISTINCT(l.id)) as "likeNum",
|
||||||
|
count(DISTINCT(f.id)) as "attentionNum",
|
||||||
|
count(DISTINCT(fa.id)) as "fansNum"
|
||||||
from app_user a
|
from app_user a
|
||||||
left join app_school s on s.id = a.school
|
left join app_school s on s.id = a.school
|
||||||
|
left join app_user_fans f on f.user_id = a.id
|
||||||
|
left join app_user_fans fa on fa.friend_id = a.id
|
||||||
|
left join app_user_friend r on r.user_id = a.id
|
||||||
|
left join app_dynamic_like l on l.dynamic_user_id = a.id
|
||||||
|
left join app_town t on t.id = a.address
|
||||||
where a.id = #{id}
|
where a.id = #{id}
|
||||||
|
group by a.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectList" parameterType="AppUser" resultType="com.ruoyi.app.domain.vo.AppUserDataVo">
|
<select id="selectList" parameterType="AppUser" resultType="com.ruoyi.app.domain.vo.AppUserDataVo">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue