引入包厢,完善每日菜谱
This commit is contained in:
1 parent
6771061890
commit
67b378547b
18 files changed
+354
-5
No files matched your search
@@ -22,4 +22,4 @@ spring:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: root
|
||||
url: jdbc:mysql://pjcloud-mysql:3306/pjcloud_demo?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
url: jdbc:mysql://pjcloud-mysql:3306/pjcloud_erp?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
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.BoxesInfoEntity;
|
||||
import com.bsd.pjcloud.canteen.service.BoxesInfoService;
|
||||
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 13:05:37
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/boxesInfo" )
|
||||
@Tag(description = "boxesInfo" , name = "包厢管理" )
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class BoxesInfoController {
|
||||
|
||||
private final BoxesInfoService boxesInfoService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param boxesInfo 包厢
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesInfo_view')" )
|
||||
public R getBoxesInfoPage(@ParameterObject Page page, @ParameterObject BoxesInfoEntity boxesInfo) {
|
||||
LambdaQueryWrapper<BoxesInfoEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(StrUtil.isNotBlank(boxesInfo.getName()),BoxesInfoEntity::getName,boxesInfo.getName());
|
||||
return R.ok(boxesInfoService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询包厢
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesInfo_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
return R.ok(boxesInfoService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增包厢
|
||||
* @param boxesInfo 包厢
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增包厢" , description = "新增包厢" )
|
||||
@SysLog("新增包厢" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesInfo_add')" )
|
||||
public R save(@RequestBody BoxesInfoEntity boxesInfo) {
|
||||
return R.ok(boxesInfoService.save(boxesInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改包厢
|
||||
* @param boxesInfo 包厢
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改包厢" , description = "修改包厢" )
|
||||
@SysLog("修改包厢" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesInfo_edit')" )
|
||||
public R updateById(@RequestBody BoxesInfoEntity boxesInfo) {
|
||||
return R.ok(boxesInfoService.updateById(boxesInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除包厢
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除包厢" , description = "通过id删除包厢" )
|
||||
@SysLog("通过id删除包厢" )
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesInfo_del')" )
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(boxesInfoService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param boxesInfo 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_boxesInfo_export')" )
|
||||
public List<BoxesInfoEntity> export(BoxesInfoEntity boxesInfo,Long[] ids) {
|
||||
return boxesInfoService.list(Wrappers.lambdaQuery(boxesInfo).in(ArrayUtil.isNotEmpty(ids), BoxesInfoEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -82,7 +82,8 @@ public class CanteenDailyMenuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_add')" )
|
||||
public R save(@RequestBody CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
return R.ok(canteenDailyMenuService.save(canteenDailyMenu));
|
||||
canteenDailyMenuService.saveToday(canteenDailyMenu);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
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.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 包厢
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2024-12-16 13:05:37
|
||||
*/
|
||||
@Data
|
||||
@TableName("boxes_info")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "包厢")
|
||||
public class BoxesInfoEntity extends Model<BoxesInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 包厢名称
|
||||
*/
|
||||
@Schema(description="包厢名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 容纳人数
|
||||
*/
|
||||
@Schema(description="容纳人数")
|
||||
private Long capacity;
|
||||
|
||||
/**
|
||||
* 包厢描述
|
||||
*/
|
||||
@Schema(description="包厢描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 包厢地址
|
||||
*/
|
||||
@Schema(description="包厢地址")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 包厢图片
|
||||
*/
|
||||
@Schema(description="包厢图片")
|
||||
private String images;
|
||||
|
||||
/**
|
||||
* 包厢状态
|
||||
*/
|
||||
@Schema(description="包厢状态")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 包厢价格单位分
|
||||
*/
|
||||
@Schema(description="包厢价格单位分")
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 商户id
|
||||
*/
|
||||
@Schema(description="商户id")
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="更新人")
|
||||
private Double updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="是否删除")
|
||||
private String delFlag;
|
||||
}
|
||||
+8
@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 每日菜谱
|
||||
@@ -101,4 +102,11 @@ public class CanteenDailyMenuEntity extends Model<CanteenDailyMenuEntity> {
|
||||
*/
|
||||
@Schema(description="租户编号")
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "商品 SPU 编号")
|
||||
@TableField(exist = false)
|
||||
private List<Long> spuIds;
|
||||
|
||||
}
|
||||
+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.BoxesInfoEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BoxesInfoMapper extends PjcloudBaseMapper<BoxesInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
+3
-1
@@ -5,6 +5,7 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,5 +13,6 @@ import java.util.List;
|
||||
public interface CanteenDailyMenuMapper extends PjcloudBaseMapper<CanteenDailyMenuEntity> {
|
||||
|
||||
|
||||
List<DailyMenuVO> selectTimeFood(String time, Long merchantId, Long categoryId, DataScope dataScope);
|
||||
List<DailyMenuVO> selectTimeFood(@Param("time") String time,@Param("merchantId") Long merchantId,
|
||||
@Param("categoryId") Long categoryId, DataScope dataScope);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesInfoEntity;
|
||||
|
||||
public interface BoxesInfoService extends IService<BoxesInfoEntity> {
|
||||
|
||||
}
|
||||
+3
@@ -25,4 +25,7 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
* @return
|
||||
*/
|
||||
List<String> selectWeekInfo(Integer index);
|
||||
|
||||
|
||||
void saveToday(CanteenDailyMenuEntity canteenDailyMenu);
|
||||
}
|
||||
+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.BoxesInfoEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.BoxesInfoMapper;
|
||||
import com.bsd.pjcloud.canteen.service.BoxesInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* 包厢
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2024-12-16 13:05:37
|
||||
*/
|
||||
@Service
|
||||
public class BoxesInfoServiceImpl extends ServiceImpl<BoxesInfoMapper, BoxesInfoEntity> implements BoxesInfoService {
|
||||
}
|
||||
+19
@@ -7,6 +7,7 @@ import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenDailyMenuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
@@ -69,4 +70,22 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToday(CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
|
||||
canteenDailyMenu.getSpuIds().forEach(x -> {
|
||||
CanteenDailyMenuEntity todayDO = new CanteenDailyMenuEntity();
|
||||
BeanUtils.copyProperties(canteenDailyMenu, todayDO);
|
||||
todayDO.setSpuId(x);
|
||||
baseMapper.insert(todayDO);
|
||||
});
|
||||
// 发送mq消息
|
||||
//todo 邓的mq
|
||||
// EventDto eventDto = new EventDto()
|
||||
// .setHardwareType(HardwareTypeEnum.CANTEEN)
|
||||
// .setHardwareId(null);
|
||||
// CookbookProductEvent productEvent = new CookbookProductEvent(this, eventDto);
|
||||
// eventPublisher.publishEvent(productEvent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.BoxesInfoMapper">
|
||||
|
||||
<resultMap id="boxesInfoMap" type="com.bsd.pjcloud.canteen.entity.BoxesInfoEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="capacity" column="capacity"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="images" column="images"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="merchantId" column="merchant_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+4
-2
@@ -26,11 +26,13 @@
|
||||
t.hour_type
|
||||
FROM canteen_daily_menu t
|
||||
LEFT JOIN canteen_spu sp
|
||||
WHERE t.hour_type = #{hourType}
|
||||
on t.spu_id=sp.id
|
||||
<where>
|
||||
AND t.merchant_id = #{merchantId}
|
||||
AND sp.category_id = #{categoryId}
|
||||
AND sp.del_flag = 0
|
||||
AND sp.start_time = #{time}
|
||||
AND t.start_time = #{time}
|
||||
And t.del_flag = 0
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,4 @@
|
||||
[0.013s][info][gc] Using G1
|
||||
[1.613s][info][gc] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 102M->12M(2048M) 6.797ms
|
||||
[2.469s][info][gc] GC(1) Pause Young (Normal) (G1 Evacuation Pause) 103M->16M(2048M) 5.423ms
|
||||
[3.061s][info][gc] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 125M->18M(2048M) 3.776ms
|
||||
@@ -0,0 +1,5 @@
|
||||
[0.014s][info][gc] Using G1
|
||||
[1.679s][info][gc] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 102M->12M(2048M) 5.347ms
|
||||
[2.695s][info][gc] GC(1) Pause Young (Normal) (G1 Evacuation Pause) 103M->15M(2048M) 5.572ms
|
||||
[3.279s][info][gc] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 124M->18M(2048M) 3.129ms
|
||||
[7426.520s][info][gc] GC(3) Pause Young (Normal) (G1 Evacuation Pause) 411M->29M(2048M) 64.581ms
|
||||
@@ -0,0 +1,5 @@
|
||||
[0.016s][info][gc] Using G1
|
||||
[1.591s][info][gc] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 102M->12M(2048M) 5.712ms
|
||||
[2.712s][info][gc] GC(1) Pause Young (Normal) (G1 Evacuation Pause) 103M->15M(2048M) 5.661ms
|
||||
[3.300s][info][gc] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 124M->18M(2048M) 3.593ms
|
||||
[683.570s][info][gc] GC(3) Pause Young (Normal) (G1 Evacuation Pause) 267M->28M(2048M) 8.954ms
|
||||
@@ -0,0 +1,5 @@
|
||||
[0.016s][info][gc] Using G1
|
||||
[1.698s][info][gc] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 102M->12M(2048M) 5.407ms
|
||||
[2.855s][info][gc] GC(1) Pause Young (Normal) (G1 Evacuation Pause) 103M->16M(2048M) 5.049ms
|
||||
[3.435s][info][gc] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 125M->19M(2048M) 3.236ms
|
||||
[2887.671s][info][gc] GC(3) Pause Young (Normal) (G1 Evacuation Pause) 309M->28M(2048M) 13.148ms
|
||||
@@ -0,0 +1,4 @@
|
||||
[0.016s][info][gc] Using G1
|
||||
[1.624s][info][gc] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 102M->12M(2048M) 6.331ms
|
||||
[2.854s][info][gc] GC(1) Pause Young (Normal) (G1 Evacuation Pause) 103M->16M(2048M) 5.636ms
|
||||
[3.466s][info][gc] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 125M->19M(2048M) 3.007ms
|
||||
Reference in new issue
Block a user