¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |