package cn.com.goldenwater.dcproj.controller.zhejiang; import cn.com.goldenwater.dcproj.model.AttZhejiangJgBase; import cn.com.goldenwater.dcproj.param.AttZhejiangJgBaseParam; import cn.com.goldenwater.dcproj.service.AttZhejiangJgBaseService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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.RestController; import java.util.List; /** * @author lune * @date 2020-5-12 */ @Api(value = "ATT 浙江监管基本信息管理",tags="ATT 浙江监管基本信息管理") @RestController @RequestMapping("/att/zhejiang/jg/base") public class AttZhejiangJgBaseController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private AttZhejiangJgBaseService attZhejiangJgBaseService; @ApiOperation(value = "添加/修改") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "attZhejiangJgBase", value = "AttZhejiangJgBase", required = true) @RequestBody AttZhejiangJgBase attZhejiangJgBase) { if(StringUtils.isBlank(attZhejiangJgBase.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid attZhejiangJgBase.setId(uuid); attZhejiangJgBaseService.insert(attZhejiangJgBase); }else{ attZhejiangJgBaseService.update(attZhejiangJgBase); } return buildSuccessResponse(attZhejiangJgBase); } @ApiOperation(value = "根据ID删除") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = attZhejiangJgBaseService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { AttZhejiangJgBase attZhejiangJgBase = attZhejiangJgBaseService.get(id); return buildSuccessResponse(attZhejiangJgBase); } @ApiOperation(value = "获取(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "attZhejiangJgBaseParam", value = "attZhejiangJgBaseParam", required = true) @RequestBody AttZhejiangJgBaseParam attZhejiangJgBaseParam) { List attZhejiangJgBaseList = attZhejiangJgBaseService.findList(attZhejiangJgBaseParam); return buildSuccessResponse(attZhejiangJgBaseList); } @ApiOperation(value = "获取(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "attZhejiangJgBaseParam", value = "attZhejiangJgBaseParam", required = true) @RequestBody AttZhejiangJgBaseParam attZhejiangJgBaseParam) { PageInfo attZhejiangJgBaseList = attZhejiangJgBaseService.findPageInfo(attZhejiangJgBaseParam); return buildSuccessResponse(attZhejiangJgBaseList); } }