| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.EquipmentSpares; |
| | | import org.jeecg.modules.eam.entity.EquipmentStructure; |
| | | import org.jeecg.modules.eam.service.IEquipmentSparesService; |
| | |
| | | |
| | | import org.jeecg.modules.eam.service.IEquipmentStructureService; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.modules.spare.entity.SparePart; |
| | | import org.jeecg.modules.spare.service.ISparePartService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | |
| | | |
| | | @Autowired |
| | | private IEquipmentStructureService equipmentStructureService; |
| | | |
| | | @Autowired |
| | | private ISparePartService sparePartService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | |
| | | } |
| | | return Result.ok(equipmentSparesList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | |
| | | equipmentSparesService.save(equipmentSpares); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | |
| | | @PutMapping(value = "/editByEquipment") |
| | | public Result<String> addByEquipment(@RequestBody Equipment equipment) { |
| | | List<EquipmentSpares> list = equipment.getEquipmentSparesList(); |
| | | equipmentSparesService.remove(new QueryWrapper<EquipmentSpares>().eq("equipment_id",equipment.getId())); |
| | | for(EquipmentSpares equipmentSpares:list){ |
| | | equipmentSpares.setEquipmentId(equipment.getId()); |
| | | } |
| | | equipmentSparesService.saveBatch(list); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | |
| | | equipmentSparesService.updateById(equipmentSpares); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | |
| | | equipmentSparesService.updateById(equipmentSpares); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | |
| | | // this.equipmentSparesService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EquipmentSpares.class); |
| | | } |
| | | @GetMapping(value = "/myPage") |
| | | public Result<IPage<EquipmentSpares>> myPage(EquipmentSpares equipmentSpares, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EquipmentSpares> queryWrapper = QueryGenerator.initQueryWrapper(equipmentSpares, req.getParameterMap()); |
| | | Page<EquipmentSpares> page = new Page<EquipmentSpares>(pageNo, pageSize); |
| | | IPage<EquipmentSpares> pageList = equipmentSparesService.myPage(page, equipmentSpares); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @GetMapping(value = "/myList") |
| | | public Result<?> myList(@RequestParam(name = "id", required = true) String id){ |
| | | return Result.OK(equipmentSparesService.getListByEquipmentId(id)); |
| | | } |
| | | @GetMapping(value = "/sparePartlist") |
| | | public Result<IPage<SparePart>> queryPageList(SparePart sparePart, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<SparePart> queryWrapper = QueryGenerator.initQueryWrapper(sparePart, req.getParameterMap()); |
| | | Page<SparePart> page = new Page<SparePart>(pageNo, pageSize); |
| | | IPage<SparePart> pageList = sparePartService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | |
| | | |