设备信息、设备使用记录模块

This commit is contained in:
liux 2025-06-18 17:03:09 +08:00
parent cb87db880b
commit e7d25adeb8
23 changed files with 821 additions and 120 deletions

View File

@ -16,6 +16,12 @@
</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>

View File

@ -0,0 +1,92 @@
package com.bonus.canteen.core.cook.vo;
import com.bonus.canteen.core.utils.SysUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@ApiModel("菜品标签分页返回")
public class CookMaterialBaseVO implements Serializable {
@ApiModelProperty("食材id")
private Long materialId;
@ApiModelProperty("食材名称")
private String materialName;
@ApiModelProperty("原料编号")
private String materialCode;
@ApiModelProperty("食材重量(g)")
private Double weight;
@ApiModelProperty("材料类型(1主料,2辅料,3配料)")
private Integer materialType;
@ApiModelProperty("大类")
private String bigType;
@ApiModelProperty("小类")
private String littleType;
@ApiModelProperty("原料图片")
private String imageUrl;
public void setImageUrl(String imageUrl) {
this.imageUrl = SysUtil.getCutPath(imageUrl);
}
public String getImageUrl() {
return SysUtil.getCutFileUrl(this.imageUrl);
}
public Long getMaterialId() {
return this.materialId;
}
public String getMaterialName() {
return this.materialName;
}
public String getMaterialCode() {
return this.materialCode;
}
public Double getWeight() {
return this.weight;
}
public Integer getMaterialType() {
return this.materialType;
}
public String getBigType() {
return this.bigType;
}
public String getLittleType() {
return this.littleType;
}
public void setMaterialId(final Long materialId) {
this.materialId = materialId;
}
public void setMaterialName(final String materialName) {
this.materialName = materialName;
}
public void setMaterialCode(final String materialCode) {
this.materialCode = materialCode;
}
public void setWeight(final Double weight) {
this.weight = weight;
}
public void setMaterialType(final Integer materialType) {
this.materialType = materialType;
}
public void setBigType(final String bigType) {
this.bigType = bigType;
}
public void setLittleType(final String littleType) {
this.littleType = littleType;
}
}

View File

@ -0,0 +1,19 @@
package com.bonus.canteen.core.cook.vo;
import lombok.Data;
/**
* @author xliu
* @date 2025/6/9 12:12
*/
@Data
public class MenuMaterialBasVO {
private String materialId;
private String materialName;
private String materialCode;
private String weight;
private String materialType;
private String bigType;
private String littleType;
private String imageUrl;
}

View File

