引入包厢预约
This commit is contained in:
1 parent
4822391b1d
commit
aef34aea58
6 files changed
+296
No files matched your search
+122
@@ -0,0 +1,122 @@
|
||||
package com.bsd.pjcloud.canteen.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesBookingEntity;
|
||||
import com.bsd.pjcloud.canteen.service.BoxesBookingService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 包厢预约记录表
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2024-12-16 22:39:45
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/boxesBooking" )
|
||||
@Tag(description = "boxesBooking" , name = "包厢预约记录表管理" )
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class BoxesBookingController {
|
||||
|
||||
private final BoxesBookingService boxesBookingService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param boxesBooking 包厢预约记录表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesBooking_view')" )
|
||||
public R getBoxesBookingPage(@ParameterObject Page page, @ParameterObject BoxesBookingEntity boxesBooking) {
|
||||
LambdaQueryWrapper<BoxesBookingEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(Objects.nonNull(boxesBooking.getBoxesId()),BoxesBookingEntity::getBoxesId,boxesBooking.getBoxesId());
|
||||
wrapper.like(Objects.nonNull(boxesBooking.getUserId()),BoxesBookingEntity::getUserId,boxesBooking.getUserId());
|
||||
return R.ok(boxesBookingService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询包厢预约记录表
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesBooking_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
return R.ok(boxesBookingService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增包厢预约记录表
|
||||
* @param boxesBooking 包厢预约记录表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增包厢预约记录表" , description = "新增包厢预约记录表" )
|
||||
@SysLog("新增包厢预约记录表" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesBooking_add')" )
|
||||
public R save(@RequestBody BoxesBookingEntity boxesBooking) {
|
||||
return R.ok(boxesBookingService.save(boxesBooking));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改包厢预约记录表
|
||||
* @param boxesBooking 包厢预约记录表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改包厢预约记录表" , description = "修改包厢预约记录表" )
|
||||
@SysLog("修改包厢预约记录表" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesBooking_edit')" )
|
||||
public R updateById(@RequestBody BoxesBookingEntity boxesBooking) {
|
||||
return R.ok(boxesBookingService.updateById(boxesBooking));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除包厢预约记录表
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除包厢预约记录表" , description = "通过id删除包厢预约记录表" )
|
||||
@SysLog("通过id删除包厢预约记录表" )
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesBooking_del')" )
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(boxesBookingService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param boxesBooking 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesBooking_export')" )
|
||||
public List<BoxesBookingEntity> export(BoxesBookingEntity boxesBooking,Long[] ids) {
|
||||
return boxesBookingService.list(Wrappers.lambdaQuery(boxesBooking).in(ArrayUtil.isNotEmpty(ids), BoxesBookingEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.bsd.pjcloud.canteen.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 包厢预约记录表
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2024-12-16 22:39:45
|
||||
*/
|
||||
@Data
|
||||
@TableName("boxes_booking")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "包厢预约记录表")
|
||||
public class BoxesBookingEntity extends Model<BoxesBookingEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 包厢Id
|
||||
*/
|
||||
@Schema(description="包厢Id")
|
||||
private Long boxesId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@Schema(description="开始时间")
|
||||
private Object startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@Schema(description="结束时间")
|
||||
private Object endTime;
|
||||
|
||||
/**
|
||||
* 审核人id
|
||||
*/
|
||||
@Schema(description="审核人id")
|
||||
private Long checkUserId;
|
||||
|
||||
/**
|
||||
* 1审核中 2通过 3驳回 4
|
||||
*/
|
||||
@Schema(description="1审核中 2通过 3驳回 4")
|
||||
private String checkStatus;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description="创建人")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Schema(description="更新人")
|
||||
private Double updater;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description="是否删除")
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 预约日期
|
||||
*/
|
||||
@Schema(description="预约日期")
|
||||
private LocalDate bookingDate;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description="用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 预约状态(0 预约成功,1预约失败 2取消预约 )
|
||||
*/
|
||||
@Schema(description="预约状态(0 预约成功,1预约失败 2取消预约 )")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 总价单位分
|
||||
*/
|
||||
@Schema(description="总价单位分")
|
||||
private Integer totalPrice;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.canteen.mapper;
|
||||
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesBookingEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BoxesBookingMapper extends PjcloudBaseMapper<BoxesBookingEntity> {
|
||||
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesBookingEntity;
|
||||
|
||||
public interface BoxesBookingService extends IService<BoxesBookingEntity> {
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesBookingEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.BoxesBookingMapper;
|
||||
import com.bsd.pjcloud.canteen.service.BoxesBookingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* 包厢预约记录表
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2024-12-16 22:39:45
|
||||
*/
|
||||
@Service
|
||||
public class BoxesBookingServiceImpl extends ServiceImpl<BoxesBookingMapper, BoxesBookingEntity> implements BoxesBookingService {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.bsd.pjcloud.canteen.mapper.BoxesBookingMapper">
|
||||
|
||||
<resultMap id="boxesBookingMap" type="com.bsd.pjcloud.canteen.entity.BoxesBookingEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="boxesId" column="boxes_id"/>
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="endTime" column="end_time"/>
|
||||
<result property="checkUserId" column="check_user_id"/>
|
||||
<result property="checkStatus" column="check_status"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="updater" column="updater"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="bookingDate" column="booking_date"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="totalPrice" column="total_price"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user