服务项目
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
package com.starry.admin.modules.play.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.play.module.entity.PlayCommodityInfoEntity;
|
||||
import com.starry.admin.modules.play.module.vo.PlayCommodityInfoAddVo;
|
||||
import com.starry.admin.modules.play.service.IPlayCommodityInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import com.starry.common.utils.ConvertUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 服务项目Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/play/commodity")
|
||||
public class PlayCommodityInfoController {
|
||||
@Resource
|
||||
private IPlayCommodityInfoService playCommodityInfoService;
|
||||
|
||||
/**
|
||||
* 查询服务项目列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list(PlayCommodityInfoEntity playCommodityInfo) {
|
||||
IPage<PlayCommodityInfoEntity> list = playCommodityInfoService.selectPlayCommodityInfoByPage(playCommodityInfo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务项目详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playCommodityInfoService.selectPlayCommodityInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增服务项目
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "服务项目", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayCommodityInfoAddVo vo) {
|
||||
PlayCommodityInfoEntity entity = ConvertUtil.entityToVo(vo, PlayCommodityInfoEntity.class);
|
||||
boolean success = playCommodityInfoService.create(entity);
|
||||
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 PlayCommodityInfoEntity playCommodityInfo) {
|
||||
playCommodityInfo.setId(id);
|
||||
boolean success = playCommodityInfoService.update(playCommodityInfo);
|
||||
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(playCommodityInfoService.deletePlayCommodityInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoAddVo;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoQueryVo;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoUpdateVo;
|
||||
import com.starry.admin.modules.play.module.vo.PlayUserInfoUpEditVo;
|
||||
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
@@ -68,7 +68,7 @@ public class PlayUserInfoController {
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||
@Log(title = "账号", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/update")
|
||||
public R update(@Validated @RequestBody PlayUserInfoUpdateVo vo) {
|
||||
public R update(@Validated @RequestBody PlayUserInfoUpEditVo vo) {
|
||||
PlayUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayUserInfoEntity.class);
|
||||
boolean success = playUserInfoService.update(entity);
|
||||
if (success) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.starry.admin.modules.play.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayCommodityInfoEntity;
|
||||
|
||||
/**
|
||||
* 服务项目Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-31
|
||||
*/
|
||||
public interface PlayCommodityInfoMapper extends BaseMapper<PlayCommodityInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.starry.admin.modules.play.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 服务项目对象 play_commodity_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_commodity_info")
|
||||
public class PlayCommodityInfoEntity extends BaseEntity<PlayCommodityInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private String itemType;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 服务时长(文字描述信息,不参与订单计算)
|
||||
*/
|
||||
private String serviceDuration;
|
||||
|
||||
/**
|
||||
* 服务单价
|
||||
*/
|
||||
private String price;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 服务项目对象 play_commodity_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PlayCommodityInfoAddVo {
|
||||
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
@NotNull(message = "项目类型不能为空")
|
||||
private String itemType;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@NotNull(message = "项目名称不能为空")
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 服务时长(文字描述信息,不参与订单计算)
|
||||
*/
|
||||
@NotNull(message = "服务时长不能为空")
|
||||
private String serviceDuration;
|
||||
|
||||
/**
|
||||
* 服务单价
|
||||
*/
|
||||
@NotNull(message = "单价不能为空")
|
||||
private String price;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class PlayUserInfoUpEditVo {
|
||||
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 陪玩用户ID
|
||||
*/
|
||||
@NotBlank(message = "绑定用户不能为空")
|
||||
private String playUserId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.starry.admin.modules.play.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.play.module.entity.PlayCommodityInfoEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务项目Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-31
|
||||
*/
|
||||
public interface IPlayCommodityInfoService extends IService<PlayCommodityInfoEntity> {
|
||||
/**
|
||||
* 查询服务项目
|
||||
*
|
||||
* @param id 服务项目主键
|
||||
* @return 服务项目
|
||||
*/
|
||||
PlayCommodityInfoEntity selectPlayCommodityInfoById(String id);
|
||||
|
||||
|
||||
List<PlayCommodityInfoEntity> selectAll();
|
||||
|
||||
/**
|
||||
* 查询服务项目列表
|
||||
*
|
||||
* @param playCommodityInfo 服务项目
|
||||
* @return 服务项目集合
|
||||
*/
|
||||
IPage<PlayCommodityInfoEntity> selectPlayCommodityInfoByPage(PlayCommodityInfoEntity playCommodityInfo);
|
||||
|
||||
/**
|
||||
* 新增服务项目
|
||||
*
|
||||
* @param playCommodityInfo 服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayCommodityInfoEntity playCommodityInfo);
|
||||
|
||||
/**
|
||||
* 修改服务项目
|
||||
*
|
||||
* @param playCommodityInfo 服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayCommodityInfoEntity playCommodityInfo);
|
||||
|
||||
/**
|
||||
* 批量删除服务项目
|
||||
*
|
||||
* @param ids 需要删除的服务项目主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayCommodityInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除服务项目信息
|
||||
*
|
||||
* @param id 服务项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayCommodityInfoById(String id);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.starry.admin.modules.play.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.play.mapper.PlayCommodityInfoMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayCommodityInfoEntity;
|
||||
import com.starry.admin.modules.play.service.IPlayCommodityInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务项目Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-31
|
||||
*/
|
||||
@Service
|
||||
public class PlayCommodityInfoServiceImpl extends ServiceImpl<PlayCommodityInfoMapper, PlayCommodityInfoEntity> implements IPlayCommodityInfoService {
|
||||
@Resource
|
||||
private PlayCommodityInfoMapper playCommodityInfoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlayCommodityInfoEntity> selectAll() {
|
||||
return this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询服务项目
|
||||
*
|
||||
* @param id 服务项目主键
|
||||
* @return 服务项目
|
||||
*/
|
||||
@Override
|
||||
public PlayCommodityInfoEntity selectPlayCommodityInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询服务项目列表
|
||||
*
|
||||
* @param playCommodityInfo 服务项目
|
||||
* @return 服务项目
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayCommodityInfoEntity> selectPlayCommodityInfoByPage(PlayCommodityInfoEntity playCommodityInfo) {
|
||||
Page<PlayCommodityInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增服务项目
|
||||
*
|
||||
* @param playCommodityInfo 服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayCommodityInfoEntity playCommodityInfo) {
|
||||
if (StrUtil.isBlankIfStr(playCommodityInfo.getId())) {
|
||||
playCommodityInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playCommodityInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改服务项目
|
||||
*
|
||||
* @param playCommodityInfo 服务项目
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayCommodityInfoEntity playCommodityInfo) {
|
||||
return updateById(playCommodityInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除服务项目
|
||||
*
|
||||
* @param ids 需要删除的服务项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayCommodityInfoByIds(String[] ids) {
|
||||
return playCommodityInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除服务项目信息
|
||||
*
|
||||
* @param id 服务项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayCommodityInfoById(String id) {
|
||||
return playCommodityInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user