新增顾客礼物图鉴接口

This commit is contained in:
admin
2024-06-05 18:25:29 +08:00
parent 883faf813f
commit 6d50bc1f0d
14 changed files with 504 additions and 6 deletions

View File

@@ -0,0 +1,77 @@
package com.starry.admin.modules.custom.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomGiftInfoService;
import com.starry.common.annotation.Log;
import com.starry.common.enums.BusinessType;
import com.starry.common.result.R;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 顾客和礼物关系Controller
*
* @author admin
* @since 2024-06-05
*/
@RestController
@RequestMapping("/custom/giff")
public class PlayCustomGiftInfoController {
@Resource
private IPlayCustomGiftInfoService playCustomGiftInfoService;
/**
* 查询顾客和礼物关系列表
*/
@GetMapping("/list")
public R list(PlayCustomGiftInfoEntity playCustomGiftInfo) {
IPage<PlayCustomGiftInfoEntity> list = playCustomGiftInfoService.selectPlayCustomGiftInfoByPage(playCustomGiftInfo);
return R.ok(list);
}
/**
* 获取顾客和礼物关系详细信息
*/
@GetMapping(value = "/{id}")
public R getInfo(@PathVariable("id") String id) {
return R.ok(playCustomGiftInfoService.selectPlayCustomGiftInfoById(id));
}
/**
* 新增顾客和礼物关系
*/
@Log(title = "顾客和礼物关系", businessType = BusinessType.INSERT)
@PostMapping("/create")
public R create(@RequestBody PlayCustomGiftInfoEntity playCustomGiftInfo) {
boolean success = playCustomGiftInfoService.create(playCustomGiftInfo);
if (success) {
return R.ok();
}
return R.error("添加失败");
}
/**
* 修改顾客和礼物关系
*/
@Log(title = "顾客和礼物关系", businessType = BusinessType.UPDATE)
@PostMapping(value = "/update/{id}")
public R update(@PathVariable String id, @RequestBody PlayCustomGiftInfoEntity playCustomGiftInfo) {
playCustomGiftInfo.setId(id);
boolean success = playCustomGiftInfoService.update(playCustomGiftInfo);
if (success) {
return R.ok();
}
return R.error("修改失败");
}
/**
* 删除顾客和礼物关系
*/
@Log(title = "顾客和礼物关系", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R remove(@PathVariable String[] ids) {
return R.ok(playCustomGiftInfoService.deletePlayCustomGiftInfoByIds(ids));
}
}

View File

@@ -0,0 +1,16 @@
package com.starry.admin.modules.custom.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
/**
* 顾客和礼物关系Mapper接口
*
* @author admin
* @since 2024-06-05
*/
public interface PlayCustomGiftInfoMapper extends MPJBaseMapper<PlayCustomGiftInfoEntity> {
}

View File

@@ -0,0 +1,45 @@
package com.starry.admin.modules.custom.module.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.starry.common.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 顾客和礼物关系对象 play_custom_gift_info
*
* @author admin
* @since 2024-06-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("play_custom_gift_info")
public class PlayCustomGiftInfoEntity extends BaseEntity<PlayCustomGiftInfoEntity> {
/**
* UUID
*/
private String id;
/**
* 租户ID
*/
private String tenantId;
/**
* 顾客ID
*/
private String customId;
/**
* 礼物ID
*/
private String giffId;
/**
* 礼物数量
*/
private Long giffNumber;
}

View File

@@ -0,0 +1,74 @@
package com.starry.admin.modules.custom.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
import java.util.List;
/**
* 顾客和礼物关系Service接口
*
* @author admin
* @since 2024-06-05
*/
public interface IPlayCustomGiftInfoService extends IService<PlayCustomGiftInfoEntity> {
/**
* 查询顾客已点亮礼物
*
* @param customId 顾客IF
* @return 顾客已点亮礼物列表
*/
List<PlayCustomGiftInfoEntity> selectBtyCustomId(String customId);
/**
* 查询顾客和礼物关系
*
* @param id 顾客和礼物关系主键
* @return 顾客和礼物关系
*/
PlayCustomGiftInfoEntity selectPlayCustomGiftInfoById(String id);
/**
* 查询顾客和礼物关系列表
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 顾客和礼物关系集合
*/
IPage<PlayCustomGiftInfoEntity> selectPlayCustomGiftInfoByPage(PlayCustomGiftInfoEntity playCustomGiftInfo);
/**
* 新增顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
boolean create(PlayCustomGiftInfoEntity playCustomGiftInfo);
/**
* 修改顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
boolean update(PlayCustomGiftInfoEntity playCustomGiftInfo);
/**
* 批量删除顾客和礼物关系
*
* @param ids 需要删除的顾客和礼物关系主键集合
* @return 结果
*/
int deletePlayCustomGiftInfoByIds(String[] ids);
/**
* 删除顾客和礼物关系信息
*
* @param id 顾客和礼物关系主键
* @return 结果
*/
int deletePlayCustomGiftInfoById(String id);
}

View File

@@ -0,0 +1,113 @@
package com.starry.admin.modules.custom.service.impl;
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.custom.mapper.PlayCustomGiftInfoMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomGiftInfoService;
import com.starry.common.utils.IdUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
* 顾客和礼物关系Service业务层处理
*
* @author admin
* @since 2024-06-05
*/
@Service
public class PlayCustomGiftInfoServiceImpl extends ServiceImpl<PlayCustomGiftInfoMapper, PlayCustomGiftInfoEntity> implements IPlayCustomGiftInfoService {
@Resource
private PlayCustomGiftInfoMapper playCustomGiftInfoMapper;
/**
* 根据店员ID查询店员活动礼物列表
*
* @param customId 店员ID
* @return 店员活动礼物列表
*/
@Override
public List<PlayCustomGiftInfoEntity> selectBtyCustomId(String customId) {
LambdaQueryWrapper<PlayCustomGiftInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PlayCustomGiftInfoEntity::getCustomId, customId);
return this.baseMapper.selectList(lambdaQueryWrapper);
}
/**
* 查询顾客和礼物关系
*
* @param id 顾客和礼物关系主键
* @return 顾客和礼物关系
*/
@Override
public PlayCustomGiftInfoEntity selectPlayCustomGiftInfoById(String id) {
return this.baseMapper.selectById(id);
}
/**
* 查询顾客和礼物关系列表
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 顾客和礼物关系
*/
@Override
public IPage<PlayCustomGiftInfoEntity> selectPlayCustomGiftInfoByPage(PlayCustomGiftInfoEntity playCustomGiftInfo) {
Page<PlayCustomGiftInfoEntity> page = new Page<>(1, 10);
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayCustomGiftInfoEntity>());
}
/**
* 新增顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
@Override
public boolean create(PlayCustomGiftInfoEntity playCustomGiftInfo) {
if (StrUtil.isBlankIfStr(playCustomGiftInfo.getId())) {
playCustomGiftInfo.setId(IdUtils.getUuid());
}
return save(playCustomGiftInfo);
}
/**
* 修改顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
@Override
public boolean update(PlayCustomGiftInfoEntity playCustomGiftInfo) {
return updateById(playCustomGiftInfo);
}
/**
* 批量删除顾客和礼物关系
*
* @param ids 需要删除的顾客和礼物关系主键
* @return 结果
*/
@Override
public int deletePlayCustomGiftInfoByIds(String[] ids) {
return playCustomGiftInfoMapper.deleteBatchIds(Arrays.asList(ids));
}
/**
* 删除顾客和礼物关系信息
*
* @param id 顾客和礼物关系主键
* @return 结果
*/
@Override
public int deletePlayCustomGiftInfoById(String id) {
return playCustomGiftInfoMapper.deleteById(id);
}
}