diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookDishesController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookDishesController.java index 0d8afeb..ab3527a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookDishesController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookDishesController.java @@ -64,7 +64,7 @@ public class CookDishesController extends BaseController { * 获取菜品信息详细信息 */ @ApiOperation(value = "获取菜品信息详细信息") - @GetMapping(value = "/{dishesId}") + @GetMapping(value = "/getInfo/{dishesId}") public AjaxResult getInfo(@PathVariable("dishesId") Long dishesId) { return success(cookDishesService.selectCookDishesByDishesId(dishesId)); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookDishesMaterial.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookDishesMaterial.java index 4c36ca4..6233908 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookDishesMaterial.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookDishesMaterial.java @@ -32,7 +32,9 @@ public class CookDishesMaterial extends BaseEntity { @Excel(name = "食材id") @ApiModelProperty(value = "食材id") private Long materialId; - + @Excel(name = "食材名称") + @ApiModelProperty(value = "食材名称") + private String materialName; /** 食材重量(g) */ @Excel(name = "食材重量(g)") @ApiModelProperty(value = "食材重量(g)") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookDishesMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookDishesMapper.java index 6b0b9f0..e715fd8 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookDishesMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookDishesMapper.java @@ -124,4 +124,12 @@ public interface CookDishesMapper { * @param dishesIds 菜品id */ void deleteCookDishesByDishPlanDetailIds(@Param("detailIdList") List detailIdList,@Param("dishesIds") Long[] dishesIds); + + /** + * 根据菜品id查询菜品材料信息 + * + * @param cookDishes 菜品id + * @return 菜品材料信息 + */ + List selectCookDishesMaterialList(CookDishes cookDishes); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java index c205b81..0676fb7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java @@ -39,7 +39,10 @@ public class CookDishesServiceImpl implements ICookDishesService { */ @Override public CookDishes selectCookDishesByDishesId(Long dishesId) { - return cookDishesMapper.selectCookDishesByDishesId(dishesId); + CookDishes cookDishes = cookDishesMapper.selectCookDishesByDishesId(dishesId); + List dishesMaterialList = cookDishesMapper.selectCookDishesMaterialList(cookDishes); + cookDishes.setDishesMaterialList(dishesMaterialList); + return cookDishes; } /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceAppVersionController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceAppVersionController.java index 9b7435d..ef27ee5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceAppVersionController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceAppVersionController.java @@ -2,6 +2,9 @@ package com.bonus.canteen.core.device.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import com.bonus.canteen.core.device.domain.ApkDTO; import com.bonus.common.log.enums.OperaType; //import com.bonus.canteen.core.device.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; @@ -77,8 +80,6 @@ public class DeviceAppVersionController extends BaseController { * 新增版本 */ @ApiOperation(value = "新增版本") - //@PreventRepeatSubmit - //@RequiresPermissions("device:version:add") @SysLog(title = "版本", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增版本") @PostMapping public AjaxResult add(@RequestBody DeviceAppVersion deviceAppVersion) { @@ -116,4 +117,11 @@ public class DeviceAppVersionController extends BaseController { public AjaxResult remove(@PathVariable Integer[] ids) { return toAjax(deviceAppVersionService.deleteDeviceAppVersionByIds(ids)); } + + + @ApiOperation(value = "上传APK") + @PostMapping({"/uploadApk"}) + public AjaxResult uploadApk(@RequestBody @Valid ApkDTO dto) { + return this.deviceAppVersionService.uploadApk(dto); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceInfoController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceInfoController.java index 8fc8b2b..8f1f564 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceInfoController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DeviceInfoController.java @@ -41,7 +41,6 @@ public class DeviceInfoController extends BaseController { * 查询设备资料列表 */ @ApiOperation(value = "查询设备资料列表") - //@RequiresPermissions("device:info:list") @GetMapping("/list") public TableDataInfo list(DeviceInfo deviceInfo) { startPage(); @@ -53,8 +52,6 @@ public class DeviceInfoController extends BaseController { * 导出设备资料列表 */ @ApiOperation(value = "导出设备资料列表") - //@PreventRepeatSubmit - //@RequiresPermissions("device:info:export") @SysLog(title = "设备资料", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出设备资料") @PostMapping("/export") public void export(HttpServletResponse response, DeviceInfo deviceInfo) { @@ -67,7 +64,6 @@ public class DeviceInfoController extends BaseController { * 获取设备资料详细信息 */ @ApiOperation(value = "获取设备资料详细信息") - //@RequiresPermissions("device:info:query") @GetMapping(value = "/{deviceId}") public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) { return success(deviceInfoService.selectDeviceInfoByDeviceId(deviceId)); @@ -77,10 +73,8 @@ public class DeviceInfoController extends BaseController { * 新增设备资料 */ @ApiOperation(value = "新增设备资料") - //@PreventRepeatSubmit - //@RequiresPermissions("device:info:add") @SysLog(title = "设备资料", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增设备资料") - @PostMapping + @PostMapping("/add") public AjaxResult add(@RequestBody DeviceInfo deviceInfo) { try { return toAjax(deviceInfoService.insertDeviceInfo(deviceInfo)); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/domain/ApkDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/domain/ApkDTO.java new file mode 100644 index 0000000..89cacca --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/domain/ApkDTO.java @@ -0,0 +1,21 @@ +package com.bonus.canteen.core.device.domain; + +import com.bonus.common.core.web.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author 19814 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class ApkDTO extends BaseEntity { + private String version; + private String versionName; + private String apkName; + private String apkPath; + private String updateContent; + private String deployUser; + private String type; + private String canteenType; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/domain/DeviceInfo.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/domain/DeviceInfo.java index 169a277..108019c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/domain/DeviceInfo.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/domain/DeviceInfo.java @@ -210,4 +210,12 @@ public class DeviceInfo extends BaseEntity { private Long lastUpdateTime; + private String areaId; + private String areaName; + private String canteenId; + private String canteenName; + private String stallId; + private String stallName; + private String recipeId; + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceAppVersionMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceAppVersionMapper.java index eff1db3..bff69bd 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceAppVersionMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceAppVersionMapper.java @@ -1,7 +1,10 @@ package com.bonus.canteen.core.device.mapper; import java.util.List; + +import com.bonus.canteen.core.device.domain.ApkDTO; import com.bonus.canteen.core.device.domain.DeviceAppVersion; +import org.apache.ibatis.annotations.Param; /** * 版本Mapper接口 @@ -57,4 +60,11 @@ public interface DeviceAppVersionMapper { * @return 结果 */ public int deleteDeviceAppVersionByIds(Integer[] ids); + + + ApkDTO getApkByType(@Param("type") String type, @Param("version") String version); + + int updateApk(ApkDTO dto); + + int insertApk(ApkDTO dto); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceInfoMapper.java index 98c25e4..31a8e0d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceInfoMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DeviceInfoMapper.java @@ -2,6 +2,7 @@ package com.bonus.canteen.core.device.mapper; import java.util.List; import com.bonus.canteen.core.device.domain.DeviceInfo; +import org.apache.ibatis.annotations.Param; /** * 设备资料Mapper接口 @@ -56,5 +57,83 @@ public interface DeviceInfoMapper { * @param deviceIds 需要删除的数据主键集合 * @return 结果 */ - public int deleteDeviceInfoByDeviceIds(Long[] deviceIds); + public int deleteDeviceInfoByDeviceIds(@Param("deviceIds") Long[] deviceIds); + + /** + * 校验设备名称是否唯一 + * + * @param deviceInfo 设备名称 + * @return 结果 + */ + int checkDeviceNameUnique(DeviceInfo deviceInfo); + + /** + * 校验设备编号是否唯一 + * + * @param deviceInfo 设备编号 + * @return 结果 + */ + int checkDeviceNumberUnique(DeviceInfo deviceInfo); + + /** + * 校验设备序列号是否唯一 + * + * @param deviceInfo 设备序列号 + * @return 结果 + */ + int checkDeviceSnUnique(DeviceInfo deviceInfo); + + /** + * 新增设备绑定关系 + * + * @param deviceInfo 设备绑定关系 + * @return 结果 + */ + int insertDeviceBinding(DeviceInfo deviceInfo); + + /** + * 修改设备绑定关系 + * + * @param deviceInfo 设备绑定关系 + * @return 结果 + */ + int updateDeviceBinding(DeviceInfo deviceInfo); + + /** + * 新增设备菜谱关系 + * + * @param deviceInfo 设备菜谱关系 + * @return 结果 + */ + int insertDeviceRecipeBinding(DeviceInfo deviceInfo); + + /** + * 修改设备菜谱关系 + * + * @param deviceInfo 设备菜谱关系 + * @return 结果 + */ + int updateDeviceRecipeBinding(DeviceInfo deviceInfo); + + /** + * 查询设备菜谱关系 + * + * @param deviceInfo 设备菜谱关系 + * @return 结果 + */ + String selectDeviceRecipeBinding(DeviceInfo deviceInfo); + + /** + * 批量删除设备绑定关系 + * + * @param deviceIds 需要删除的数据主键集合 + */ + void deleteDeviceBinding(@Param("deviceIds") Long[] deviceIds); + + /** + * 批量删除设备菜谱关系 + * + * @param deviceIds 需要删除的数据主键集合 + */ + void deleteDeviceRecipeBinding(@Param("deviceIds") Long[] deviceIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/IDeviceAppVersionService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/IDeviceAppVersionService.java index c98c5d3..16fdb9e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/IDeviceAppVersionService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/IDeviceAppVersionService.java @@ -1,7 +1,12 @@ package com.bonus.canteen.core.device.service; import java.util.List; + +import com.bonus.canteen.core.device.domain.ApkDTO; import com.bonus.canteen.core.device.domain.DeviceAppVersion; +import com.bonus.common.core.web.domain.AjaxResult; + +import javax.validation.Valid; /** * 版本Service接口 @@ -57,4 +62,6 @@ public interface IDeviceAppVersionService { * @return 结果 */ public int deleteDeviceAppVersionById(Integer id); + + AjaxResult uploadApk(@Valid ApkDTO dto); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceAppVersionServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceAppVersionServiceImpl.java index e6821aa..267e83a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceAppVersionServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceAppVersionServiceImpl.java @@ -1,8 +1,11 @@ package com.bonus.canteen.core.device.service.impl; import java.util.List; + +import com.bonus.canteen.core.device.domain.ApkDTO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.web.domain.AjaxResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.device.mapper.DeviceAppVersionMapper; @@ -95,4 +98,24 @@ public class DeviceAppVersionServiceImpl implements IDeviceAppVersionService { public int deleteDeviceAppVersionById(Integer id) { return deviceAppVersionMapper.deleteDeviceAppVersionById(id); } + + @Override + public AjaxResult uploadApk(ApkDTO dto) { + try { + ApkDTO apkDTO = deviceAppVersionMapper.getApkByType(dto.getCanteenType(), dto.getVersion()); + if (apkDTO != null) { + //检查最新的一条版本是否相同 + ApkDTO lastBean = deviceAppVersionMapper.getApkByType(dto.getCanteenType(), null); + if (lastBean != null && !lastBean.getVersion().equals(dto.getVersion())){ + return AjaxResult.error("该版本已存在"); + } + deviceAppVersionMapper.updateApk(dto); + } else { + deviceAppVersionMapper.insertApk(dto); + } + } catch (Exception e) { + return AjaxResult.error("操作失败"); + } + return AjaxResult.success(); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceInfoServiceImpl.java index 61191e9..a12b89e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DeviceInfoServiceImpl.java @@ -3,11 +3,14 @@ package com.bonus.canteen.core.device.service.impl; import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.utils.StringUtils; +import com.bonus.common.houqin.constant.GlobalConstants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.device.mapper.DeviceInfoMapper; import com.bonus.canteen.core.device.domain.DeviceInfo; import com.bonus.canteen.core.device.service.IDeviceInfoService; +import org.springframework.transaction.annotation.Transactional; /** * 设备资料Service业务层处理 @@ -49,10 +52,14 @@ public class DeviceInfoServiceImpl implements IDeviceInfoService { * @return 结果 */ @Override + @Transactional(rollbackFor = Exception.class) public int insertDeviceInfo(DeviceInfo deviceInfo) { deviceInfo.setCreateTime(DateUtils.getNowDate()); try { - return deviceInfoMapper.insertDeviceInfo(deviceInfo); + checkParam(deviceInfo,false); + deviceInfoMapper.insertDeviceInfo(deviceInfo); + deviceInfoMapper.insertDeviceRecipeBinding(deviceInfo); + return deviceInfoMapper.insertDeviceBinding(deviceInfo); } catch (Exception e) { throw new ServiceException(e.getMessage()); } @@ -65,15 +72,62 @@ public class DeviceInfoServiceImpl implements IDeviceInfoService { * @return 结果 */ @Override + @Transactional(rollbackFor = Exception.class) public int updateDeviceInfo(DeviceInfo deviceInfo) { deviceInfo.setUpdateTime(DateUtils.getNowDate()); try { - return deviceInfoMapper.updateDeviceInfo(deviceInfo); + checkParam(deviceInfo,true); + deviceInfoMapper.updateDeviceInfo(deviceInfo); + deviceInfoMapper.updateDeviceRecipeBinding(deviceInfo); + return deviceInfoMapper.updateDeviceBinding(deviceInfo); } catch (Exception e) { throw new ServiceException(e.getMessage()); } } + private void checkParam(DeviceInfo deviceInfo, boolean isUpdate) throws Exception { + deviceInfo.setTenantId(GlobalConstants.TENANT_ID); + if (isUpdate){ + if (deviceInfo.getDeviceId() == null) { + throw new Exception("设备ID不能为空"); + } + } + if (deviceInfo.getDeviceType() == null) { + throw new Exception("设备类型不能为空"); + } + if (deviceInfo.getDeviceType() == 1L){ + if (deviceInfo.getAreaId() == null || StringUtils.isBlank(deviceInfo.getAreaId())) { + throw new Exception("区域不能为空"); + } + if (deviceInfo.getCanteenId() == null || StringUtils.isBlank(deviceInfo.getCanteenId())) { + throw new Exception("食堂不能为空"); + } + if (deviceInfo.getStallId() == null || StringUtils.isBlank(deviceInfo.getStallId())) { + throw new Exception("档口不能为空"); + } + } + if (deviceInfo.getDeviceName() == null || StringUtils.isBlank(deviceInfo.getDeviceName())) { + throw new Exception("设备名称不能为空"); + } + if (deviceInfo.getDeviceNumber() == null || StringUtils.isBlank(deviceInfo.getDeviceNumber())) { + throw new Exception("设备编号不能为空"); + } + if (deviceInfoMapper.checkDeviceNameUnique(deviceInfo) > 0) { + throw new Exception("设备名称已存在"); + } + if (deviceInfoMapper.checkDeviceNumberUnique(deviceInfo) > 0) { + throw new Exception("设备编号已存在"); + } + if (deviceInfoMapper.checkDeviceSnUnique(deviceInfo) > 0) { + throw new Exception("设备SN已存在"); + } + //查询是否档口已经绑定菜谱 + String recipeId = deviceInfoMapper.selectDeviceRecipeBinding(deviceInfo); + if (StringUtils.isNotBlank(recipeId)){ + deviceInfo.setRecipeId(recipeId); + } + } + /** * 批量删除设备资料 * @@ -81,7 +135,10 @@ public class DeviceInfoServiceImpl implements IDeviceInfoService { * @return 结果 */ @Override + @Transactional(rollbackFor = Exception.class) public int deleteDeviceInfoByDeviceIds(Long[] deviceIds) { + deviceInfoMapper.deleteDeviceBinding(deviceIds); + deviceInfoMapper.deleteDeviceRecipeBinding(deviceIds); return deviceInfoMapper.deleteDeviceInfoByDeviceIds(deviceIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml index c7fa74b..1bdf740 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml @@ -186,6 +186,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + insert into cook_dishes diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceAppVersionMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceAppVersionMapper.xml index 8ba7dda..11932d2 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceAppVersionMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceAppVersionMapper.xml @@ -103,4 +103,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + + update device_app_version + + + version = #{version}, + + + version_name = #{versionName}, + + + apk_name = #{apkName}, + + + apk_path = #{apkPath}, + + + update_content = #{updateContent}, + + + deploy_user = #{deployUser}, + + + canteen_type = #{type}, + + + where version = #{version} + + + insert into device_app_version(version, version_name, apk_name, apk_path, update_content, deploy_user, canteen_type) + values (#{version}, #{versionName}, #{apkName}, #{apkPath}, #{updateContent}, #{deployUser}, #{type}) + \ No newline at end of file diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceInfoMapper.xml index 6951b7d..829e73e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DeviceInfoMapper.xml @@ -47,60 +47,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + - select device_id, device_name, parent_id, parent_type, tenant_id, online_state, version_code, version_name, consume_mode, communicate_mode, device_ip, device_mask, device_mac, device_gateway, dns_primary, dns_backup, device_sn, device_number, device_model, device_type, device_pwd, device_addr, device_key, device_service_ip, device_service_port, if_quota_limit, if_discount, if_time_limit, if_use_call_num, if_off_line_pay, if_use, img_url, data_transfer_status, print_status, print_key, device_state, device_protocol, heart_beat_time, last_update_time, create_by, create_time, update_by, update_time from device_info + select di.device_id, device_name, di.parent_id, parent_type, tenant_id, online_state, version_code, + version_name, consume_mode, communicate_mode, device_ip, device_mask, device_mac, + device_gateway, dns_primary, dns_backup, device_sn, device_number, device_model, + device_type, device_pwd, device_addr, device_key, device_service_ip, device_service_port, + if_quota_limit, if_discount, if_time_limit, if_use_call_num, if_off_line_pay, if_use, + di.img_url, data_transfer_status, print_status, print_key, device_state, device_protocol, + heart_beat_time, last_update_time, di.create_by, di.create_time, di.update_by, di.update_time, + db.area_id, ba.area_name, db.canteen_id, bc.canteen_name, db.stall_id, bs.stall_name + from device_info di + left join device_bind db on di.device_id = db.device_id + left join basic_area ba on db.area_id = ba.area_id + left join basic_canteen bc on db.canteen_id = bc.canteen_id + left join basic_stall bs on db.stall_id = bs.stall_id - + + + + + insert into device_info @@ -192,6 +198,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateTime}, + + insert into device_bind(device_id, area_id, canteen_id, stall_id,create_by, create_time) + values (#{deviceId}, #{areaId}, #{canteenId}, #{stallId}, + #{createBy}, #{createTime}) + + + insert into cook_recipe_bind_device(device_id, canteen_id, stall_id,recipe_id,create_by, create_time) + values (#{deviceId}, #{canteenId}, #{stallId},#{recipeId}, + #{createBy}, #{createTime}) + update device_info @@ -241,6 +257,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where device_id = #{deviceId} + + update device_bind + + area_id = #{areaId}, + canteen_id = #{canteenId}, + stall_id = #{stallId}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where device_id = #{deviceId} + + + update cook_recipe_bind_device + + canteen_id = #{canteenId}, + stall_id = #{stallId}, + recipe_id = #{recipeId}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where device_id = #{deviceId} + delete from device_info where device_id = #{deviceId} @@ -248,7 +286,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from device_info where device_id in - + + #{deviceId} + + + + delete from device_bind where device_id in + + #{deviceId} + + + + delete from cook_recipe_bind_device where device_id in + #{deviceId}