This commit is contained in:
admin
2024-05-08 21:21:29 +08:00
parent 2919029b81
commit 5838b2df35
138 changed files with 2861 additions and 1179 deletions

View File

@@ -0,0 +1,79 @@
package com.starry.admin.modules.custom.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.custom.module.entity.PlayCustomLeaveMsgEntity;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgQueryVo;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgReturnVo;
import com.starry.admin.modules.custom.service.IPlayCustomLeaveMsgService;
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-05-07
*/
@RestController
@RequestMapping("/custom/leave")
public class PlayCustomLeaveMsgController {
@Resource
private IPlayCustomLeaveMsgService playCustomLeaveMsgService;
/**
* 分页查询顾客留言列表
*/
@PostMapping("/list")
public R list(@RequestBody PlayCustomLeaveMsgQueryVo vo) {
IPage<PlayCustomLeaveMsgReturnVo> list = playCustomLeaveMsgService.selectByPage(vo);
return R.ok(list);
}
/**
* 获取顾客留言详细信息
*/
@GetMapping(value = "/{id}")
public R getInfo(@PathVariable("id") String id) {
return R.ok(playCustomLeaveMsgService.selectPlayCustomLeaveMsgById(id));
}
/**
* 新增顾客留言
*/
@Log(title = "顾客留言", businessType = BusinessType.INSERT)
@PostMapping("/create")
public R create(@RequestBody PlayCustomLeaveMsgEntity playCustomLeaveMsg) {
boolean success = playCustomLeaveMsgService.create(playCustomLeaveMsg);
if (success) {
return R.ok();
}
return R.error("添加失败");
}
/**
* 修改顾客留言
*/
@Log(title = "顾客留言", businessType = BusinessType.UPDATE)
@PostMapping(value = "/update/{id}")
public R update(@PathVariable String id, @RequestBody PlayCustomLeaveMsgEntity playCustomLeaveMsg) {
playCustomLeaveMsg.setId(id);
boolean success = playCustomLeaveMsgService.update(playCustomLeaveMsg);
if (success) {
return R.ok();
}
return R.error("修改失败");
}
/**
* 删除顾客留言
*/
@Log(title = "顾客留言", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R remove(@PathVariable String[] ids) {
return R.ok(playCustomLeaveMsgService.deletePlayCustomLeaveMsgByIds(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.PlayCustomLeaveMsgEntity;
/**
* 顾客留言Mapper接口
*
* @author admin
* @since 2024-05-07
*/
public interface PlayCustomLeaveMsgMapper extends MPJBaseMapper<PlayCustomLeaveMsgEntity> {
}

View File

@@ -0,0 +1,56 @@
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;
import java.util.Date;
/**
* 顾客留言对象 play_custom_leave_msg
*
* @author admin
* @since 2024-05-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("play_custom_leave_msg")
public class PlayCustomLeaveMsgEntity extends BaseEntity<PlayCustomLeaveMsgEntity> {
/**
* UUID
*/
private String id;
/**
* 租户ID
*/
private String tenantId;
/**
* 顾客ID
*/
private String customId;
/**
* 留言内容
*/
private String content;
/**
* 图片
*/
private String images;
/**
* 留言时间
*/
private Date msgTime;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,12 @@
package com.starry.admin.modules.custom.module.vo;
import com.starry.common.domain.BasePageEntity;
/**
* 顾客留言查询对象
*
* @author admin
* @since 2024/5/7 16:29
**/
public class PlayCustomLeaveMsgQueryVo extends BasePageEntity {
}

View File

@@ -0,0 +1,56 @@
package com.starry.admin.modules.custom.module.vo;
import lombok.Data;
import java.util.Date;
/**
* 顾客留言查询返回对象
*
* @author admin
* @since 2024/5/7 16:29
**/
@Data
public class PlayCustomLeaveMsgReturnVo {
/**
* UUID
*/
private String id;
/**
* 留言内容
*/
private String content;
/**
* 图片
*/
private String images;
/**
* 留言时间
*/
private Date msgTime;
/**
* 备注
*/
private String remark;
/**
* 顾客Id
*/
private String customId;
/**
* 顾客昵称
*/
private String customAvatar;
/**
* 头像
*/
private String customNickname;
}

View File

@@ -0,0 +1,72 @@
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.PlayCustomLeaveMsgEntity;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgQueryVo;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgReturnVo;
/**
* 顾客留言Service接口
*
* @author admin
* @since 2024-05-07
*/
public interface IPlayCustomLeaveMsgService extends IService<PlayCustomLeaveMsgEntity> {
/**
* 查询顾客留言
*
* @param id 顾客留言主键
* @return 顾客留言
*/
PlayCustomLeaveMsgEntity selectPlayCustomLeaveMsgById(String id);
/**
* 分页查询顾客留言列表
*
* @param vo 顾客留言分页查询对象
* @return 顾客留言集合
*/
IPage<PlayCustomLeaveMsgReturnVo> selectByPage(PlayCustomLeaveMsgQueryVo vo);
/**
* 查询顾客留言列表
*
* @param playCustomLeaveMsg 顾客留言
* @return 顾客留言集合
*/
IPage<PlayCustomLeaveMsgEntity> selectPlayCustomLeaveMsgByPage(PlayCustomLeaveMsgEntity playCustomLeaveMsg);
/**
* 新增顾客留言
*
* @param playCustomLeaveMsg 顾客留言
* @return 结果
*/
boolean create(PlayCustomLeaveMsgEntity playCustomLeaveMsg);
/**
* 修改顾客留言
*
* @param playCustomLeaveMsg 顾客留言
* @return 结果
*/
boolean update(PlayCustomLeaveMsgEntity playCustomLeaveMsg);
/**
* 批量删除顾客留言
*
* @param ids 需要删除的顾客留言主键集合
* @return 结果
*/
int deletePlayCustomLeaveMsgByIds(String[] ids);
/**
* 删除顾客留言信息
*
* @param id 顾客留言主键
* @return 结果
*/
int deletePlayCustomLeaveMsgById(String id);
}

View File

@@ -0,0 +1,113 @@
package com.starry.admin.modules.custom.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.github.yulichang.wrapper.MPJLambdaWrapper;
import com.starry.admin.modules.custom.mapper.PlayCustomLeaveMsgMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomLeaveMsgEntity;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgQueryVo;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgReturnVo;
import com.starry.admin.modules.custom.service.IPlayCustomLeaveMsgService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
/**
* 顾客留言Service业务层处理
*
* @author admin
* @since 2024-05-07
*/
@Service
public class PlayCustomLeaveMsgServiceImpl extends ServiceImpl<PlayCustomLeaveMsgMapper, PlayCustomLeaveMsgEntity> implements IPlayCustomLeaveMsgService {
@Resource
private PlayCustomLeaveMsgMapper playCustomLeaveMsgMapper;
@Override
public IPage<PlayCustomLeaveMsgReturnVo> selectByPage(PlayCustomLeaveMsgQueryVo vo) {
MPJLambdaWrapper<PlayCustomLeaveMsgEntity> lambdaQueryWrapper = new MPJLambdaWrapper<PlayCustomLeaveMsgEntity>()
// 查询主表全部字段
.selectAll(PlayCustomLeaveMsgEntity.class)
// 查询顾客表
.selectAs(PlayCustomUserInfoEntity::getId, "customUId").selectAs(PlayCustomUserInfoEntity::getAvatar, "customAvatar").selectAs(PlayCustomUserInfoEntity::getNickname, "customNickname")
// 子表
.leftJoin(PlayCustomUserInfoEntity.class, PlayCustomUserInfoEntity::getId, PlayCustomLeaveMsgEntity::getCustomId);
return this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayCustomLeaveMsgReturnVo.class, lambdaQueryWrapper);
}
/**
* 查询顾客留言
*
* @param id 顾客留言主键
* @return 顾客留言
*/
@Override
public PlayCustomLeaveMsgEntity selectPlayCustomLeaveMsgById(String id) {
return this.baseMapper.selectById(id);
}
/**
* 查询顾客留言列表
*
* @param playCustomLeaveMsg 顾客留言
* @return 顾客留言
*/
@Override
public IPage<PlayCustomLeaveMsgEntity> selectPlayCustomLeaveMsgByPage(PlayCustomLeaveMsgEntity playCustomLeaveMsg) {
Page<PlayCustomLeaveMsgEntity> page = new Page<>(1, 10);
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayCustomLeaveMsgEntity>());
}
/**
* 新增顾客留言
*
* @param playCustomLeaveMsg 顾客留言
* @return 结果
*/
@Override
public boolean create(PlayCustomLeaveMsgEntity playCustomLeaveMsg) {
if (StrUtil.isBlankIfStr(playCustomLeaveMsg.getId())) {
playCustomLeaveMsg.setId(IdUtil.fastSimpleUUID());
}
return save(playCustomLeaveMsg);
}
/**
* 修改顾客留言
*
* @param playCustomLeaveMsg 顾客留言
* @return 结果
*/
@Override
public boolean update(PlayCustomLeaveMsgEntity playCustomLeaveMsg) {
return updateById(playCustomLeaveMsg);
}
/**
* 批量删除顾客留言
*
* @param ids 需要删除的顾客留言主键
* @return 结果
*/
@Override
public int deletePlayCustomLeaveMsgByIds(String[] ids) {
return playCustomLeaveMsgMapper.deleteBatchIds(Arrays.asList(ids));
}
/**
* 删除顾客留言信息
*
* @param id 顾客留言主键
* @return 结果
*/
@Override
public int deletePlayCustomLeaveMsgById(String id) {
return playCustomLeaveMsgMapper.deleteById(id);
}
}

View File

@@ -6,6 +6,7 @@ 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.common.exception.CustomException;
import com.starry.admin.modules.custom.mapper.PlayCustomUserInfoMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
@@ -33,6 +34,7 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getOpenid, openId);
return this.baseMapper.selectOne(lambdaQueryWrapper);
}
/**
* 查询顾客
*
@@ -41,7 +43,11 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
*/
@Override
public PlayCustomUserInfoEntity selectById(String id) {
return this.baseMapper.selectById(id);
PlayCustomUserInfoEntity entity = this.baseMapper.selectById(id);
if (entity == null) {
throw new CustomException("顾客不存在");
}
return entity;
}
/**