@ -2,6 +2,10 @@ package com.bonus.canteen.core.kitchen.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.kitchen.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
@ -26,7 +30,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
/**
* 厨房设备基础信息Controller
*
*
* @author xsheng
* @date 2025-06-16
*/
@ -43,9 +47,9 @@ public class KitchenDeviceInfoController extends BaseController {
@ApiOperation(value = "查询厨房设备基础信息列表")
//@RequiresPermissions("kitchen:info:list")
@GetMapping("/list")
public TableDataInfo list(KitchenDeviceInfo kitchenDeviceInfo) {
public TableDataInfo list(KitchenDeviceListDTO kitchenDeviceInfo) {
startPage();
List<KitchenDeviceInfo> list = kitchenDeviceInfoService.selectKitchenDeviceInfoList(kitchenDeviceInfo);
List<KitchenDeviceListVO> list = kitchenDeviceInfoService.selectKitchenDeviceInfoList(kitchenDeviceInfo);
return getDataTable(list);
}
@ -57,9 +61,9 @@ public class KitchenDeviceInfoController extends BaseController {
//@RequiresPermissions("kitchen:info:export")
@SysLog(title = "厨房设备基础信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出厨房设备基础信息")
@PostMapping("/export")
public void export(HttpServletResponse response, KitchenDeviceInfo kitchenDeviceInfo) {
List<KitchenDeviceInfo> list = kitchenDeviceInfoService.selectKitchenDeviceInfoList(kitchenDeviceInfo);
ExcelUtil<KitchenDeviceInfo> util = new ExcelUtil<KitchenDeviceInfo>(KitchenDeviceInfo.class);
public void export(HttpServletResponse response, KitchenDeviceListDTO kitchenDeviceInfo) {
List<KitchenDeviceListVO> list = kitchenDeviceInfoService.selectKitchenDeviceInfoList(kitchenDeviceInfo);
ExcelUtil<KitchenDeviceListVO> util = new ExcelUtil<KitchenDeviceListVO>(KitchenDeviceListVO.class);
util.exportExcel(response, list, "厨房设备基础信息数据");
}
@ -68,8 +72,8 @@ public class KitchenDeviceInfoController extends BaseController {
*/
@ApiOperation(value = "获取厨房设备基础信息详细信息")
//@RequiresPermissions("kitchen:info:query")
@GetMapping(value = "/{deviceId}")
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
@GetMapping(value = "/details")
public AjaxResult getInfo(@NotNull Long deviceId) {
return success(kitchenDeviceInfoService.selectKitchenDeviceInfoByDeviceId(deviceId));
}
@ -80,7 +84,7 @@ public class KitchenDeviceInfoController extends BaseController {
//@PreventRepeatSubmit
//@RequiresPermissions("kitchen:info:add")
@SysLog(title = "厨房设备基础信息", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增厨房设备基础信息")
@PostMapping
@PostMapping("/add")
public AjaxResult add(@RequestBody KitchenDeviceInfo kitchenDeviceInfo) {
try {
return toAjax(kitchenDeviceInfoService.insertKitchenDeviceInfo(kitchenDeviceInfo));
@ -112,8 +116,8 @@ public class KitchenDeviceInfoController extends BaseController {
//@PreventRepeatSubmit
//@RequiresPermissions("kitchen:info:remove")
@SysLog(title = "厨房设备基础信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除厨房设备基础信息")
@PostMapping("/del/{deviceIds}")
public AjaxResult remove(@PathVariable Long[] deviceIds) {
@PostMapping("/del")
public AjaxResult remove(@RequestBody List<Long> deviceIds) {
return toAjax(kitchenDeviceInfoService.deleteKitchenDeviceInfoByDeviceIds(deviceIds));
}
}

View File

@ -2,6 +2,9 @@ package com.bonus.canteen.core.kitchen.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceUsageListVO;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.kitchen.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
@ -26,7 +29,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
/**
* 厨房设备使用记录Controller
*
*
* @author xsheng
* @date 2025-06-16
*/
@ -43,9 +46,9 @@ public class KitchenDeviceUsageController extends BaseController {
@ApiOperation(value = "查询厨房设备使用记录列表")
//@RequiresPermissions("kitchen:usage:list")
@GetMapping("/list")
public TableDataInfo list(KitchenDeviceUsage kitchenDeviceUsage) {
public TableDataInfo list(KitchenDeviceListDTO kitchenDeviceUsage) {
startPage();
List<KitchenDeviceUsage> list = kitchenDeviceUsageService.selectKitchenDeviceUsageList(kitchenDeviceUsage);
List<KitchenDeviceUsageListVO> list = kitchenDeviceUsageService.selectKitchenDeviceUsageList(kitchenDeviceUsage);
return getDataTable(list);
}
@ -57,9 +60,9 @@ public class KitchenDeviceUsageController extends BaseController {
//@RequiresPermissions("kitchen:usage:export")
@SysLog(title = "厨房设备使用记录", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出厨房设备使用记录")
@PostMapping("/export")
public void export(HttpServletResponse response, KitchenDeviceUsage kitchenDeviceUsage) {
List<KitchenDeviceUsage> list = kitchenDeviceUsageService.selectKitchenDeviceUsageList(kitchenDeviceUsage);
ExcelUtil<KitchenDeviceUsage> util = new ExcelUtil<KitchenDeviceUsage>(KitchenDeviceUsage.class);
public void export(HttpServletResponse response, KitchenDeviceListDTO kitchenDeviceUsage) {
List<KitchenDeviceUsageListVO> list = kitchenDeviceUsageService.selectKitchenDeviceUsageList(kitchenDeviceUsage);
ExcelUtil<KitchenDeviceUsageListVO> util = new ExcelUtil<KitchenDeviceUsageListVO>(KitchenDeviceUsageListVO.class);
util.exportExcel(response, list, "厨房设备使用记录数据");
}

View File

@ -0,0 +1,33 @@
package com.bonus.canteen.core.kitchen.controller;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 厨房设备基础信息Controller
*
* @author xsheng
* @date 2025-06-16
*/
@Api(tags = "厨房设备基础信息接口")
@RestController
@RequestMapping("/kitchen_home_page")
public class KitchenHomePageController extends BaseController {
@ApiOperation(value = "获取首页信息")
//@RequiresPermissions("kitchen:info:list")
@GetMapping("/information")
public TableDataInfo list(KitchenDeviceListDTO kitchenDeviceInfo) {
return null;
}
}

View File

@ -1,14 +1,18 @@
package com.bonus.canteen.core.kitchen.domain;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import java.util.Date;
/**
* 厨房设备基础信息对象 kitchen_device_info
*
*
* @author xsheng
* @date 2025-06-16
*/
@ -16,7 +20,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
@Data
@ToString
public class KitchenDeviceInfo extends BaseEntity {
public class KitchenDeviceInfo extends Model<KitchenDeviceInfo> {
private static final long serialVersionUID = 1L;
/** 设备id */
@ -90,5 +94,12 @@ public class KitchenDeviceInfo extends BaseEntity {
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
private String createBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateBy;
@JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -0,0 +1,73 @@
package com.bonus.canteen.core.kitchen.dto;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
/**
* 厨房设备基础信息对象 kitchen_device_info
*
* @author xsheng
* @date 2025-06-16
*/
@Data
@ToString
public class KitchenDeviceListDTO {
private static final long serialVersionUID = 1L;
/** 设备id */
private Long deviceId;
/** 设备编号 */
@ApiModelProperty(value = "设备编号")
private String deviceNo;
/** 食堂id */
@ApiModelProperty(value = "食堂id")
private Long canteenId;
/** 区域id */
@ApiModelProperty(value = "区域id")
private Long areaId;
/** 设备类型(1-摄像头 2-传感器 3-门禁 4-仪表 5-仪器, 参考DeviceTypeEnum) */
@ApiModelProperty(value = "设备类型(1-摄像头 2-传感器 3-门禁 4-仪表 5-仪器, 参考DeviceTypeEnum)")
private Integer deviceType;
/** 设备类型 */
@ApiModelProperty(value = "设备类型")
private Integer deviceCategory;
/** 设备型号 */
@ApiModelProperty(value = "设备型号")
private String deviceSize;
/** 设备名称 */
@ApiModelProperty(value = "设备名称")
private String deviceName;
/** 设备sn */
@ApiModelProperty(value = "设备sn")
private String deviceSn;
/** 所在位置 */
@ApiModelProperty(value = "所在位置")
private String subPlace;
/** 设备是否在线 1 在线 2 离线 */
@ApiModelProperty(value = "设备是否在线 1 在线 2 离线")
private Integer deviceNetworkState;
private String areaName;
private String canteenName;
}

View File

@ -0,0 +1,57 @@
package com.bonus.canteen.core.kitchen.dto;
import com.bonus.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
/**
* 厨房设备使用记录对象 kitchen_device_usage
*
* @author xsheng
* @date 2025-06-16
*/
@Data
@ToString
public class KitchenDeviceUsageListDTO {
/** 设备编号 */
@ApiModelProperty(value = "设备编号")
private String deviceNo;
@ApiModelProperty(value = "设备SN")
private String deviceSn;
@ApiModelProperty(value = "设备名称")
private String deviceName;
/** 设备类型 */
@ApiModelProperty(value = "设备类型")
private Long deviceType;
/** 区域id */
@ApiModelProperty(value = "区域id")
private Long areaId;
/** 食堂id */
@ApiModelProperty(value = "食堂id")
private Long canteenId;
/** 工作状态 */
@ApiModelProperty(value = "工作状态")
private Long workState;
}

View File

@ -1,34 +1,38 @@
package com.bonus.canteen.core.kitchen.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
/**
* 厨房设备基础信息Mapper接口
*
*
* @author xsheng
* @date 2025-06-16
*/
public interface KitchenDeviceInfoMapper {
public interface KitchenDeviceInfoMapper extends BaseMapper<KitchenDeviceInfo> {
/**
* 查询厨房设备基础信息
*
*
* @param deviceId 厨房设备基础信息主键
* @return 厨房设备基础信息
*/
public KitchenDeviceInfo selectKitchenDeviceInfoByDeviceId(Long deviceId);
public KitchenDeviceListVO selectKitchenDeviceInfoByDeviceId(Long deviceId);
/**
* 查询厨房设备基础信息列表
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 厨房设备基础信息集合
*/
public List<KitchenDeviceInfo> selectKitchenDeviceInfoList(KitchenDeviceInfo kitchenDeviceInfo);
public List<KitchenDeviceListVO> selectKitchenDeviceInfoList(KitchenDeviceListDTO kitchenDeviceInfo);
/**
* 新增厨房设备基础信息
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 结果
*/
@ -36,7 +40,7 @@ public interface KitchenDeviceInfoMapper {
/**
* 修改厨房设备基础信息
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 结果
*/
@ -44,7 +48,7 @@ public interface KitchenDeviceInfoMapper {
/**
* 删除厨房设备基础信息
*
*
* @param deviceId 厨房设备基础信息主键
* @return 结果
*/
@ -52,9 +56,9 @@ public interface KitchenDeviceInfoMapper {
/**
* 批量删除厨房设备基础信息
*
*
* @param deviceIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteKitchenDeviceInfoByDeviceIds(Long[] deviceIds);
public int deleteKitchenDeviceInfoByDeviceIds(List<Long> deviceIds);
}

View File

@ -2,33 +2,35 @@ package com.bonus.canteen.core.kitchen.mapper;
import java.util.List;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceUsage;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceUsageListVO;
/**
* 厨房设备使用记录Mapper接口
*
*
* @author xsheng
* @date 2025-06-16
*/
public interface KitchenDeviceUsageMapper {
/**
* 查询厨房设备使用记录
*
*
* @param usageId 厨房设备使用记录主键
* @return 厨房设备使用记录
*/
public KitchenDeviceUsage selectKitchenDeviceUsageByUsageId(Long usageId);
public KitchenDeviceUsageListVO selectKitchenDeviceUsageByUsageId(Long usageId);
/**
* 查询厨房设备使用记录列表
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 厨房设备使用记录集合
*/
public List<KitchenDeviceUsage> selectKitchenDeviceUsageList(KitchenDeviceUsage kitchenDeviceUsage);
public List<KitchenDeviceUsageListVO> selectKitchenDeviceUsageList(KitchenDeviceListDTO kitchenDeviceUsage);
/**
* 新增厨房设备使用记录
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 结果
*/
@ -36,7 +38,7 @@ public interface KitchenDeviceUsageMapper {
/**
* 修改厨房设备使用记录
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 结果
*/
@ -44,7 +46,7 @@ public interface KitchenDeviceUsageMapper {
/**
* 删除厨房设备使用记录
*
*
* @param usageId 厨房设备使用记录主键
* @return 结果
*/
@ -52,7 +54,7 @@ public interface KitchenDeviceUsageMapper {
/**
* 批量删除厨房设备使用记录
*
*
* @param usageIds 需要删除的数据主键集合
* @return 结果
*/

View File

@ -0,0 +1,18 @@
package com.bonus.canteen.core.kitchen.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import java.util.List;
/**
* 厨房设备基础信息Mapper接口
*
* @author xsheng
* @date 2025-06-16
*/
public interface KitchenHomePageMapper {
}

View File

@ -1,34 +1,38 @@
package com.bonus.canteen.core.kitchen.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
/**
* 厨房设备基础信息Service接口
*
*
* @author xsheng
* @date 2025-06-16
*/
public interface IKitchenDeviceInfoService {
public interface IKitchenDeviceInfoService extends IService<KitchenDeviceInfo> {
/**
* 查询厨房设备基础信息
*
*
* @param deviceId 厨房设备基础信息主键
* @return 厨房设备基础信息
*/
public KitchenDeviceInfo selectKitchenDeviceInfoByDeviceId(Long deviceId);
public KitchenDeviceListVO selectKitchenDeviceInfoByDeviceId(Long deviceId);
/**
* 查询厨房设备基础信息列表
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 厨房设备基础信息集合
*/
public List<KitchenDeviceInfo> selectKitchenDeviceInfoList(KitchenDeviceInfo kitchenDeviceInfo);
public List<KitchenDeviceListVO> selectKitchenDeviceInfoList(KitchenDeviceListDTO kitchenDeviceInfo);
/**
* 新增厨房设备基础信息
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 结果
*/
@ -36,7 +40,7 @@ public interface IKitchenDeviceInfoService {
/**
* 修改厨房设备基础信息
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 结果
*/
@ -44,15 +48,15 @@ public interface IKitchenDeviceInfoService {
/**
* 批量删除厨房设备基础信息
*
*
* @param deviceIds 需要删除的厨房设备基础信息主键集合
* @return 结果
*/
public int deleteKitchenDeviceInfoByDeviceIds(Long[] deviceIds);
public int deleteKitchenDeviceInfoByDeviceIds(List<Long> deviceIds);
/**
* 删除厨房设备基础信息信息
*
*
* @param deviceId 厨房设备基础信息主键
* @return 结果
*/

View File

@ -2,33 +2,35 @@ package com.bonus.canteen.core.kitchen.service;
import java.util.List;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceUsage;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceUsageListVO;
/**
* 厨房设备使用记录Service接口
*
*
* @author xsheng
* @date 2025-06-16
*/
public interface IKitchenDeviceUsageService {
/**
* 查询厨房设备使用记录
*
*
* @param usageId 厨房设备使用记录主键
* @return 厨房设备使用记录
*/
public KitchenDeviceUsage selectKitchenDeviceUsageByUsageId(Long usageId);
public KitchenDeviceUsageListVO selectKitchenDeviceUsageByUsageId(Long usageId);
/**
* 查询厨房设备使用记录列表
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 厨房设备使用记录集合
*/
public List<KitchenDeviceUsage> selectKitchenDeviceUsageList(KitchenDeviceUsage kitchenDeviceUsage);
public List<KitchenDeviceUsageListVO> selectKitchenDeviceUsageList(KitchenDeviceListDTO kitchenDeviceUsage);
/**
* 新增厨房设备使用记录
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 结果
*/
@ -36,7 +38,7 @@ public interface IKitchenDeviceUsageService {
/**
* 修改厨房设备使用记录
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 结果
*/
@ -44,7 +46,7 @@ public interface IKitchenDeviceUsageService {
/**
* 批量删除厨房设备使用记录
*
*
* @param usageIds 需要删除的厨房设备使用记录主键集合
* @return 结果
*/
@ -52,7 +54,7 @@ public interface IKitchenDeviceUsageService {
/**
* 删除厨房设备使用记录信息
*
*
* @param usageId 厨房设备使用记录主键
* @return 结果
*/

View File

@ -0,0 +1,18 @@
package com.bonus.canteen.core.kitchen.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import java.util.List;
/**
* 厨房设备基础信息Service接口
*
* @author xsheng
* @date 2025-06-16
*/
public interface IKitchenHomePageService{
}

View File

@ -1,56 +1,118 @@
package com.bonus.canteen.core.kitchen.service.impl;
import java.io.IOException;
import java.net.InetAddress;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.kitchen.mapper.KitchenDeviceInfoMapper;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
import com.bonus.canteen.core.kitchen.service.IKitchenDeviceInfoService;
import javax.annotation.Resource;
/**
* 厨房设备基础信息Service业务层处理
*
*
* @author xsheng
* @date 2025-06-16
*/
@Service
public class KitchenDeviceInfoServiceImpl implements IKitchenDeviceInfoService {
@Autowired
public class KitchenDeviceInfoServiceImpl extends ServiceImpl<KitchenDeviceInfoMapper,KitchenDeviceInfo> implements IKitchenDeviceInfoService {
@Resource
private KitchenDeviceInfoMapper kitchenDeviceInfoMapper;
/**
* 查询厨房设备基础信息
*
*
* @param deviceId 厨房设备基础信息主键
* @return 厨房设备基础信息
*/
@Override
public KitchenDeviceInfo selectKitchenDeviceInfoByDeviceId(Long deviceId) {
public KitchenDeviceListVO selectKitchenDeviceInfoByDeviceId(Long deviceId) {
return kitchenDeviceInfoMapper.selectKitchenDeviceInfoByDeviceId(deviceId);
}
/**
* 查询厨房设备基础信息列表
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 厨房设备基础信息
*/
@Override
public List<KitchenDeviceInfo> selectKitchenDeviceInfoList(KitchenDeviceInfo kitchenDeviceInfo) {
return kitchenDeviceInfoMapper.selectKitchenDeviceInfoList(kitchenDeviceInfo);
public List<KitchenDeviceListVO> selectKitchenDeviceInfoList(KitchenDeviceListDTO kitchenDeviceInfo) {
List<KitchenDeviceListVO> list = kitchenDeviceInfoMapper.selectKitchenDeviceInfoList(kitchenDeviceInfo);
// 设置设备在线状态 现不确定验证方式 简易版
// if(list != null && list.size() >0) {
// for (KitchenDeviceListVO vo : list) {
// String ip = vo.getIpAddress() ;
// boolean tf = isDeviceOnline(ip, 500); // 设置超时时间为500毫秒
// vo.setDeviceNetworkState(tf == true ? 1 : 0);
// }
//
// }
return list;
}
public static boolean isDeviceOnline(String ipAddress, int timeout) {
try {
InetAddress address = InetAddress.getByName(ipAddress);
return address.isReachable(timeout);
} catch (IOException e) {
return false;
}
}
/**
* 新增厨房设备基础信息
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 结果
*/
@Override
public int insertKitchenDeviceInfo(KitchenDeviceInfo kitchenDeviceInfo) {
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceNo())){
throw new ServiceException("编设备编号不能为空");
}
if(kitchenDeviceInfo.getDeviceType() == null){
throw new ServiceException("编设备类型不能为空");
}
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceSn())){
throw new ServiceException("编设备sn号不能为空");
}
kitchenDeviceInfo.setDeviceNo(kitchenDeviceInfo.getDeviceNo() == null ? "2" : kitchenDeviceInfo.getDeviceNo().trim());
kitchenDeviceInfo.setCreateTime(DateUtils.getNowDate());
KitchenDeviceInfo bean;
bean = kitchenDeviceInfoMapper.selectOne(
Wrappers.<KitchenDeviceInfo>lambdaQuery()
.eq(KitchenDeviceInfo::getDeviceName, kitchenDeviceInfo.getDeviceName())
);
if(bean !=null) {
throw new ServiceException("设备编号已存在,请检查后重新输入");
}
bean = kitchenDeviceInfoMapper.selectOne(
Wrappers.<KitchenDeviceInfo>lambdaQuery()
.eq(KitchenDeviceInfo::getDeviceSn, kitchenDeviceInfo.getDeviceSn())
);
if(bean !=null) {
throw new ServiceException("设备SN码已存在请检查后重新输入");
}
bean = kitchenDeviceInfoMapper.selectOne(
Wrappers.<KitchenDeviceInfo>lambdaQuery()
.eq(KitchenDeviceInfo::getDeviceName, kitchenDeviceInfo.getDeviceName())
);
if(bean !=null) {
throw new ServiceException("设备名称已存在,请检查后重新输入");
}
try {
return kitchenDeviceInfoMapper.insertKitchenDeviceInfo(kitchenDeviceInfo);
} catch (Exception e) {
@ -60,15 +122,54 @@ public class KitchenDeviceInfoServiceImpl implements IKitchenDeviceInfoService {
/**
* 修改厨房设备基础信息
*
*
* @param kitchenDeviceInfo 厨房设备基础信息
* @return 结果
*/
@Override
public int updateKitchenDeviceInfo(KitchenDeviceInfo kitchenDeviceInfo) {
kitchenDeviceInfo.setUpdateTime(DateUtils.getNowDate());
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceNo())){
throw new ServiceException("编设备编号不能为空");
}
if(kitchenDeviceInfo.getDeviceType() == null){
throw new ServiceException("编设备类型不能为空");
}
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceSn())){
throw new ServiceException("编设备sn号不能为空");
}
KitchenDeviceInfo bean;
bean = kitchenDeviceInfoMapper.selectOne(
Wrappers.<KitchenDeviceInfo>lambdaQuery()
.eq(KitchenDeviceInfo::getDeviceName, kitchenDeviceInfo.getDeviceName())
.ne(KitchenDeviceInfo::getDeviceId, kitchenDeviceInfo.getDeviceId())
);
if(bean !=null){
throw new ServiceException("设备名称已存在");
}
bean = kitchenDeviceInfoMapper.selectOne(
Wrappers.<KitchenDeviceInfo>lambdaQuery()
.eq(KitchenDeviceInfo::getDeviceSn, kitchenDeviceInfo.getDeviceSn())
.ne(KitchenDeviceInfo::getDeviceId, kitchenDeviceInfo.getDeviceId())
);
if(bean !=null){
throw new ServiceException("编设备sn码已存在");
}
bean = kitchenDeviceInfoMapper.selectOne(
Wrappers.<KitchenDeviceInfo>lambdaQuery()
.eq(KitchenDeviceInfo::getDeviceNo, kitchenDeviceInfo.getDeviceNo())
.ne(KitchenDeviceInfo::getDeviceId, kitchenDeviceInfo.getDeviceId())
);
if(bean !=null){
throw new ServiceException("编设备编码已存在");
}
try {
return kitchenDeviceInfoMapper.updateKitchenDeviceInfo(kitchenDeviceInfo);
return kitchenDeviceInfoMapper.update(kitchenDeviceInfo,
Wrappers.<KitchenDeviceInfo>lambdaUpdate()
.eq(KitchenDeviceInfo::getDeviceId, kitchenDeviceInfo.getDeviceId()));
// return kitchenDeviceInfoMapper.updateKitchenDeviceInfo(kitchenDeviceInfo);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
@ -76,18 +177,18 @@ public class KitchenDeviceInfoServiceImpl implements IKitchenDeviceInfoService {
/**
* 批量删除厨房设备基础信息
*
*
* @param deviceIds 需要删除的厨房设备基础信息主键
* @return 结果
*/
@Override
public int deleteKitchenDeviceInfoByDeviceIds(Long[] deviceIds) {
public int deleteKitchenDeviceInfoByDeviceIds(List<Long> deviceIds) {
return kitchenDeviceInfoMapper.deleteKitchenDeviceInfoByDeviceIds(deviceIds);
}
/**
* 删除厨房设备基础信息信息
*
*
* @param deviceId 厨房设备基础信息主键
* @return 结果
*/

View File

@ -1,6 +1,9 @@
package com.bonus.canteen.core.kitchen.service.impl;
import java.util.List;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceUsageListVO;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -11,7 +14,7 @@ import com.bonus.canteen.core.kitchen.service.IKitchenDeviceUsageService;
/**
* 厨房设备使用记录Service业务层处理
*
*
* @author xsheng
* @date 2025-06-16
*/
@ -22,29 +25,29 @@ public class KitchenDeviceUsageServiceImpl implements IKitchenDeviceUsageService
/**
* 查询厨房设备使用记录
*
*
* @param usageId 厨房设备使用记录主键
* @return 厨房设备使用记录
*/
@Override
public KitchenDeviceUsage selectKitchenDeviceUsageByUsageId(Long usageId) {
public KitchenDeviceUsageListVO selectKitchenDeviceUsageByUsageId(Long usageId) {
return kitchenDeviceUsageMapper.selectKitchenDeviceUsageByUsageId(usageId);
}
/**
* 查询厨房设备使用记录列表
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 厨房设备使用记录
*/
@Override
public List<KitchenDeviceUsage> selectKitchenDeviceUsageList(KitchenDeviceUsage kitchenDeviceUsage) {
public List<KitchenDeviceUsageListVO> selectKitchenDeviceUsageList(KitchenDeviceListDTO kitchenDeviceUsage) {
return kitchenDeviceUsageMapper.selectKitchenDeviceUsageList(kitchenDeviceUsage);
}
/**
* 新增厨房设备使用记录
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 结果
*/
@ -60,7 +63,7 @@ public class KitchenDeviceUsageServiceImpl implements IKitchenDeviceUsageService
/**
* 修改厨房设备使用记录
*
*
* @param kitchenDeviceUsage 厨房设备使用记录
* @return 结果
*/
@ -76,7 +79,7 @@ public class KitchenDeviceUsageServiceImpl implements IKitchenDeviceUsageService
/**
* 批量删除厨房设备使用记录
*
*
* @param usageIds 需要删除的厨房设备使用记录主键
* @return 结果
*/
@ -87,7 +90,7 @@ public class KitchenDeviceUsageServiceImpl implements IKitchenDeviceUsageService
/**
* 删除厨房设备使用记录信息
*
*
* @param usageId 厨房设备使用记录主键
* @return 结果
*/

View File

@ -0,0 +1,34 @@
package com.bonus.canteen.core.kitchen.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.mapper.KitchenDeviceInfoMapper;
import com.bonus.canteen.core.kitchen.mapper.KitchenHomePageMapper;
import com.bonus.canteen.core.kitchen.service.IKitchenDeviceInfoService;
import com.bonus.canteen.core.kitchen.service.IKitchenHomePageService;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.InetAddress;
import java.util.List;
/**
* 厨房设备基础信息Service业务层处理
*
* @author xsheng
* @date 2025-06-16
*/
@Service
public class KitchenHomePageerviceImpl implements IKitchenHomePageService {
@Resource
private KitchenHomePageMapper kitchenHomePageMapper;
}

View File

@ -0,0 +1,88 @@
package com.bonus.canteen.core.kitchen.vo;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
/**
* 厨房设备基础信息对象 kitchen_device_info
*
* @author xsheng
* @date 2025-06-16
*/
@Data
@ToString
public class KitchenDeviceListVO {
private static final long serialVersionUID = 1L;
/** 设备id */
private Long deviceId;
/** 设备编号 */
@ApiModelProperty(value = "设备编号")
private String deviceNo;
/** 食堂id */
@ApiModelProperty(value = "食堂id")
private Long canteenId;
/** 区域id */
@ApiModelProperty(value = "区域id")
private Long areaId;
/** 设备密码 */
@ApiModelProperty(value = "设备密码")
private String devicePwd;
/** 设备类型(1-摄像头 2-传感器 3-门禁 4-仪表 5-仪器, 参考DeviceTypeEnum) */
@ApiModelProperty(value = "设备类型(1-摄像头 2-传感器 3-门禁 4-仪表 5-仪器, 参考DeviceTypeEnum)")
private Integer deviceType;
/** 设备类型 */
@ApiModelProperty(value = "设备类型")
private Integer deviceCategory;
/** 设备型号 */
@ApiModelProperty(value = "设备型号")
private String deviceSize;
/** 设备名称 */
@ApiModelProperty(value = "设备名称")
private String deviceName;
/** 设备sn */
@ApiModelProperty(value = "设备sn")
private String deviceSn;
/** 所在位置 */
@ApiModelProperty(value = "所在位置")
private String subPlace;
/** 设备是否在线 1 在线 2 离线 */
@ApiModelProperty(value = "设备是否在线 1 在线 2 离线")
private Integer deviceNetworkState;
/** 设备维护周期 1 每月 2 每季度 3 每半年 4 每年 */
@ApiModelProperty(value = " 设备维护周期 1 每月 2 每季度 3 每半年 4 每年")
private Long deviceRepairPeriod;
/** 设备扩展信息表 */
@ApiModelProperty(value = "设备扩展信息表")
private String deviceExtendInfo;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
private String areaName;
private String canteenName;
}

View File

@ -0,0 +1,77 @@
package com.bonus.canteen.core.kitchen.vo;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
/**
* 厨房设备使用记录对象 kitchen_device_usage
*
* @author xsheng
* @date 2025-06-16
*/
@Data
@ToString
public class KitchenDeviceUsageListVO {
/** 主键id */
private Long usageId;
/** 设备编号 */
@ApiModelProperty(value = "设备编号")
private String deviceNo;
/** 设备id */
@ApiModelProperty(value = "设备id")
private Long deviceId;
/** 设备类型 */
@ApiModelProperty(value = "设备类型")
private Long deviceType;
/** 区域id */
@ApiModelProperty(value = "区域id")
private Long areaId;
@ApiModelProperty(value = "区域名称")
private String areaName;
/** 食堂id */
@ApiModelProperty(value = "食堂id")
private Long canteenId;
@ApiModelProperty(value = "食堂名称")
private String canteenName;
/** 工作状态 */
@ApiModelProperty(value = "工作状态")
private Long workState;
/** 开始使用时间 */
@ApiModelProperty(value = "开始使用时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startUseTime;
/** 结束使用时间 */
@ApiModelProperty(value = "结束使用时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endUseTime;
/** 使用时长 */
@ApiModelProperty(value = "使用时长")
private BigDecimal useTime;
/** 是否结束标志 */
@ApiModelProperty(value = "是否结束标志")
private Long endTag;
}

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.kitchen.mapper.KitchenDeviceInfoMapper">
<resultMap type="com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo" id="KitchenDeviceInfoResult">
<resultMap type="com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO" id="KitchenDeviceInfoResult">
<result property="deviceId" column="device_id" />
<result property="deviceNo" column="device_no" />
<result property="canteenId" column="canteen_id" />
@ -19,23 +19,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceRepairPeriod" column="device_repair_period" />
<result property="deviceExtendInfo" column="device_extend_info" />
<result property="delFlag" column="del_flag" />
<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="areaName" column="areaName" />
<result property="canteenName" column="canteenName" />
</resultMap>
<sql id="selectKitchenDeviceInfoVo">
select device_id, device_no, canteen_id, area_id, device_pwd, device_type, device_category, device_size, device_name, device_sn, sub_place, device_network_state, device_repair_period, device_extend_info, del_flag, create_by, create_time, update_by, update_time from kitchen_device_info
SELECT
device_id,
device_no,
canteen_id,
area_id,
device_pwd,
device_type,
device_category,
device_size,
device_name,
device_sn,
sub_place,
device_network_state,
device_repair_period,
device_extend_info,
del_flag,
create_by,
create_time,
update_by,
update_time,
vac.vAreaName as areaName,
vac.vCanteenName as canteenName
FROM
kitchen_device_info kit
LEFT JOIN v_area_canteen vac on vac.vAreaId = kit.area_id and vac.vCanteenId = kit.canteen_id
</sql>
<select id="selectKitchenDeviceInfoList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo" resultMap="KitchenDeviceInfoResult">
<select id="selectKitchenDeviceInfoList" parameterType="com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO" resultMap="KitchenDeviceInfoResult">
<include refid="selectKitchenDeviceInfoVo"/>
<where>
<where>
<if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo}</if>
<if test="canteenId != null "> and canteen_id = #{canteenId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="devicePwd != null and devicePwd != ''"> and device_pwd = #{devicePwd}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
<if test="deviceCategory != null "> and device_category = #{deviceCategory}</if>
<if test="deviceSize != null and deviceSize != ''"> and device_size = #{deviceSize}</if>
@ -43,16 +64,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
<if test="subPlace != null and subPlace != ''"> and sub_place = #{subPlace}</if>
<if test="deviceNetworkState != null "> and device_network_state = #{deviceNetworkState}</if>
<if test="deviceRepairPeriod != null "> and device_repair_period = #{deviceRepairPeriod}</if>
<if test="deviceExtendInfo != null and deviceExtendInfo != ''"> and device_extend_info = #{deviceExtendInfo}</if>
</where>
</select>
<select id="selectKitchenDeviceInfoByDeviceId" parameterType="Long" resultMap="KitchenDeviceInfoResult">
<include refid="selectKitchenDeviceInfoVo"/>
where device_id = #{deviceId}
</select>
<insert id="insertKitchenDeviceInfo" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo" useGeneratedKeys="true" keyProperty="deviceId">
insert into kitchen_device_info
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -122,14 +141,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where device_id = #{deviceId}
</update>
<delete id="deleteKitchenDeviceInfoByDeviceId" parameterType="Long">
delete from kitchen_device_info where device_id = #{deviceId}
</delete>
<!-- <delete id="deleteKitchenDeviceInfoByDeviceId" parameterType="Long">-->
<!-- delete from kitchen_device_info where device_id = #{deviceId}-->
<!-- </delete>-->
<delete id="deleteKitchenDeviceInfoByDeviceIds" parameterType="String">
delete from kitchen_device_info where device_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
<!-- <delete id="deleteKitchenDeviceInfoByDeviceIds" parameterType="String">-->
<!-- delete from kitchen_device_info where device_id in -->
<!-- <foreach item="deviceId" collection="array" open="(" separator="," close=")">-->
<!-- #{deviceId}-->
<!-- </foreach>-->
<!-- </delete>-->
<update id="deleteKitchenDeviceInfoByDeviceId" parameterType="Long">
update kitchen_device_info set del_flag ='2' where device_id = #{deviceId}
</update>
<update id="deleteKitchenDeviceInfoByDeviceIds" parameterType="String">
update kitchen_device_info set del_flag ='2' where device_id in
<foreach item="deviceId" collection="list" open="(" separator="," close=")">
#{deviceId}
</foreach>
</delete>
</mapper>
</update>
</mapper>

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.kitchen.mapper.KitchenDeviceUsageMapper">
<resultMap type="com.bonus.canteen.core.kitchen.domain.KitchenDeviceUsage" id="KitchenDeviceUsageResult">
<resultMap type="com.bonus.canteen.core.kitchen.vo.KitchenDeviceUsageListVO" id="KitchenDeviceUsageResult">
<result property="usageId" column="usage_id" />
<result property="deviceNo" column="device_no" />
<result property="deviceId" column="device_id" />
@ -15,37 +15,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="endUseTime" column="end_use_time" />
<result property="useTime" column="use_time" />
<result property="endTag" column="end_tag" />
<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="areaName" column="areaName" />
<result property="canteenName" column="canteenName" />
</resultMap>
<sql id="selectKitchenDeviceUsageVo">
select usage_id, device_no, device_id, device_type, area_id, canteen_id, work_state, start_use_time, end_use_time, use_time, end_tag, create_by, create_time, update_by, update_time from kitchen_device_usage
SELECT
usage_id,
device_no,
device_id,
device_type,
area_id,
canteen_id,
CASE
WHEN kdu.work_state = 1 THEN '工作中'
WHEN kdu.work_state = 0 THEN '离线'
ELSE '未知状态'
END as work_state,
start_use_time,
end_use_time,
use_time,
end_tag,
create_by,
create_time,
update_by,
update_time,
vac.vAreaName as areaName,
vac.vCanteenName as canteenName
FROM
kitchen_device_usage kdu
LEFT JOIN v_area_canteen vac on kdu.canteen_id = vac.vCanteenId and kdu.area_id = vac.vAreaId
</sql>
<select id="selectKitchenDeviceUsageList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenDeviceUsage" resultMap="KitchenDeviceUsageResult">
<select id="selectKitchenDeviceUsageList" parameterType="com.bonus.canteen.core.kitchen.dto.KitchenDeviceUsageListDTO" resultMap="KitchenDeviceUsageResult">
<include refid="selectKitchenDeviceUsageVo"/>
<where>
<where>
<if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="canteenId != null "> and canteen_id = #{canteenId}</if>
<if test="workState != null "> and work_state = #{workState}</if>
<if test="startUseTime != null "> and start_use_time = #{startUseTime}</if>
<if test="endUseTime != null "> and end_use_time = #{endUseTime}</if>
<if test="useTime != null "> and use_time = #{useTime}</if>
<if test="endTag != null "> and end_tag = #{endTag}</if>
</where>
</select>
<select id="selectKitchenDeviceUsageByUsageId" parameterType="Long" resultMap="KitchenDeviceUsageResult">
<include refid="selectKitchenDeviceUsageVo"/>
where usage_id = #{usageId}
</select>
<insert id="insertKitchenDeviceUsage" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenDeviceUsage" useGeneratedKeys="true" keyProperty="usageId">
insert into kitchen_device_usage
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -108,9 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteKitchenDeviceUsageByUsageIds" parameterType="String">
delete from kitchen_device_usage where usage_id in
delete from kitchen_device_usage where usage_id in
<foreach item="usageId" collection="array" open="(" separator="," close=")">
#{usageId}
</foreach>
</delete>
</mapper>
</mapper>

View File

@ -0,0 +1,7 @@
<?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.bonus.canteen.core.kitchen.mapper.KitchenHomePageMapper">
</mapper>