123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package com.ruoyi.web.controller.mobile;
- import com.ruoyi.common.annotation.Log;
- import com.ruoyi.common.annotation.RepeatSubmit;
- import com.ruoyi.common.core.controller.BaseController;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.core.page.TableDataInfo;
- import com.ruoyi.common.core.validate.AddGroup;
- import com.ruoyi.common.core.validate.EditGroup;
- import com.ruoyi.common.core.validate.QueryGroup;
- import com.ruoyi.common.enums.BusinessType;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.gas.domain.bo.GEmergencyRepairBo;
- import com.ruoyi.gas.domain.vo.GEmergencyRepairVo;
- import com.ruoyi.gas.service.IGEmergencyRepairService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import javax.validation.constraints.NotEmpty;
- import javax.validation.constraints.NotNull;
- import java.util.Arrays;
- import java.util.List;
- /**
- * 抢险维修Controller
- *
- * @author JX.Li
- * @date 2023-10-23
- */
- @Validated
- @Api(value = "抢险维修控制器", tags = {"抢险维修管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/mobile/emergencyRepair")
- public class MEmergencyRepairController extends BaseController {
- private final IGEmergencyRepairService iGEmergencyRepairService;
- /**
- * 查询抢险维修列表
- */
- @ApiOperation("查询抢险维修列表")
- @PreAuthorize("@ss.hasPermi('gas:emergencyRepair:list')")
- @GetMapping("/list")
- public TableDataInfo<GEmergencyRepairVo> list(@Validated(QueryGroup.class) GEmergencyRepairBo bo) {
- return iGEmergencyRepairService.queryPageList(bo);
- }
- /**
- * 导出抢险维修列表
- */
- @ApiOperation("导出抢险维修列表")
- @PreAuthorize("@ss.hasPermi('gas:emergencyRepair:export')")
- @Log(title = "抢险维修", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public void export(@Validated GEmergencyRepairBo bo, HttpServletResponse response) {
- List<GEmergencyRepairVo> list = iGEmergencyRepairService.queryList(bo);
- ExcelUtil.exportExcel(list, "抢险维修", GEmergencyRepairVo.class, response);
- }
- /**
- * 获取抢险维修详细信息
- */
- @ApiOperation("获取抢险维修详细信息")
- @PreAuthorize("@ss.hasPermi('gas:emergencyRepair:query')")
- @GetMapping("/{id}")
- public AjaxResult<GEmergencyRepairVo> getInfo(@NotNull(message = "主键不能为空")
- @PathVariable("id") Long id) {
- return AjaxResult.success(iGEmergencyRepairService.queryById(id));
- }
- /**
- * 新增抢险维修
- */
- @ApiOperation("新增抢险维修")
- @PreAuthorize("@ss.hasPermi('gas:emergencyRepair:add')")
- @Log(title = "抢险维修", businessType = BusinessType.INSERT)
- @RepeatSubmit()
- @PostMapping()
- public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody GEmergencyRepairBo bo) {
- return toAjax(iGEmergencyRepairService.insertByBo(bo) ? 1 : 0);
- }
- /**
- * 修改抢险维修
- */
- @ApiOperation("修改抢险维修")
- @PreAuthorize("@ss.hasPermi('gas:emergencyRepair:edit')")
- @Log(title = "抢险维修", businessType = BusinessType.UPDATE)
- @RepeatSubmit()
- @PutMapping()
- public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody GEmergencyRepairBo bo) {
- return toAjax(iGEmergencyRepairService.updateByBo(bo) ? 1 : 0);
- }
- /**
- * 删除抢险维修
- */
- @ApiOperation("删除抢险维修")
- @PreAuthorize("@ss.hasPermi('gas:emergencyRepair:remove')")
- @Log(title = "抢险维修" , businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
- @PathVariable Long[] ids) {
- return toAjax(iGEmergencyRepairService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
- }
- }
|