最新代码
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package com.starry.admin.modules.follow.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 顾客关注陪玩信息Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/play/follow")
|
||||
public class PlayCustomFollowInfoController {
|
||||
@Resource
|
||||
private IPlayCustomFollowInfoService playCustomFollowInfoService;
|
||||
|
||||
/**
|
||||
* 查询顾客关注陪玩信息列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||
IPage<PlayCustomFollowInfoEntity> list = playCustomFollowInfoService.selectPlayCustomFollowInfoByPage(playCustomFollowInfo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取顾客关注陪玩信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playCustomFollowInfoService.selectPlayCustomFollowInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增顾客关注陪玩信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "顾客关注陪玩信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||
boolean success = playCustomFollowInfoService.create(playCustomFollowInfo);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改顾客关注陪玩信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||
@Log(title = "顾客关注陪玩信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update/{id}")
|
||||
public R update(@PathVariable String id, @RequestBody PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||
playCustomFollowInfo.setId(id);
|
||||
boolean success = playCustomFollowInfoService.update(playCustomFollowInfo);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除顾客关注陪玩信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "顾客关注陪玩信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playCustomFollowInfoService.deletePlayCustomFollowInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.starry.admin.modules.follow.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||
|
||||
/**
|
||||
* 顾客关注陪玩信息Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-30
|
||||
*/
|
||||
public interface PlayCustomFollowInfoMapper extends BaseMapper<PlayCustomFollowInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.starry.admin.modules.follow.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 顾客关注陪玩信息对象 play_custom_follow_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_custom_follow_info")
|
||||
public class PlayCustomFollowInfoEntity extends BaseEntity<PlayCustomFollowInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 顾客ID
|
||||
*/
|
||||
private String customUserId;
|
||||
|
||||
/**
|
||||
* 陪玩ID
|
||||
*/
|
||||
private String clerkUserId;
|
||||
|
||||
/**
|
||||
* 关注时间
|
||||
*/
|
||||
private Date followTime;
|
||||
|
||||
/**
|
||||
* 取消关注时间
|
||||
*/
|
||||
private Date unfollowTime;
|
||||
|
||||
/**
|
||||
* 关注状态[0:未关注,1:已关注]
|
||||
*/
|
||||
private String followState;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.starry.admin.modules.follow.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||
|
||||
/**
|
||||
* 顾客关注陪玩信息Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-30
|
||||
*/
|
||||
public interface IPlayCustomFollowInfoService extends IService<PlayCustomFollowInfoEntity> {
|
||||
/**
|
||||
* 查询顾客关注陪玩信息
|
||||
*
|
||||
* @param id 顾客关注陪玩信息主键
|
||||
* @return 顾客关注陪玩信息
|
||||
*/
|
||||
PlayCustomFollowInfoEntity selectPlayCustomFollowInfoById(String id);
|
||||
|
||||
/**
|
||||
* 修改关注状态
|
||||
*
|
||||
* @param customUserId 顾客ID
|
||||
* @param clarkUserId 陪玩ID
|
||||
* @return 关注状态[0:未关注,1:已关注]
|
||||
*/
|
||||
String queryFollowState(String customUserId, String clarkUserId);
|
||||
|
||||
/**
|
||||
* 修改关注状态
|
||||
*
|
||||
* @param customUserId 顾客ID
|
||||
* @param clarkUserId 陪玩ID
|
||||
* @param followState 关注状态[0:未关注,1:已关注]
|
||||
*/
|
||||
void updateFollowState(String customUserId, String clarkUserId, String followState);
|
||||
|
||||
/**
|
||||
* 查询顾客关注陪玩信息列表
|
||||
*
|
||||
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||
* @return 顾客关注陪玩信息集合
|
||||
*/
|
||||
IPage<PlayCustomFollowInfoEntity> selectPlayCustomFollowInfoByPage(PlayCustomFollowInfoEntity playCustomFollowInfo);
|
||||
|
||||
/**
|
||||
* 新增顾客关注陪玩信息
|
||||
*
|
||||
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayCustomFollowInfoEntity playCustomFollowInfo);
|
||||
|
||||
/**
|
||||
* 修改顾客关注陪玩信息
|
||||
*
|
||||
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayCustomFollowInfoEntity playCustomFollowInfo);
|
||||
|
||||
/**
|
||||
* 批量删除顾客关注陪玩信息
|
||||
*
|
||||
* @param ids 需要删除的顾客关注陪玩信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayCustomFollowInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除顾客关注陪玩信息信息
|
||||
*
|
||||
* @param id 顾客关注陪玩信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayCustomFollowInfoById(String id);
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.starry.admin.modules.follow.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.modules.follow.mapper.PlayCustomFollowInfoMapper;
|
||||
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 顾客关注陪玩信息Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-30
|
||||
*/
|
||||
@Service
|
||||
public class PlayCustomFollowInfoServiceImpl extends ServiceImpl<PlayCustomFollowInfoMapper, PlayCustomFollowInfoEntity> implements IPlayCustomFollowInfoService {
|
||||
@Resource
|
||||
private PlayCustomFollowInfoMapper playCustomFollowInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询顾客关注陪玩信息
|
||||
*
|
||||
* @param id 顾客关注陪玩信息主键
|
||||
* @return 顾客关注陪玩信息
|
||||
*/
|
||||
@Override
|
||||
public PlayCustomFollowInfoEntity selectPlayCustomFollowInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String queryFollowState(String customUserId, String clarkUserId) {
|
||||
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkUserId, clarkUserId);
|
||||
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomUserId, customUserId);
|
||||
PlayCustomFollowInfoEntity entity = this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||
return entity == null ? "0" : entity.getFollowState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFollowState(String customUserId, String clarkUserId, String followState) {
|
||||
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkUserId, clarkUserId);
|
||||
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomUserId, customUserId);
|
||||
PlayCustomFollowInfoEntity entity = this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||
if (entity == null) {
|
||||
entity = new PlayCustomFollowInfoEntity();
|
||||
entity.setCustomUserId(customUserId);
|
||||
entity.setFollowState(followState);
|
||||
entity.setClerkUserId(clarkUserId);
|
||||
entity.setFollowTime(new Date());
|
||||
this.baseMapper.insert(entity);
|
||||
} else {
|
||||
entity.setFollowState(followState);
|
||||
this.baseMapper.updateById(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询顾客关注陪玩信息列表
|
||||
*
|
||||
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||
* @return 顾客关注陪玩信息
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayCustomFollowInfoEntity> selectPlayCustomFollowInfoByPage(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||
Page<PlayCustomFollowInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增顾客关注陪玩信息
|
||||
*
|
||||
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||
if (StrUtil.isBlankIfStr(playCustomFollowInfo.getId())) {
|
||||
playCustomFollowInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playCustomFollowInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改顾客关注陪玩信息
|
||||
*
|
||||
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||
return updateById(playCustomFollowInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除顾客关注陪玩信息
|
||||
*
|
||||
* @param ids 需要删除的顾客关注陪玩信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayCustomFollowInfoByIds(String[] ids) {
|
||||
return playCustomFollowInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除顾客关注陪玩信息信息
|
||||
*
|
||||
* @param id 顾客关注陪玩信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayCustomFollowInfoById(String id) {
|
||||
return playCustomFollowInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user