From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期三, 25 六月 2025 11:51:38 +0800 Subject: [PATCH] Merge branch 'mdc_hyjs_master' --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSparePartInventoryController.java | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 153 insertions(+), 0 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSparePartInventoryController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSparePartInventoryController.java new file mode 100644 index 0000000..9d2d404 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSparePartInventoryController.java @@ -0,0 +1,153 @@ +package org.jeecg.modules.eam.controller; + +import java.util.Arrays; +import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +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.service.IEamSparePartInventoryService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.system.base.controller.JeecgController; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * @Description: 澶囦欢搴撳瓨淇℃伅 + * @Author: Lius + * @Date: 2025-03-19 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "澶囦欢搴撳瓨淇℃伅") +@RestController +@RequestMapping("/eam/eamSparePartInventory") +public class EamSparePartInventoryController extends JeecgController<EamSparePartInventory, IEamSparePartInventoryService> { + + @Resource + private IEamSparePartInventoryService eamSparePartInventoryService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param eamSparePartInventory + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = "澶囦欢搴撳瓨淇℃伅-鍒嗛〉鍒楄〃鏌ヨ", notes = "澶囦欢搴撳瓨淇℃伅-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(EamSparePartInventory eamSparePartInventory, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<EamSparePartInventory> queryWrapper = QueryGenerator.initQueryWrapper(eamSparePartInventory, req.getParameterMap()); + Page<EamSparePartInventory> page = new Page<EamSparePartInventory>(pageNo, pageSize); + IPage<EamSparePartInventory> pageList = eamSparePartInventoryService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param eamSparePartInventory + * @return + */ + @ApiOperation(value = "澶囦欢搴撳瓨淇℃伅-娣诲姞", notes = "澶囦欢搴撳瓨淇℃伅-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody EamSparePartInventory eamSparePartInventory) { + List<EamSparePartInventory> eamSparePartInventories = eamSparePartInventory.getEamSparePartInventories(); + for (EamSparePartInventory sparePartInventory : eamSparePartInventories) { + eamSparePartInventoryService.save(sparePartInventory); + } + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param eamSparePartInventory + * @return + */ + @ApiOperation(value = "澶囦欢搴撳瓨淇℃伅-缂栬緫", notes = "澶囦欢搴撳瓨淇℃伅-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody EamSparePartInventory eamSparePartInventory) { + eamSparePartInventoryService.updateById(eamSparePartInventory); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @ApiOperation(value = "澶囦欢搴撳瓨淇℃伅-閫氳繃id鍒犻櫎", notes = "澶囦欢搴撳瓨淇℃伅-閫氳繃id鍒犻櫎") + @DeleteMapping(value = "/delete") + public Result<?> delete(@RequestParam(name = "id", required = true) String id) { + eamSparePartInventoryService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @ApiOperation(value = "澶囦欢搴撳瓨淇℃伅-鎵归噺鍒犻櫎", notes = "澶囦欢搴撳瓨淇℃伅-鎵归噺鍒犻櫎") + @DeleteMapping(value = "/deleteBatch") + public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.eamSparePartInventoryService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + @ApiOperation(value = "澶囦欢搴撳瓨淇℃伅-閫氳繃id鏌ヨ", notes = "澶囦欢搴撳瓨淇℃伅-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { + EamSparePartInventory eamSparePartInventory = eamSparePartInventoryService.getById(id); + return Result.OK(eamSparePartInventory); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param eamSparePartInventory + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, EamSparePartInventory eamSparePartInventory) { + return super.exportXls(request, eamSparePartInventory, EamSparePartInventory.class, "澶囦欢搴撳瓨淇℃伅"); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, EamSparePartInventory.class); + } + +} -- Gitblit v1.9.3