| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentDto; |
| | |
| | | Result<MdcEquipment> result = new Result<>(); |
| | | String selectedDeparts = mdcEquipment.getSelectedDeparts(); |
| | | String selectedProduction = mdcEquipment.getSelectedProduction(); |
| | | mdcEquipment.setEquipmentStatus(CommonConstant.STATUS_NORMAL); |
| | | try { |
| | | mdcEquipmentService.saveMdcEquipment(mdcEquipment, selectedDeparts, selectedProduction); |
| | | result.success("添加成功!"); |
| | |
| | | MdcEquipment mdcEquipment = mdcEquipmentService.getEquipmentByDepPid(pid, userId); |
| | | return Result.OK(mdcEquipment); |
| | | } |
| | | |
| | | /** |
| | | * 手动上报设备异常及说明 |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设备表-手动上报设备异常及说明") |
| | | @ApiOperation(value = "设备表-手动上报设备异常及说明", notes = "设备表-手动上报设备异常及说明") |
| | | @GetMapping("/updateEquipmentStatus") |
| | | public Result<?> updateEquipmentStatus(@RequestParam(name = "id", required = true) String id) { |
| | | Result result = new Result<>(); |
| | | try { |
| | | MdcEquipment mdcEquipment1 = mdcEquipmentService.getById(id); |
| | | if (mdcEquipment1 == null) { |
| | | result.error500("未找到对应实体"); |
| | | } else { |
| | | LambdaUpdateWrapper<MdcEquipment> updateWrapper = new LambdaUpdateWrapper<MdcEquipment>(); |
| | | updateWrapper.eq(MdcEquipment::getId, id); |
| | | if (CommonConstant.STATUS_NORMAL.equals(mdcEquipment1.getEquipmentStatus())) { |
| | | updateWrapper.set(MdcEquipment::getEquipmentStatus, CommonConstant.STATUS_DISABLE); |
| | | } else { |
| | | updateWrapper.set(MdcEquipment::getEquipmentStatus, CommonConstant.STATUS_NORMAL); |
| | | } |
| | | mdcEquipmentService.update(updateWrapper); |
| | | result.success("反馈成功!"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | result.error500("操作失败"); |
| | | } |
| | | return Result.OK("反馈成功!"); |
| | | } |
| | | } |