| | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.modules.eam.entity.EamSparePartInventory; |
| | | import org.jeecg.modules.eam.entity.EamSpareParts; |
| | | import org.jeecg.modules.eam.service.IEamSparePartInventoryService; |
| | | import org.jeecg.modules.eam.service.IEamSparePartsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | @Resource |
| | | private IEamSparePartsService eamSparePartsService; |
| | | |
| | | @Autowired |
| | | private IEamSparePartInventoryService eamSparePartInventoryService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "备品备件管理-分页列表查询") |
| | | @ApiOperation(value = "备品备件管理-分页列表查询", notes = "备品备件管理-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamSpareParts eamSpareParts, |
| | |
| | | QueryWrapper<EamSpareParts> queryWrapper = QueryGenerator.initQueryWrapper(eamSpareParts, req.getParameterMap()); |
| | | Page<EamSpareParts> page = new Page<EamSpareParts>(pageNo, pageSize); |
| | | IPage<EamSpareParts> pageList = eamSparePartsService.page(page, queryWrapper); |
| | | for (EamSpareParts record : pageList.getRecords()) { |
| | | QueryWrapper<EamSparePartInventory> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("spare_part_id",record.getId()).select("sum(inventory) as inventory"); |
| | | EamSparePartInventory one = eamSparePartInventoryService.getOne(wrapper); |
| | | record.setTotalQuantity(one.getInventory().toString()); |
| | | } |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | * @param eamSpareParts |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "备品备件管理-添加") |
| | | @ApiOperation(value = "备品备件管理-添加", notes = "备品备件管理-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamSpareParts eamSpareParts) { |
| | |
| | | * @param eamSpareParts |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "备品备件管理-编辑") |
| | | @ApiOperation(value = "备品备件管理-编辑", notes = "备品备件管理-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamSpareParts eamSpareParts) { |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "备品备件管理-通过id删除") |
| | | @ApiOperation(value = "备品备件管理-通过id删除", notes = "备品备件管理-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "备品备件管理-批量删除") |
| | | @ApiOperation(value = "备品备件管理-批量删除", notes = "备品备件管理-批量删除") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "备品备件管理-通过id查询") |
| | | @ApiOperation(value = "备品备件管理-通过id查询", notes = "备品备件管理-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |