package com.newfiber.modules.inspection.controller; import com.github.pagehelper.PageHelper; import com.newfiber.common.utils.Constant; import com.newfiber.common.utils.R; import com.newfiber.modules.inspection.request.InspectionDetectionEquUpdateReq; import com.newfiber.modules.inspection.service.InspectionDetectionEquService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperationSupport; import java.util.Arrays; import java.util.Map; import javax.annotation.Resource; import javax.validation.Valid; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 巡检模板检测项Controller * * @author : xiongk * @since : 2020-11-06 09:33 */ @RestController @Api(value = "巡检模板检测项管理", tags = "巡检模板检测项管理") @RequestMapping("/inspection_detection_item") public class InspectionDetectionEquController { @Resource private InspectionDetectionEquService inspectionDetectionEquService; @ApiOperation(value = "保存巡检模板检测项") @ApiOperationSupport(order = 10) @PostMapping(value = "/save") public R save(@RequestBody @Valid InspectionDetectionEquUpdateReq request) { inspectionDetectionEquService.modify(request); return R.ok(); } @ApiOperation(value = "删除巡检模板检测项", hidden = true) @ApiOperationSupport(order = 20) @PostMapping("/delete") public R delete(@RequestBody Integer[] ids) { inspectionDetectionEquService.removeByIds(Arrays.asList(ids)); return R.ok(); } @ApiOperation(value = "修改巡检模板检测项", hidden = true) @ApiOperationSupport(order = 30) @PostMapping(value = "/update") public R update(@RequestBody @Valid InspectionDetectionEquUpdateReq request) { inspectionDetectionEquService.modify(request); return R.ok(); } @ApiOperation(value = "详细查询巡检模板检测项") @ApiOperationSupport(order = 40) @PostMapping("/detail/{id}") public R detail(@PathVariable("id") @Valid Integer id) { return R.ok().put("data", inspectionDetectionEquService.getById(id)); } @ApiOperation(value = "分页条件查询巡检模板检测项") @ApiOperationSupport(order = 50) @PostMapping(value = "/page") public R page(@RequestBody Map<String, Object> params) { int page = Integer.parseInt(params.get(Constant.PAGE).toString()); int limit = Integer.parseInt(params.get(Constant.LIMIT).toString()); PageHelper.startPage(page, limit); params.remove(Constant.PAGE); params.remove(Constant.LIMIT); return R.ok().put("page", inspectionDetectionEquService.listByMap(params)); } @ApiOperation(value = "列表条件查询巡检模板检测项") @ApiOperationSupport(order = 60) @PostMapping(value = "/list") public R list(@RequestBody Map<String, Object> params) { return R.ok().put("list", inspectionDetectionEquService.listByMap(params)); } }