diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenDeviceSensorMetricController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenDeviceSensorMetricController.java index 5d018fe..62bf9fb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenDeviceSensorMetricController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenDeviceSensorMetricController.java @@ -55,7 +55,7 @@ public class KitchenDeviceSensorMetricController extends BaseController { @ApiOperation(value = "导出厨房设备衡量指标设置列表") //@PreventRepeatSubmit //@RequiresPermissions("kitchen:metric:export") - @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出厨房设备衡量指标设置") + @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.EXPORT, logType = 1,module = "厨房管理->导出厨房设备衡量指标设置") @PostMapping("/export") public void export(HttpServletResponse response, KitchenDeviceSensorMetric kitchenDeviceSensorMetric) { List list = kitchenDeviceSensorMetricService.selectKitchenDeviceSensorMetricList(kitchenDeviceSensorMetric); @@ -79,7 +79,7 @@ public class KitchenDeviceSensorMetricController extends BaseController { @ApiOperation(value = "新增厨房设备衡量指标设置") //@PreventRepeatSubmit //@RequiresPermissions("kitchen:metric:add") - @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增厨房设备衡量指标设置") + @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.INSERT, logType = 1,module = "厨房管理->新增厨房设备衡量指标设置") @PostMapping public AjaxResult add(@RequestBody KitchenDeviceSensorMetric kitchenDeviceSensorMetric) { try { @@ -89,13 +89,26 @@ public class KitchenDeviceSensorMetricController extends BaseController { } } + @ApiOperation(value = "批量新增厨房设备衡量指标设置") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:metric:add") + @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.INSERT, logType = 1,module = "厨房管理->批量新增厨房设备衡量指标设置") + @PostMapping("/batchAdd") + public AjaxResult batchAdd(@RequestBody List list) { + try { + return toAjax(kitchenDeviceSensorMetricService.batchInsertKitchenDeviceSensorMetric(list)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + /** * 修改厨房设备衡量指标设置 */ @ApiOperation(value = "修改厨房设备衡量指标设置") //@PreventRepeatSubmit //@RequiresPermissions("kitchen:metric:edit") - @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改厨房设备衡量指标设置") + @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.UPDATE, logType = 1,module = "厨房管理->修改厨房设备衡量指标设置") @PostMapping("/edit") public AjaxResult edit(@RequestBody KitchenDeviceSensorMetric kitchenDeviceSensorMetric) { try { @@ -105,13 +118,26 @@ public class KitchenDeviceSensorMetricController extends BaseController { } } + @ApiOperation(value = "批量修改厨房设备衡量指标设置") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:metric:edit") + @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.UPDATE, logType = 1,module = "厨房管理->批量修改厨房设备衡量指标设置") + @PostMapping("/batchEdit") + public AjaxResult batchEdit(@RequestBody List list) { + try { + return toAjax(kitchenDeviceSensorMetricService.batchUpdateKitchenDeviceSensorMetric(list)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + /** * 删除厨房设备衡量指标设置 */ @ApiOperation(value = "删除厨房设备衡量指标设置") //@PreventRepeatSubmit //@RequiresPermissions("kitchen:metric:remove") - @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除厨房设备衡量指标设置") + @SysLog(title = "厨房设备衡量指标设置", businessType = OperaType.DELETE, logType = 1,module = "厨房管理->删除厨房设备衡量指标设置") @PostMapping("/del/{measureIds}") public AjaxResult remove(@PathVariable Long[] measureIds) { return toAjax(kitchenDeviceSensorMetricService.deleteKitchenDeviceSensorMetricByMeasureIds(measureIds)); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorMetric.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorMetric.java index ac5a20c..b225afc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorMetric.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorMetric.java @@ -23,15 +23,15 @@ public class KitchenDeviceSensorMetric extends BaseEntity { /** 主键ID */ private Long measureId; - /** 参数名称 */ - @Excel(name = "参数名称") - @ApiModelProperty(value = "参数代码") - private String measureCode; + /** 设备类型 */ + @Excel(name = "设备类型") + @ApiModelProperty(value = "设备类型") + private Long deviceType; - /** 参数名称 */ - @Excel(name = "参数名称") - @ApiModelProperty(value = "参数代码") - private String deviceType; + /** 参数编码 */ + @Excel(name = "参数编码") + @ApiModelProperty(value = "参数编码") + private String measureCode; /** 参数名称 */ @Excel(name = "参数名称") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenDeviceSensorMetricService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenDeviceSensorMetricService.java index a52a8be..9652fa8 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenDeviceSensorMetricService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenDeviceSensorMetricService.java @@ -34,6 +34,8 @@ public interface IKitchenDeviceSensorMetricService { */ public int insertKitchenDeviceSensorMetric(KitchenDeviceSensorMetric kitchenDeviceSensorMetric); + public int batchInsertKitchenDeviceSensorMetric(List kitchenDeviceSensorMetric); + /** * 修改厨房设备衡量指标设置 * @@ -42,6 +44,8 @@ public interface IKitchenDeviceSensorMetricService { */ public int updateKitchenDeviceSensorMetric(KitchenDeviceSensorMetric kitchenDeviceSensorMetric); + public int batchUpdateKitchenDeviceSensorMetric(List list); + /** * 批量删除厨房设备衡量指标设置 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorMetricServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorMetricServiceImpl.java index 4f0c66c..5cc6727 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorMetricServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorMetricServiceImpl.java @@ -3,6 +3,7 @@ package com.bonus.canteen.core.kitchen.service.impl; import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.kitchen.mapper.KitchenDeviceSensorMetricMapper; @@ -51,6 +52,7 @@ public class KitchenDeviceSensorMetricServiceImpl implements IKitchenDeviceSenso @Override public int insertKitchenDeviceSensorMetric(KitchenDeviceSensorMetric kitchenDeviceSensorMetric) { kitchenDeviceSensorMetric.setCreateTime(DateUtils.getNowDate()); + kitchenDeviceSensorMetric.setCreateBy(SecurityUtils.getUsername()); try { return kitchenDeviceSensorMetricMapper.insertKitchenDeviceSensorMetric(kitchenDeviceSensorMetric); } catch (Exception e) { @@ -58,6 +60,21 @@ public class KitchenDeviceSensorMetricServiceImpl implements IKitchenDeviceSenso } } + @Override + public int batchInsertKitchenDeviceSensorMetric(List list) { + try { + int count = 0; + for (KitchenDeviceSensorMetric metric : list) { + metric.setCreateTime(DateUtils.getNowDate()); + metric.setCreateBy(SecurityUtils.getUsername()); + count += kitchenDeviceSensorMetricMapper.insertKitchenDeviceSensorMetric(metric); + } + return count; + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } + /** * 修改厨房设备衡量指标设置 * @@ -67,6 +84,7 @@ public class KitchenDeviceSensorMetricServiceImpl implements IKitchenDeviceSenso @Override public int updateKitchenDeviceSensorMetric(KitchenDeviceSensorMetric kitchenDeviceSensorMetric) { kitchenDeviceSensorMetric.setUpdateTime(DateUtils.getNowDate()); + kitchenDeviceSensorMetric.setUpdateBy(SecurityUtils.getUsername()); try { return kitchenDeviceSensorMetricMapper.updateKitchenDeviceSensorMetric(kitchenDeviceSensorMetric); } catch (Exception e) { @@ -74,6 +92,21 @@ public class KitchenDeviceSensorMetricServiceImpl implements IKitchenDeviceSenso } } + @Override + public int batchUpdateKitchenDeviceSensorMetric(List list) { + try { + int count = 0; + for (KitchenDeviceSensorMetric metric : list) { + metric.setUpdateTime(DateUtils.getNowDate()); + metric.setUpdateBy(SecurityUtils.getUsername()); + count += kitchenDeviceSensorMetricMapper.updateKitchenDeviceSensorMetric(metric); + } + return count; + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } + /** * 批量删除厨房设备衡量指标设置 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorMetricMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorMetricMapper.xml index 05fca77..ce56053 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorMetricMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorMetricMapper.xml @@ -5,8 +5,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -19,14 +19,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select measure_id, measure_code, device_type, measure_name, measure_type, measure_unit, measure_min_value, measure_max_value, create_by, create_time, update_by, update_time from kitchen_device_sensor_metric + select measure_id, device_type, measure_code, measure_name, measure_type, measure_unit, + measure_min_value, measure_max_value, create_by, create_time, update_by, update_time + from kitchen_device_sensor_metric - + insert into kitchen_device_sensor_metric + device_type, measure_code, measure_name, measure_type, @@ -59,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time, + #{deviceType}, #{measureCode}, #{measureName}, #{measureType}, @@ -75,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update kitchen_device_sensor_metric + device_type = #{deviceType}, measure_code = #{measureCode}, measure_name = #{measureName}, measure_type = #{measureType},