package com.newfiber.api.pc.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import cn.hutool.db.PageResult; import com.newfiber.api.core.annotation.SysLog; import com.newfiber.api.core.base.BaseController; import com.newfiber.api.core.commons.CustomException; import com.newfiber.api.core.commons.PageResultObject; import com.newfiber.api.core.commons.ResultCode; import com.newfiber.api.core.commons.ResultObj; import com.newfiber.api.pc.camera.dto.Result; import com.newfiber.api.pc.model.entity.PlanNew; import com.newfiber.api.pc.model.entity.WaterloggingPoint; import com.newfiber.api.pc.model.request.waterloggingPoint.WaterloggingPointPageQueryRequest; import com.newfiber.api.pc.model.request.waterloggingPoint.WaterloggingPointQueryRequest; import com.newfiber.api.pc.model.request.waterloggingPoint.WaterloggingPointSaveRequest; import com.newfiber.api.pc.model.request.waterloggingPoint.WaterloggingPointUpdateRequest; import com.newfiber.api.pc.service.IWaterloggingPointService; import lombok.extern.java.Log; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.Date; import java.util.List; /** * 防汛应急指挥-易涝点管理Controller * * @author newfiber * @date 2024-07-24 */ @RestController @RequestMapping("/waterloggingPoint") @Api(value = "防汛应急指挥-易涝点管理", tags = "防汛应急指挥-易涝点管理") public class WaterloggingPointController extends BaseController { @Resource private IWaterloggingPointService waterloggingPointService; /** * 新增防汛应急指挥-易涝点管理 */ @PostMapping("add") @ApiOperation(value = "新增防汛应急指挥-易涝点管理", position = 10) @SysLog(actionType = "1",value = "防汛应急指挥-易涝点管理") public ResultObj add(@RequestBody WaterloggingPointSaveRequest request, HttpServletRequest httpServletRequest) { String userNo = httpServletRequest.getHeader("userNo"); if(StringUtils.isEmpty(request)){ throw new CustomException(ResultCode.PARAM_NULL); } request.setCreateBy(userNo); request.setCreateTime(new Date()); return new ResultObj<>(ResultCode.OK,waterloggingPointService.insert(request)); } /** * 修改防汛应急指挥-易涝点管理 */ @PutMapping("edit") @ApiOperation(value = "修改防汛应急指挥-易涝点管理", position = 20) @SysLog(actionType = "2",value = "防汛应急指挥-易涝点管理") public ResultObj edit(@RequestBody WaterloggingPointUpdateRequest request) { return new ResultObj<>(ResultCode.OK,waterloggingPointService.update(request)); } /** * 删除防汛应急指挥-易涝点管理 */ @DeleteMapping("/{ids}") @ApiOperation(value = "删除防汛应急指挥-易涝点管理", notes = "传入ids(,隔开)", position = 30) @SysLog(actionType = "3",value = "防汛应急指挥-易涝点管理") public ResultObj remove(@PathVariable String ids) { return new ResultObj<>(ResultCode.OK,waterloggingPointService.delete(ids)); } /** * 详细查询防汛应急指挥-易涝点管理 */ @GetMapping(value = "/{id}") @ApiOperation(value = "详细查询防汛应急指挥-易涝点管理", position = 40) public ResultObj detail(@PathVariable("id") Long id) { return new ResultObj<>(ResultCode.OK,waterloggingPointService.selectDetail(id)); } /** * 分页查询防汛应急指挥-易涝点管理 */ @GetMapping("/page") @ApiOperation(value = "分页查询防汛应急指挥-易涝点管理", position = 50) public ResultObj<PageResultObject<WaterloggingPoint>> page(WaterloggingPointPageQueryRequest request) { return new ResultObj<PageResultObject<WaterloggingPoint>>(ResultCode.OK,waterloggingPointService.selectPage(request)); } /** * 列表查询防汛应急指挥-易涝点管理 */ @GetMapping("/list") @ApiOperation(value = "列表查询防汛应急指挥-易涝点管理", position = 60) public ResultObj<List<WaterloggingPoint>> list(WaterloggingPointQueryRequest request) { List<WaterloggingPoint> list = waterloggingPointService.selectList(request); return new ResultObj<>(ResultCode.OK,list); } }