package cn.com.goldenwater.dcproj.controller.dstfldqh; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.AttDstfldqhBase; import cn.com.goldenwater.dcproj.service.AttDstfldqhBaseService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.*; /** * @author lhc * @date 2021-6-10 */ @Api(value = "青海水毁名录管理",tags="青海水毁名录管理") @RestController @RequestMapping("/att/dstfldqh/base") public class AttDstfldqhBaseController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private AttDstfldqhBaseService attDstfldqhBaseService; @ApiOperation(value = "添加青海水毁名录") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "attDstfldqhBase", value = "AttDstfldqhBase", required = true) @RequestBody AttDstfldqhBase attDstfldqhBase) { if(StringUtils.isBlank(attDstfldqhBase.getId())) { attDstfldqhBaseService.insert(attDstfldqhBase); } else{ attDstfldqhBaseService.update(attDstfldqhBase); } return buildSuccessResponse(attDstfldqhBase); } @ApiOperation(value = "根据ID删除青海水毁名录") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = attDstfldqhBaseService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "更新青海水毁名录信息") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "attDstfldqhBase", value = "AttDstfldqhBase", required = true) @RequestBody AttDstfldqhBase attDstfldqhBase) { Assert.notNull(attDstfldqhBase.getId(), "主键id为必填参数"); int ret = attDstfldqhBaseService.update(attDstfldqhBase); return buildSuccessResponse(attDstfldqhBase); } @ApiOperation(value = "根据ID获取青海水毁名录(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { AttDstfldqhBase attDstfldqhBase = attDstfldqhBaseService.get(id); return buildSuccessResponse(attDstfldqhBase); } }