| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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.query.QueryGenerator; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.vo.EamEquipmentTree; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | |
| | | public class EamEquipmentController extends JeecgController<EamEquipment, IEamEquipmentService> { |
| | | @Autowired |
| | | private IEamEquipmentService eamEquipmentService; |
| | | |
| | | @Autowired |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | public Result<?> add(@RequestBody EamEquipment eamEquipment) { |
| | | EamEquipment entity = eamEquipmentService.saveEquipment(eamEquipment); |
| | | if (entity == null) { |
| | | Result.OK("添加失败!"); |
| | | return Result.OK("添加失败!"); |
| | | } |
| | | //调用mdcEquipment插入MDC设备 |
| | | if(CommonConstant.DEFAULT_1.equals(eamEquipment.getMdcFlag())) { |
| | | //插入MDC设备 |
| | | MdcEquipment mdcEquipment = new MdcEquipment(); |
| | | mdcEquipment.setEquipmentId(entity.getEquipmentCode()); |
| | | mdcEquipment.setEquipmentType(entity.getDeviceType()); |
| | | mdcEquipment.setEquipmentName(entity.getEquipmentName()); |
| | | mdcEquipmentService.addNewEquipmentFromEam(mdcEquipment, eamEquipment.getOrgId()); |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |