package com.ycl.controller.epuipment; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.annotation.LogSave; import com.ycl.api.CommonResult; import com.ycl.controller.BaseController; import com.ycl.entity.equipment.EquipmentBayonet; import com.ycl.service.dict.IDataDictionaryService; import com.ycl.service.equipment.IEquipmentBayonetService; import com.ycl.service.region.ISccgRegionService; import com.ycl.utils.EasyExcelUtils; import com.ycl.vo.equipment.EquipmentBayonetVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.SneakyThrows; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; /** *

* 卡口管理 前端控制器 *

* * @author wl * @since 2022-10-14 */ @RestController @RequestMapping("/equipment_bayonet") @Api(tags = "卡口管理") public class EquipmentBayonetController extends BaseController { @Autowired IEquipmentBayonetService iEquipmentBayonetService; @Autowired IDataDictionaryService iDataDictionaryService; @Autowired ISccgRegionService iSccgRegionService; @GetMapping("/query") @ApiOperation("查询") @LogSave(operationType = "卡口管理", contain = "查询卡口") public CommonResult search(@RequestParam(required = false) Integer size, @RequestParam(required = false) Integer current, @RequestParam(required = false) String bayonetName) { Page equipmentBayonetPage = new Page<>(); equipmentBayonetPage.setCurrent(current); equipmentBayonetPage.setSize(size); return CommonResult.success(iEquipmentBayonetService.selectEquipmentPage(equipmentBayonetPage, bayonetName)); } @PostMapping("/addition") @ApiOperation("添加") @LogSave(operationType = "卡口管理", contain = "添加卡口") public CommonResult add(@RequestBody EquipmentBayonet equipmentBayonet) { return CommonResult.success(iEquipmentBayonetService.save(equipmentBayonet)); } @PutMapping("/modification") @ApiOperation("修改") @LogSave(operationType = "卡口管理", contain = "修改卡口") public CommonResult modify(@RequestBody EquipmentBayonet equipmentBayonet) { return CommonResult.success(iEquipmentBayonetService.updateById(equipmentBayonet)); } @DeleteMapping("/delete/{id}") @ApiOperation("删除") @LogSave(operationType = "卡口管理", contain = "删除卡口") public CommonResult delete(@PathVariable Integer id) { return CommonResult.success(iEquipmentBayonetService.removeById(id)); } @PostMapping("/export") @ApiOperation("导出") @SneakyThrows @LogSave(operationType = "卡口管理", contain = "导出卡口") public void export(HttpServletResponse response, @RequestParam(required = false) Integer size, @RequestParam(required = false) Integer current, @RequestParam(required = false) String bayonetName) { Page equipmentBayonetPage = new Page<>(); equipmentBayonetPage.setCurrent(current); equipmentBayonetPage.setSize(size); EasyExcelUtils.export(response, "数据", EquipmentBayonetVO.class, iEquipmentBayonetService.selectEquipmentPage(equipmentBayonetPage, bayonetName).getRecords()); } }