package cn.com.goldenwater.dcproj.controller.jspwiu2024; import cn.com.goldenwater.dcproj.model.AttJspwiu2024Base; import cn.com.goldenwater.dcproj.param.AttJspwiu2024BaseParam; import cn.com.goldenwater.dcproj.service.AttJspwiu2024BaseService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.utils.StringUtils; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; 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.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @author lhc * @date 2024-3-4 */ @Api(value = "xxx管理",tags="xxx管理") @RestController @RequestMapping("/att/jswiu2024/base") public class AttJspwiu2024BaseController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private AttJspwiu2024BaseService attJspwiu2024BaseService; @ApiOperation(value = "添加xxx") @RequestMapping(value = "/", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "attJspwiu2024Base", value = "AttJspwiu2024Base", required = true) @RequestBody AttJspwiu2024Base attJspwiu2024Base) { if(StringUtils.isBlank(attJspwiu2024Base.getId())) { attJspwiu2024BaseService.insert(attJspwiu2024Base); } else{ attJspwiu2024BaseService.update(attJspwiu2024Base); } return buildSuccessResponse(attJspwiu2024Base); } @ApiOperation(value = "根据id删除xxx") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = attJspwiu2024BaseService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "修改xxx") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "attJspwiu2024Base", value = "AttJspwiu2024Base", required = true) @RequestBody AttJspwiu2024Base attJspwiu2024Base) { Assert.notNull(attJspwiu2024Base.getId(), "主键id为必填参数"); int ret = attJspwiu2024BaseService.update(attJspwiu2024Base); return buildSuccessResponse(attJspwiu2024Base); } @ApiOperation(value = "根据ID获取xxx(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { AttJspwiu2024Base attJspwiu2024Base = attJspwiu2024BaseService.get(id); return buildSuccessResponse(attJspwiu2024Base); } }